From nobody Tue Dec 2 00:02:23 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D2BD93164DC for ; Wed, 26 Nov 2025 06:07:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764137256; cv=none; b=KVj0u71sELVwNT9dV9ZaADmxjzLviGYOz9CGEtLtSIjF/qTSokTGA4bXlxIxOzAxmLfoYSfdWa2lZ8TTW+/mjtADcY6+GnukvZnBRFFFpNt9ieCVyi7b2CptzoMqdYCPZcHB2M0n61NupOIhdOGNpHj7ecpgoW9IBmYETJHp6lQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764137256; c=relaxed/simple; bh=JHC8/5dqstdYLiJvpKVua5FN/n2OYzsV1oXnyh+P7f4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=CPzMJQIfeTnFENNSKXUBMtVsdN6l1eeuha+QW/NU4L6Sal5XUg6E9w3VBUSbI1Xp8rlIJgU8NO/BGNGUdN/mJsBxXUkf/k3/inyyM1arTfzZbJpkFaS/lrtQK9tUV67r40aZik03qH/rAg7vjYmmzKkmm1I6pArZ0jXqRV15OIw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=uni3ob5g; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="uni3ob5g" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 42E62C16AAE; Wed, 26 Nov 2025 06:07:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1764137256; bh=JHC8/5dqstdYLiJvpKVua5FN/n2OYzsV1oXnyh+P7f4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uni3ob5gTXyjIRby+uG5GYlA/ccBJq5Ycb+8QnVTX5Oq/bgcKpxPY8IaBCv8ejZ94 Esq9Mf45iI7gXfzEKubHcob5BFTj37tUAqGgHhgDFxTnI2N83/v/o3DYyo1EqacfSx gaa1KihPKtgd9DE4iw6/gSUyvOuGfsP/XamPZ7lBxm1MUL+Ygsm1sKyonkJd4PUhWa oZgBmLVkrY1AlN0CDlbVTQ1iNQ7Lw+bN/BSPAUvyZExh/QdzdckP7J1kpaZ60bq8r2 fcW8sZrCHxKSlPvAqOoPslKIWuwOjwxv6LFAQdQ8WfzTkjSF3nVuy6R2rbLbzSAgoe ZqiseP4N8IBCg== From: Josh Poimboeuf To: x86@kernel.org Cc: linux-kernel@vger.kernel.org, Peter Zijlstra Subject: [PATCH 2/4] x86/asm: Remove ANNOTATE_DATA_SPECIAL usage Date: Tue, 25 Nov 2025 22:06:58 -0800 Message-ID: X-Mailer: git-send-email 2.51.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Instead of manually annotating each __ex_table entry, just make the section mergeable and store the entry size in the ELF section header. Either way works for objtool create_fake_symbols(), this way produces cleaner code generation. Signed-off-by: Josh Poimboeuf --- arch/um/include/asm/Kbuild | 1 - arch/um/include/shared/common-offsets.h | 1 + arch/x86/include/asm/asm.h | 25 ++++++++++++---------- arch/x86/kernel/asm-offsets.c | 1 + arch/x86/um/shared/sysdep/kernel-offsets.h | 2 ++ kernel/bounds.c | 1 + scripts/mod/devicetable-offsets.c | 1 + 7 files changed, 20 insertions(+), 12 deletions(-) diff --git a/arch/um/include/asm/Kbuild b/arch/um/include/asm/Kbuild index b6810db24ca4..1b9b82bbe322 100644 --- a/arch/um/include/asm/Kbuild +++ b/arch/um/include/asm/Kbuild @@ -5,7 +5,6 @@ generic-y +=3D device.h generic-y +=3D dma-mapping.h generic-y +=3D emergency-restart.h generic-y +=3D exec.h -generic-y +=3D extable.h generic-y +=3D ftrace.h generic-y +=3D hw_irq.h generic-y +=3D irq_regs.h diff --git a/arch/um/include/shared/common-offsets.h b/arch/um/include/shar= ed/common-offsets.h index 4e19103afd71..a6f77cb6aa7e 100644 --- a/arch/um/include/shared/common-offsets.h +++ b/arch/um/include/shared/common-offsets.h @@ -20,3 +20,4 @@ DEFINE(UM_KERN_GDT_ENTRY_TLS_ENTRIES, GDT_ENTRY_TLS_ENTRI= ES); DEFINE(UM_SECCOMP_ARCH_NATIVE, SECCOMP_ARCH_NATIVE); =20 DEFINE(ALT_INSTR_SIZE, sizeof(struct alt_instr)); +DEFINE(EXTABLE_SIZE, sizeof(struct exception_table_entry)); diff --git a/arch/x86/include/asm/asm.h b/arch/x86/include/asm/asm.h index bd62bd87a841..0e8c611bc9e2 100644 --- a/arch/x86/include/asm/asm.h +++ b/arch/x86/include/asm/asm.h @@ -126,18 +126,21 @@ static __always_inline __pure void *rip_rel_ptr(void = *p) =20 #ifdef __KERNEL__ =20 +#ifndef COMPILE_OFFSETS +#include +#endif + # include =20 /* Exception table entry */ #ifdef __ASSEMBLER__ =20 -# define _ASM_EXTABLE_TYPE(from, to, type) \ - .pushsection "__ex_table","a" ; \ - .balign 4 ; \ - ANNOTATE_DATA_SPECIAL ; \ - .long (from) - . ; \ - .long (to) - . ; \ - .long type ; \ +# define _ASM_EXTABLE_TYPE(from, to, type) \ + .pushsection "__ex_table", "aM", @progbits, EXTABLE_SIZE ; \ + .balign 4 ; \ + .long (from) - . ; \ + .long (to) - . ; \ + .long type ; \ .popsection =20 # ifdef CONFIG_KPROBES @@ -180,18 +183,18 @@ static __always_inline __pure void *rip_rel_ptr(void = *p) ".purgem extable_type_reg\n" =20 # define _ASM_EXTABLE_TYPE(from, to, type) \ - " .pushsection \"__ex_table\",\"a\"\n" \ + " .pushsection __ex_table, \"aM\", @progbits, " \ + __stringify(EXTABLE_SIZE) "\n" \ " .balign 4\n" \ - ANNOTATE_DATA_SPECIAL \ " .long (" #from ") - .\n" \ " .long (" #to ") - .\n" \ " .long " __stringify(type) " \n" \ " .popsection\n" =20 # define _ASM_EXTABLE_TYPE_REG(from, to, type, reg) \ - " .pushsection \"__ex_table\",\"a\"\n" \ + " .pushsection __ex_table, \"aM\", @progbits, " \ + __stringify(EXTABLE_SIZE) "\n" \ " .balign 4\n" \ - ANNOTATE_DATA_SPECIAL \ " .long (" #from ") - .\n" \ " .long (" #to ") - .\n" \ DEFINE_EXTABLE_TYPE_REG \ diff --git a/arch/x86/kernel/asm-offsets.c b/arch/x86/kernel/asm-offsets.c index db3bb5143329..25fcde525c68 100644 --- a/arch/x86/kernel/asm-offsets.c +++ b/arch/x86/kernel/asm-offsets.c @@ -126,4 +126,5 @@ static void __used common(void) =20 BLANK(); DEFINE(ALT_INSTR_SIZE, sizeof(struct alt_instr)); + DEFINE(EXTABLE_SIZE, sizeof(struct exception_table_entry)); } diff --git a/arch/x86/um/shared/sysdep/kernel-offsets.h b/arch/x86/um/share= d/sysdep/kernel-offsets.h index 6fd1ed400399..8215a0200ddd 100644 --- a/arch/x86/um/shared/sysdep/kernel-offsets.h +++ b/arch/x86/um/shared/sysdep/kernel-offsets.h @@ -1,4 +1,5 @@ /* SPDX-License-Identifier: GPL-2.0 */ +#define COMPILE_OFFSETS #include #include #include @@ -7,6 +8,7 @@ #include #include #include +#include =20 /* workaround for a warning with -Wmissing-prototypes */ void foo(void); diff --git a/kernel/bounds.c b/kernel/bounds.c index 29b2cd00df2c..02b619eb6106 100644 --- a/kernel/bounds.c +++ b/kernel/bounds.c @@ -6,6 +6,7 @@ */ =20 #define __GENERATING_BOUNDS_H +#define COMPILE_OFFSETS /* Include headers that define the enum constants of interest */ #include #include diff --git a/scripts/mod/devicetable-offsets.c b/scripts/mod/devicetable-of= fsets.c index d3d00e85edf7..ef2ffb68f69d 100644 --- a/scripts/mod/devicetable-offsets.c +++ b/scripts/mod/devicetable-offsets.c @@ -1,4 +1,5 @@ // SPDX-License-Identifier: GPL-2.0 +#define COMPILE_OFFSETS #include #include =20 --=20 2.51.1