[PATCH v1 10/23] perf dwarf-regs: Remove get_arch_regnum

Ian Rogers
2026-01-17T05:29:38Z

Except in dwarf-regs the function is never called. The weak function
has no strong arch implementations. Remove so that the fall-through
case applies.

Signed-off-by: Ian Rogers <irogers@google.com>
---
tools/perf/util/dwarf-regs.c | 12 ------------
tools/perf/util/include/dwarf-regs.h | 4 ----
2 files changed, 16 deletions(-)

diff --git a/tools/perf/util/dwarf-regs.c b/tools/perf/util/dwarf-regs.c
index 28a1cfdf26d4..b2f37299147e 100644
--- a/tools/perf/util/dwarf-regs.c
+++ b/tools/perf/util/dwarf-regs.c
@@ -71,13 +71,6 @@ const char *get_dwarf_regstr(unsigned int n, unsigned int machine, unsigned int
return NULL;
}

-#if EM_HOST != EM_X86_64 && EM_HOST != EM_386
-__weak int get_arch_regnum(const char *name __maybe_unused)
-{
- return -ENOTSUP;
-}
-#endif
-
/* Return DWARF register number from architecture register name */
int get_dwarf_regnum(const char *name, unsigned int machine, unsigned int flags __maybe_unused)
{
@@ -98,11 +91,6 @@ int get_dwarf_regnum(const char *name, unsigned int machine, unsigned int flags
machine = EM_HOST;
}
switch (machine) {
-#if EM_HOST != EM_X86_64 && EM_HOST != EM_386
- case EM_HOST:
- reg = get_arch_regnum(regname);
- break;
-#endif
case EM_X86_64:
fallthrough;
case EM_386:
diff --git a/tools/perf/util/include/dwarf-regs.h b/tools/perf/util/include/dwarf-regs.h
index 6f1b9f6b2466..015d1ade645f 100644
--- a/tools/perf/util/include/dwarf-regs.h
+++ b/tools/perf/util/include/dwarf-regs.h
@@ -101,10 +101,6 @@ const char *get_dwarf_regstr(unsigned int n, unsigned int machine, unsigned int

int get_x86_regnum(const char *name);

-#if !defined(__x86_64__) && !defined(__i386__)
-int get_arch_regnum(const char *name);
-#endif
-
/*
* get_dwarf_regnum - Returns DWARF regnum from register name
* name: architecture register name
--
2.52.0.457.g6b5491de43-goog