From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f49.google.com (mail-wm1-f49.google.com [209.85.128.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 691B930FC26 for ; Thu, 7 May 2026 20:40:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.49 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778186415; cv=none; b=IwHZi0qz6pONbYYtUWTXVWRyHuXriADMsH5xz38vpvku70tkQ5m+A0G+eWlxHTLKe7jZHJ0Z46wTt7SEg1xzgFzK7vLpyc9PoSxJ6LO5Bia3uFDNOBR3Od3MIQFP/uBdSjNX28R0yXAaaCN94Zq3UKq5WJmx81MgOxkLHkuky8w= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778186415; c=relaxed/simple; bh=Kdq5NNBpBmf2F409Meltod856ClN2TyEsVnqowPzBrg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=B3RBrlakLTt436OIVQzVwhlJGv0erBYicPVvqq33UQMsr1qIc7nMTfkxXhiO20J/WnLfH5LwDTRhaKemhrJumBuQ06BbMQOYrp0CJrHk2kzSdabvp4S6A6/jLLL1vWrXUMbLbOd3N/9/Kg2CKz3xXqyK+ryOhf6cHIJJp/XXj8U= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=hQfieDPd; arc=none smtp.client-ip=209.85.128.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="hQfieDPd" Received: by mail-wm1-f49.google.com with SMTP id 5b1f17b1804b1-488b0046078so11145905e9.1 for ; Thu, 07 May 2026 13:40:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1778186412; x=1778791212; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=X1CnkXYMofkVF0z0P6JiV9z7XyvR/dfwP1bUNpx9s2c=; b=hQfieDPdbO4+r+DGHJszVLwwQEgLLvsh6ZSUHkedKB+x1pqRLJUAiRdy84qmxxvRub HjpyZWdd/YeuSSLTLDxTMzx1ZoefQXRg87hJwMLEZ/3B348HAOCUoRjSex/fUBs93j6Z hbycDhGLi8k80AJNWFIp4ThbDHZqzT63pc8F01taPJjdaVWT7eRXbaz8ifN66cBKwzuP avAjs16wFRSK0eAK5sDrf6Vl119/IaNof156YclBiUBtdsFnqdSKWJy9U4JaMgZAnAHI 841s+gyhfkTuCoWnlB33DrENDjJOM0LIDyvI7Nq+zMkU0bkt4Va3GS7J4boM9OPEz0kA u5Qw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1778186412; x=1778791212; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=X1CnkXYMofkVF0z0P6JiV9z7XyvR/dfwP1bUNpx9s2c=; b=EgvuCyymauTSVfb5iAMwFXtzKht7B/nxYUPHh/ldA9fCfsqK8v4zAVZcBfQRI7KGAg 6ODcPr1FrExKDJA6Yw4ZG89L588rNCRQSOzdB4J3lDlokMtwTvHfz/PwtVZsVnuRr3qU SQ7VMxLMnak9SigaTIHGr5usfcJe/U0h7Tdt6HoK9flvSQYG2/bL2SwjxmL+PK0A8rsY aVgJjm4KmVtFeRLnHXcOEOi/ofqU3E7f4QZJPUKPaHVZtAWbllvxSzA66FBQ1EBHSMAY /srHs1cH4t1PuwQtsXIiEH1c/fAuiR2WbmlmITQA+vcA9lN0m0nuaGYfexjRibxq/Rji 4tFw== X-Forwarded-Encrypted: i=1; AFNElJ93xMKdEphOYIaa/rSEZQEJ35wZeg7GnLIuXTajIoN7E2ABaVODsPNw5LxcLZ8JBRPpEAm2dYQ2gnIPqtE=@vger.kernel.org X-Gm-Message-State: AOJu0Yx3XQMXnY/ZKcoDtHsc5LtadxkbjmROXOSHR0GJxvh23CmooB0B uVhmWP+WlWTZuiWuJtUdkDt+6C9jdNT91/8LJ6sRGueIVF7OReNh0j14 X-Gm-Gg: AeBDieu8dhak6TsPpJOvQdfiHhuYfS5lAR/EV8Ne0/I53EQn671QpJeSbHxwlCw7iGY aE3XBG7T6+gXyIZsq5VhmIXNdk7gpNXrn3iQEAuSOcwg484plzYRh3vTNadJdYBk9XG5x/aMxs0 LR7ZKoHDf9lJsNNTXdaW/hkWB1QVU6r1HaLOT/yBeUtWQwnCF1E3Gomqm3YoluO27orAta+pDLX RC6IfqohWwsGeshOQ7rwDI1kfSbo0dyflQtD7M6r/SjTDc4ov8x/6VVnOe62QVCnbuurj2YHjm9 5j1CKOW4RxgDD4BY0kWiXZjV+BOlg9JH+R6tBNZuHqjwvZATihiXO/Tc5poWyI5CHcOEvkl+G0N Yj3441Q1yB6QvnPI4ORCAm4mc4V8NGq3hpy2L0M+P2j/k3i3Ztu+EnaUQft+aMOn2JMPBiQ3oOj nR+TVWw84x4S/17J+nfeuNnZpC+bKg X-Received: by 2002:a05:600c:8485:b0:48a:76a3:2b9b with SMTP id 5b1f17b1804b1-48e51f32811mr160047405e9.17.1778186411702; Thu, 07 May 2026 13:40:11 -0700 (PDT) Received: from [100.82.231.29] ([185.57.101.106]) by smtp.googlemail.com with ESMTPSA id 5b1f17b1804b1-48e5382a327sm264367515e9.0.2026.05.07.13.40.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 May 2026 13:40:11 -0700 (PDT) From: Jim Cromie Date: Thu, 07 May 2026 14:40:05 -0600 Subject: [PATCH v2 1/5] vmlinux.lds.h: refactor BOUNDED_SECTION_* macros into bounded_sections.lds.h Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20260507-asm-generic-1-v2-1-47c52759d268@gmail.com> References: <20260507-asm-generic-1-v2-0-47c52759d268@gmail.com> In-Reply-To: <20260507-asm-generic-1-v2-0-47c52759d268@gmail.com> To: Arnd Bergmann , Jason Baron , Luis Chamberlain , Petr Pavlu , Daniel Gomez , Sami Tolvanen , Aaron Tomlin Cc: linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org, linux-modules@vger.kernel.org, Jim Cromie X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1778186409; l=3982; i=jim.cromie@gmail.com; s=20260203; h=from:subject:message-id; bh=Kdq5NNBpBmf2F409Meltod856ClN2TyEsVnqowPzBrg=; b=Uj4wWShFQLWZ/5Ma1qA7xa/YvM/ZvXLDNQsUAcG/2ldbzAxm0P1oRUXjNlAkvNYqlu1u/vqHt VXbqnLFNSEyDVQQ3CAtSuzcayN9LdymdEoQH429YjHj2kg2xBTTTpSE X-Developer-Key: i=jim.cromie@gmail.com; a=ed25519; pk=C6E5ODlPQo7ZBynATXH9wg7K6HxP0pIXyf4s38Qw0XE= Move BOUNDED_SECTION_* macros to a new helper file: include/asm-generic/bounded_sections.lds.h and include it back into vmlinux.lds.h. This allows its reuse later to fix a failure to keep dyndbg sections in some circumstances. NOTES: These macros are only for use in vmlinux.lds.h, where the _start & _end symbols are needed. Modules keep sections separate in ELF sections, with their boundaries known, so the _start and _end are not useful, and may confuse tools not expecting them. This patch ignores a checkpatch warning, because new file is covered by "GENERIC INCLUDE/ASM HEADER FILES" in MAINTAINERS CC: Arnd Bergmann CC: linux-arch@vger.kernel.org Signed-off-by: Jim Cromie --- include/asm-generic/bounded_sections.lds.h | 36 ++++++++++++++++++++++++++++++ include/asm-generic/vmlinux.lds.h | 30 +------------------------ 2 files changed, 37 insertions(+), 29 deletions(-) diff --git a/include/asm-generic/bounded_sections.lds.h b/include/asm-generic/bounded_sections.lds.h new file mode 100644 index 000000000000..8c29293ca7fb --- /dev/null +++ b/include/asm-generic/bounded_sections.lds.h @@ -0,0 +1,36 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +#ifndef _ASM_GENERIC_BOUNDED_SECTIONS_H +#define _ASM_GENERIC_BOUNDED_SECTIONS_H + +#define BOUNDED_SECTION_PRE_LABEL(_sec_, _label_, _BEGIN_, _END_) \ + _BEGIN_##_label_ = .; \ + KEEP(*(_sec_)) \ + _END_##_label_ = .; + +#define BOUNDED_SECTION_POST_LABEL(_sec_, _label_, _BEGIN_, _END_) \ + _label_##_BEGIN_ = .; \ + KEEP(*(_sec_)) \ + _label_##_END_ = .; + +#define BOUNDED_SECTION_BY(_sec_, _label_) \ + BOUNDED_SECTION_PRE_LABEL(_sec_, _label_, __start, __stop) + +#define BOUNDED_SECTION(_sec) BOUNDED_SECTION_BY(_sec, _sec) + +#define HEADERED_SECTION_PRE_LABEL(_sec_, _label_, _BEGIN_, _END_, _HDR_) \ + _HDR_##_label_ = .; \ + KEEP(*(.gnu.linkonce.##_sec_)) \ + BOUNDED_SECTION_PRE_LABEL(_sec_, _label_, _BEGIN_, _END_) + +#define HEADERED_SECTION_POST_LABEL(_sec_, _label_, _BEGIN_, _END_, _HDR_) \ + _label_##_HDR_ = .; \ + KEEP(*(.gnu.linkonce.##_sec_)) \ + BOUNDED_SECTION_POST_LABEL(_sec_, _label_, _BEGIN_, _END_) + +#define HEADERED_SECTION_BY(_sec_, _label_) \ + HEADERED_SECTION_PRE_LABEL(_sec_, _label_, __start, __stop) + +#define HEADERED_SECTION(_sec) HEADERED_SECTION_BY(_sec, _sec) + +#endif /* _ASM_GENERIC_BOUNDED_SECTIONS_H */ diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h index 60c8c22fd3e4..f78300aea8f6 100644 --- a/include/asm-generic/vmlinux.lds.h +++ b/include/asm-generic/vmlinux.lds.h @@ -211,35 +211,7 @@ # endif #endif -#define BOUNDED_SECTION_PRE_LABEL(_sec_, _label_, _BEGIN_, _END_) \ - _BEGIN_##_label_ = .; \ - KEEP(*(_sec_)) \ - _END_##_label_ = .; - -#define BOUNDED_SECTION_POST_LABEL(_sec_, _label_, _BEGIN_, _END_) \ - _label_##_BEGIN_ = .; \ - KEEP(*(_sec_)) \ - _label_##_END_ = .; - -#define BOUNDED_SECTION_BY(_sec_, _label_) \ - BOUNDED_SECTION_PRE_LABEL(_sec_, _label_, __start, __stop) - -#define BOUNDED_SECTION(_sec) BOUNDED_SECTION_BY(_sec, _sec) - -#define HEADERED_SECTION_PRE_LABEL(_sec_, _label_, _BEGIN_, _END_, _HDR_) \ - _HDR_##_label_ = .; \ - KEEP(*(.gnu.linkonce.##_sec_)) \ - BOUNDED_SECTION_PRE_LABEL(_sec_, _label_, _BEGIN_, _END_) - -#define HEADERED_SECTION_POST_LABEL(_sec_, _label_, _BEGIN_, _END_, _HDR_) \ - _label_##_HDR_ = .; \ - KEEP(*(.gnu.linkonce.##_sec_)) \ - BOUNDED_SECTION_POST_LABEL(_sec_, _label_, _BEGIN_, _END_) - -#define HEADERED_SECTION_BY(_sec_, _label_) \ - HEADERED_SECTION_PRE_LABEL(_sec_, _label_, __start, __stop) - -#define HEADERED_SECTION(_sec) HEADERED_SECTION_BY(_sec, _sec) +#include #ifdef CONFIG_TRACE_BRANCH_PROFILING #define LIKELY_PROFILE() \ -- 2.54.0