Commit f387d0e1 authored by Josh Poimboeuf's avatar Josh Poimboeuf Committed by Ingo Molnar
Browse files

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: default avatarJosh Poimboeuf <jpoimboe@kernel.org>
Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Link: https://patch.msgid.link/b858cb7891c1ba0080e22a9c32595e6c302435e2.1764694625.git.jpoimboe@kernel.org
parent a818f28f
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -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
+1 −0
Original line number Diff line number Diff line
@@ -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));
+14 −11
Original line number Diff line number Diff line
@@ -126,15 +126,18 @@ 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" ;				\
	.pushsection "__ex_table", "aM", @progbits, EXTABLE_SIZE ;	\
	.balign 4 ;							\
	ANNOTATE_DATA_SPECIAL ;					\
	.long (from) - . ;						\
	.long (to) - . ;						\
	.long type ;							\
@@ -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							\
+1 −0
Original line number Diff line number Diff line
@@ -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));
}
+2 −0
Original line number Diff line number Diff line
/* 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);
Loading