]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
x86/alternative: Remove ANNOTATE_DATA_SPECIAL usage
authorJosh Poimboeuf <jpoimboe@kernel.org>
Tue, 2 Dec 2025 17:59:36 +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 .altinstructions 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/5ac04e6db5be6453dce8003a771ebb0c47b4cd7a.1764694625.git.jpoimboe@kernel.org
arch/um/include/shared/common-offsets.h
arch/x86/include/asm/alternative.h
arch/x86/kernel/asm-offsets.c

index 8ca66a1918c3a19ed10145b5525d03df650cd457..4e19103afd71a69f4cdab455051273f3f55dc2ee 100644 (file)
@@ -18,3 +18,5 @@ DEFINE(UM_NSEC_PER_USEC, NSEC_PER_USEC);
 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));
index b14c045679e16041e1dbb2dd2ff560224befc8cc..df2c8705e17b5a01be837e136cf27f5bfcadbe11 100644 (file)
@@ -197,8 +197,8 @@ static inline int alternatives_text_reserved(void *start, void *end)
        "773:\n"
 
 #define ALTINSTR_ENTRY(ft_flags)                                             \
-       ".pushsection .altinstructions,\"a\"\n"                               \
-       ANNOTATE_DATA_SPECIAL                                                 \
+       ".pushsection .altinstructions, \"aM\", @progbits, "                  \
+                     __stringify(ALT_INSTR_SIZE) "\n"                        \
        " .long 771b - .\n"                             /* label           */ \
        " .long 774f - .\n"                             /* new instruction */ \
        " .4byte " __stringify(ft_flags) "\n"           /* feature + flags */ \
@@ -339,7 +339,6 @@ void nop_func(void);
  * instruction. See apply_alternatives().
  */
 .macro altinstr_entry orig alt ft_flags orig_len alt_len
-       ANNOTATE_DATA_SPECIAL
        .long \orig - .
        .long \alt - .
        .4byte \ft_flags
@@ -363,7 +362,7 @@ void nop_func(void);
 741:                                                                   \
        .skip -(((744f-743f)-(741b-740b)) > 0) * ((744f-743f)-(741b-740b)),0x90 ;\
 742:                                                                   \
-       .pushsection .altinstructions,"a" ;                             \
+       .pushsection .altinstructions, "aM", @progbits, ALT_INSTR_SIZE ;\
        altinstr_entry 740b,743f,flag,742b-740b,744f-743f ;             \
        .popsection ;                                                   \
        .pushsection .altinstr_replacement,"ax" ;                       \
index 32ba599a51f888c01dcad0f96ecd19f277c5a731..db3bb514332944ec3726eac438050fd318a4da6f 100644 (file)
@@ -124,4 +124,6 @@ static void __used common(void)
        OFFSET(ARIA_CTX_rounds, aria_ctx, rounds);
 #endif
 
+       BLANK();
+       DEFINE(ALT_INSTR_SIZE,  sizeof(struct alt_instr));
 }