]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
objtool/klp: Remove .llvm suffix in demangle_name()
authorSong Liu <song@kernel.org>
Thu, 5 Mar 2026 23:15:29 +0000 (15:15 -0800)
committerJosh Poimboeuf <jpoimboe@kernel.org>
Fri, 6 Mar 2026 16:08:33 +0000 (08:08 -0800)
Remove .llvm suffix, so that we can correlate foo.llvm.<hash 1> and
foo.llvm.<hash 2>.

Signed-off-by: Song Liu <song@kernel.org>
Link: https://patch.msgid.link/20260305231531.3847295-6-song@kernel.org
Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
tools/objtool/elf.c

index 7e019f15aac59de1405483f76b0eeabd43611fa2..feaec45a14a01db392a1c9f7c9c6215a003d54e8 100644 (file)
@@ -455,6 +455,11 @@ static int read_sections(struct elf *elf)
 static ssize_t demangled_name_len(const char *name)
 {
        ssize_t idx;
+       const char *p;
+
+       p = strstr(name, ".llvm.");
+       if (p)
+               return p - name;
 
        if (!strstarts(name, "__UNIQUE_ID_") && !strchr(name, '.'))
                return strlen(name);
@@ -482,6 +487,9 @@ static ssize_t demangled_name_len(const char *name)
  *   __UNIQUE_ID_addressable___UNIQUE_ID_pci_invalid_bar_694_695
  *
  * to remove both trailing numbers, also remove trailing '_'.
+ *
+ * For symbols with llvm suffix, i.e., foo.llvm.<hash>, remove the
+ * .llvm.<hash> part.
  */
 static const char *demangle_name(struct symbol *sym)
 {