[tip: objtool/core] objtool/klp: Remove .llvm suffix in demangle_name()

From: tip-bot2 for Song Liu

Date: Mon Mar 09 2026 - 16:00:30 EST


The following commit has been merged into the objtool/core branch of tip:

Commit-ID: 020b71dcafeeececb78d9ee9e5a2e68e8e05e922
Gitweb: https://git.kernel.org/tip/020b71dcafeeececb78d9ee9e5a2e68e8e05e922
Author: Song Liu <song@xxxxxxxxxx>
AuthorDate: Thu, 05 Mar 2026 15:15:29 -08:00
Committer: Josh Poimboeuf <jpoimboe@xxxxxxxxxx>
CommitterDate: Fri, 06 Mar 2026 08:08:33 -08:00

objtool/klp: Remove .llvm suffix in demangle_name()

Remove .llvm suffix, so that we can correlate foo.llvm.<hash 1> and
foo.llvm.<hash 2>.

Signed-off-by: Song Liu <song@xxxxxxxxxx>
Link: https://patch.msgid.link/20260305231531.3847295-6-song@xxxxxxxxxx
Signed-off-by: Josh Poimboeuf <jpoimboe@xxxxxxxxxx>
---
tools/objtool/elf.c | 8 ++++++++
1 file changed, 8 insertions(+)

diff --git a/tools/objtool/elf.c b/tools/objtool/elf.c
index 7e019f1..feaec45 100644
--- a/tools/objtool/elf.c
+++ b/tools/objtool/elf.c
@@ -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)
{