Skip to content

Commit e48a12e

Browse files
author
Ingo Molnar
committed
jump_labels: Mark __jump_label_transform() as __always_inlined to work around aggressive compiler un-inlining
In randconfig testing, certain UBSAN and CC Kconfig combinations with GCC 10.3.0: CONFIG_X86_32=y CONFIG_CC_OPTIMIZE_FOR_SIZE=y CONFIG_UBSAN=y # CONFIG_UBSAN_TRAP is not set # CONFIG_UBSAN_BOUNDS is not set CONFIG_UBSAN_SHIFT=y # CONFIG_UBSAN_DIV_ZERO is not set CONFIG_UBSAN_UNREACHABLE=y CONFIG_UBSAN_BOOL=y # CONFIG_UBSAN_ENUM is not set # CONFIG_UBSAN_ALIGNMENT is not set # CONFIG_UBSAN_SANITIZE_ALL is not set ... produce this build warning (and build error if CONFIG_SECTION_MISMATCH_WARN_ONLY=y is set): WARNING: modpost: vmlinux.o(.text+0x4c1cc): Section mismatch in reference from the function __jump_label_transform() to the function .init.text:text_poke_early() The function __jump_label_transform() references the function __init text_poke_early(). This is often because __jump_label_transform lacks a __init annotation or the annotation of text_poke_early is wrong. ERROR: modpost: Section mismatches detected. The problem is that __jump_label_transform() gets uninlined by GCC, despite there being only a single local scope user of the 'static inline' function. Mark the function __always_inline instead, to work around this compiler bug/artifact. Signed-off-by: Ingo Molnar <[email protected]>
1 parent 7fef2ed commit e48a12e

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

arch/x86/kernel/jump_label.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,10 @@ __jump_label_patch(struct jump_entry *entry, enum jump_label_type type)
7979
return (struct jump_label_patch){.code = code, .size = size};
8080
}
8181

82-
static inline void __jump_label_transform(struct jump_entry *entry,
83-
enum jump_label_type type,
84-
int init)
82+
static __always_inline void
83+
__jump_label_transform(struct jump_entry *entry,
84+
enum jump_label_type type,
85+
int init)
8586
{
8687
const struct jump_label_patch jlp = __jump_label_patch(entry, type);
8788

0 commit comments

Comments
 (0)