]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
x86/asm: Remove ANNOTATE_DATA_SPECIAL usage
authorJosh Poimboeuf <jpoimboe@kernel.org>
Tue, 2 Dec 2025 17:59:37 +0000 (09:59 -0800)
committerIngo Molnar <mingo@kernel.org>
Wed, 3 Dec 2025 15:53:19 +0000 (16:53 +0100)
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 <jpoimboe@kernel.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Link: https://patch.msgid.link/b858cb7891c1ba0080e22a9c32595e6c302435e2.1764694625.git.jpoimboe@kernel.org
arch/um/include/asm/Kbuild
arch/um/include/shared/common-offsets.h
arch/x86/include/asm/asm.h
arch/x86/kernel/asm-offsets.c
arch/x86/um/shared/sysdep/kernel-offsets.h
kernel/bounds.c
scripts/mod/devicetable-offsets.c

index b6810db24ca4d3b38fdb8ebcebc0784cf688439b..1b9b82bbe3220adcd818505a56b3e3627e020143 100644 (file)
@@ -5,7 +5,6 @@ generic-y += device.h
 generic-y += dma-mapping.h
 generic-y += emergency-restart.h
 generic-y += exec.h
-generic-y += extable.h
 generic-y += ftrace.h
 generic-y += hw_irq.h
 generic-y += irq_regs.h
index 4e19103afd71a69f4cdab455051273f3f55dc2ee..a6f77cb6aa7e1286e8e872be76b21843acee5065 100644 (file)
@@ -20,3 +20,4 @@ DEFINE(UM_KERN_GDT_ENTRY_TLS_ENTRIES, GDT_ENTRY_TLS_ENTRIES);
 DEFINE(UM_SECCOMP_ARCH_NATIVE, SECCOMP_ARCH_NATIVE);
 
 DEFINE(ALT_INSTR_SIZE, sizeof(struct alt_instr));
+DEFINE(EXTABLE_SIZE,   sizeof(struct exception_table_entry));
index bd62bd87a841e33f1dc29b3d09108aa8009cb072..0e8c611bc9e2a1aa3c69dee65a935c38b56e88d5 100644 (file)
@@ -126,18 +126,21 @@ static __always_inline __pure void *rip_rel_ptr(void *p)
 
 #ifdef __KERNEL__
 
+#ifndef COMPILE_OFFSETS
+#include <asm/asm-offsets.h>
+#endif
+
 # include <asm/extable_fixup_types.h>
 
 /* Exception table entry */
 #ifdef __ASSEMBLER__
 
-# 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
 
 # ifdef CONFIG_KPROBES
@@ -180,18 +183,18 @@ static __always_inline __pure void *rip_rel_ptr(void *p)
        ".purgem extable_type_reg\n"
 
 # 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"
 
 # 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                                                 \
index db3bb514332944ec3726eac438050fd318a4da6f..25fcde525c68c2d7b313738c86ff734dd0bf0e6d 100644 (file)
@@ -126,4 +126,5 @@ static void __used common(void)
 
        BLANK();
        DEFINE(ALT_INSTR_SIZE,  sizeof(struct alt_instr));
+       DEFINE(EXTABLE_SIZE,    sizeof(struct exception_table_entry));
 }
index 6fd1ed400399211644cf3a1f7b82ac9ee460cba9..8215a0200ddd9868ad3246c9749a87cae1579c55 100644 (file)
@@ -1,4 +1,5 @@
 /* SPDX-License-Identifier: GPL-2.0 */
+#define COMPILE_OFFSETS
 #include <linux/stddef.h>
 #include <linux/sched.h>
 #include <linux/elf.h>
@@ -7,6 +8,7 @@
 #include <linux/audit.h>
 #include <asm/mman.h>
 #include <asm/seccomp.h>
+#include <asm/extable.h>
 
 /* workaround for a warning with -Wmissing-prototypes */
 void foo(void);
index 29b2cd00df2ccf2b991b9b78f4514b76c87ee354..02b619eb61065674a8b07222204569dd9d7cbd29 100644 (file)
@@ -6,6 +6,7 @@
  */
 
 #define __GENERATING_BOUNDS_H
+#define COMPILE_OFFSETS
 /* Include headers that define the enum constants of interest */
 #include <linux/page-flags.h>
 #include <linux/mmzone.h>
index d3d00e85edf73553ba3d9b5f9fccf1ff61c99026..ef2ffb68f69d1d8be019d35446c6909cf65a5f44 100644 (file)
@@ -1,4 +1,5 @@
 // SPDX-License-Identifier: GPL-2.0
+#define COMPILE_OFFSETS
 #include <linux/kbuild.h>
 #include <linux/mod_devicetable.h>