]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
objtool/klp: Don't correlate __ADDRESSABLE() symbols
authorJosh Poimboeuf <jpoimboe@kernel.org>
Sat, 11 Apr 2026 19:23:07 +0000 (12:23 -0700)
committerJosh Poimboeuf <jpoimboe@kernel.org>
Tue, 5 May 2026 04:15:59 +0000 (21:15 -0700)
Symbols created by __ADDRESSABLE() are only used to convince the
toolchain not to optimize out the referenced symbol.

Reviewed-by: Miroslav Benes <mbenes@suse.cz>
Acked-by: Song Liu <song@kernel.org>
Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
tools/objtool/klp-diff.c

index cb26c1c92a74a278f9c6099b98013fd9f86289c7..36753eeba58c01e197a48f935bef52b354354944 100644 (file)
@@ -352,6 +352,15 @@ static bool is_special_section_aux(struct section *sec)
        return false;
 }
 
+/*
+ * Symbols created by ___ADDRESSABLE() are only used to convince the toolchain
+ * not to optimize out the referenced symbol.
+ */
+static bool is_addressable_sym(struct symbol *sym)
+{
+       return !strcmp(sym->sec->name, ".discard.addressable");
+}
+
 /*
  * These symbols should never be correlated, so their local patched versions
  * are used instead of linking to the originals.
@@ -365,6 +374,7 @@ static bool dont_correlate(struct symbol *sym)
               is_uncorrelated_static_local(sym) ||
               is_clang_tmp_label(sym) ||
               is_string_sec(sym->sec) ||
+              is_addressable_sym(sym) ||
               is_special_section(sym->sec) ||
               is_special_section_aux(sym->sec) ||
               strstarts(sym->name, "__initcall__");