Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

x86/asm: Remove ANNOTATE_DATA_SPECIAL usage

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

authored by

Josh Poimboeuf and committed by
Ingo Molnar
f387d0e1 a818f28f

+20 -12
-1
arch/um/include/asm/Kbuild
··· 5 5 generic-y += dma-mapping.h 6 6 generic-y += emergency-restart.h 7 7 generic-y += exec.h 8 - generic-y += extable.h 9 8 generic-y += ftrace.h 10 9 generic-y += hw_irq.h 11 10 generic-y += irq_regs.h
+1
arch/um/include/shared/common-offsets.h
··· 20 20 DEFINE(UM_SECCOMP_ARCH_NATIVE, SECCOMP_ARCH_NATIVE); 21 21 22 22 DEFINE(ALT_INSTR_SIZE, sizeof(struct alt_instr)); 23 + DEFINE(EXTABLE_SIZE, sizeof(struct exception_table_entry));
+14 -11
arch/x86/include/asm/asm.h
··· 126 126 127 127 #ifdef __KERNEL__ 128 128 129 + #ifndef COMPILE_OFFSETS 130 + #include <asm/asm-offsets.h> 131 + #endif 132 + 129 133 # include <asm/extable_fixup_types.h> 130 134 131 135 /* Exception table entry */ 132 136 #ifdef __ASSEMBLER__ 133 137 134 - # define _ASM_EXTABLE_TYPE(from, to, type) \ 135 - .pushsection "__ex_table","a" ; \ 136 - .balign 4 ; \ 137 - ANNOTATE_DATA_SPECIAL ; \ 138 - .long (from) - . ; \ 139 - .long (to) - . ; \ 140 - .long type ; \ 138 + # define _ASM_EXTABLE_TYPE(from, to, type) \ 139 + .pushsection "__ex_table", "aM", @progbits, EXTABLE_SIZE ; \ 140 + .balign 4 ; \ 141 + .long (from) - . ; \ 142 + .long (to) - . ; \ 143 + .long type ; \ 141 144 .popsection 142 145 143 146 # ifdef CONFIG_KPROBES ··· 183 180 ".purgem extable_type_reg\n" 184 181 185 182 # define _ASM_EXTABLE_TYPE(from, to, type) \ 186 - " .pushsection \"__ex_table\",\"a\"\n" \ 183 + " .pushsection __ex_table, \"aM\", @progbits, " \ 184 + __stringify(EXTABLE_SIZE) "\n" \ 187 185 " .balign 4\n" \ 188 - ANNOTATE_DATA_SPECIAL \ 189 186 " .long (" #from ") - .\n" \ 190 187 " .long (" #to ") - .\n" \ 191 188 " .long " __stringify(type) " \n" \ 192 189 " .popsection\n" 193 190 194 191 # define _ASM_EXTABLE_TYPE_REG(from, to, type, reg) \ 195 - " .pushsection \"__ex_table\",\"a\"\n" \ 192 + " .pushsection __ex_table, \"aM\", @progbits, " \ 193 + __stringify(EXTABLE_SIZE) "\n" \ 196 194 " .balign 4\n" \ 197 - ANNOTATE_DATA_SPECIAL \ 198 195 " .long (" #from ") - .\n" \ 199 196 " .long (" #to ") - .\n" \ 200 197 DEFINE_EXTABLE_TYPE_REG \
+1
arch/x86/kernel/asm-offsets.c
··· 126 126 127 127 BLANK(); 128 128 DEFINE(ALT_INSTR_SIZE, sizeof(struct alt_instr)); 129 + DEFINE(EXTABLE_SIZE, sizeof(struct exception_table_entry)); 129 130 }
+2
arch/x86/um/shared/sysdep/kernel-offsets.h
··· 1 1 /* SPDX-License-Identifier: GPL-2.0 */ 2 + #define COMPILE_OFFSETS 2 3 #include <linux/stddef.h> 3 4 #include <linux/sched.h> 4 5 #include <linux/elf.h> ··· 8 7 #include <linux/audit.h> 9 8 #include <asm/mman.h> 10 9 #include <asm/seccomp.h> 10 + #include <asm/extable.h> 11 11 12 12 /* workaround for a warning with -Wmissing-prototypes */ 13 13 void foo(void);
+1
kernel/bounds.c
··· 6 6 */ 7 7 8 8 #define __GENERATING_BOUNDS_H 9 + #define COMPILE_OFFSETS 9 10 /* Include headers that define the enum constants of interest */ 10 11 #include <linux/page-flags.h> 11 12 #include <linux/mmzone.h>
+1
scripts/mod/devicetable-offsets.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0 2 + #define COMPILE_OFFSETS 2 3 #include <linux/kbuild.h> 3 4 #include <linux/mod_devicetable.h> 4 5