@@ -18,7 +18,8 @@
#define SYMBOL_LIMIT (1 << 12) /* 4K */
-void arch__symbols__fixup_end(struct symbol *p, struct symbol *c)
+void arch__symbols__fixup_end(struct symbol *p, struct symbol *c,
+ bool is_kernel __maybe_unused)
{
if (p->end == p->start || p->end != c->start) {
if ((strchr(p->name, '[') && strchr(c->name, '[') == NULL) ||
@@ -14,7 +14,9 @@
* Therefore do not fill this gap and do not assign it to the kernel dso map.
*/
-void arch__symbols__fixup_end(struct symbol *p, struct symbol *c)
+void arch__symbols__fixup_end(struct symbol *p, struct symbol *c,
+ bool is_kernel __maybe_unused)
+)
{
if (p->end == p->start || p->end != c->start) {
if (strchr(p->name, '[') == NULL && strchr(c->name, '['))
@@ -42,7 +42,8 @@ int arch__fix_module_text_start(u64 *start, u64 *size, const char *name)
* and beginning of first module's text segment is very big.
* Therefore do not fill this gap and do not assign it to the kernel dso map.
*/
-void arch__symbols__fixup_end(struct symbol *p, struct symbol *c)
+void arch__symbols__fixup_end(struct symbol *p, struct symbol *c,
+ bool is_kernel __maybe_unused)
{
if (p->end == p->start || p->end != c->start) {
if (strchr(p->name, '[') == NULL && strchr(c->name, '['))
@@ -1290,7 +1290,7 @@ dso__load_sym_internal(struct dso *dso, struct map *map, struct symsrc *syms_ss,
* For misannotated, zeroed, ASM function sizes.
*/
if (nr > 0) {
- symbols__fixup_end(&dso->symbols);
+ symbols__fixup_end(&dso->symbols, dso->kernel != DSO_SPACE__USER);
symbols__fixup_duplicate(&dso->symbols);
if (kmap) {
/*
@@ -101,7 +101,8 @@ static int prefix_underscores_count(const char *str)
return tail - str;
}
-void __weak arch__symbols__fixup_end(struct symbol *p, struct symbol *c)
+void __weak arch__symbols__fixup_end(struct symbol *p, struct symbol *c,
+ bool is_kernel __maybe_unused)
{
if (p->end == p->start || p->end != c->start)
p->end = c->start;
@@ -218,7 +219,7 @@ void symbols__fixup_duplicate(struct rb_root_cached *symbols)
}
}
-void symbols__fixup_end(struct rb_root_cached *symbols)
+void symbols__fixup_end(struct rb_root_cached *symbols, bool is_kernel)
{
struct rb_node *nd, *prevnd = rb_first_cached(symbols);
struct symbol *curr, *prev;
@@ -232,7 +233,7 @@ void symbols__fixup_end(struct rb_root_cached *symbols)
prev = curr;
curr = rb_entry(nd, struct symbol, rb_node);
- arch__symbols__fixup_end(prev, curr);
+ arch__symbols__fixup_end(prev, curr, is_kernel);
}
/* Last entry */
@@ -1467,7 +1468,7 @@ int __dso__load_kallsyms(struct dso *dso, const char *filename,
if (kallsyms__delta(kmap, filename, &delta))
return -1;
- symbols__fixup_end(&dso->symbols);
+ symbols__fixup_end(&dso->symbols, /*is_kernel=*/true);
symbols__fixup_duplicate(&dso->symbols);
if (dso->kernel == DSO_SPACE__KERNEL_GUEST)
@@ -203,7 +203,7 @@ void __symbols__insert(struct rb_root_cached *symbols, struct symbol *sym,
bool kernel);
void symbols__insert(struct rb_root_cached *symbols, struct symbol *sym);
void symbols__fixup_duplicate(struct rb_root_cached *symbols);
-void symbols__fixup_end(struct rb_root_cached *symbols);
+void symbols__fixup_end(struct rb_root_cached *symbols, bool is_kernel);
void maps__fixup_end(struct maps *maps);
typedef int (*mapfn_t)(u64 start, u64 len, u64 pgoff, void *data);
@@ -241,7 +241,7 @@ const char *arch__normalize_symbol_name(const char *name);
#define SYMBOL_A 0
#define SYMBOL_B 1
-void arch__symbols__fixup_end(struct symbol *p, struct symbol *c);
+void arch__symbols__fixup_end(struct symbol *p, struct symbol *c, bool is_kernel);
int arch__compare_symbol_names(const char *namea, const char *nameb);
int arch__compare_symbol_names_n(const char *namea, const char *nameb,
unsigned int n);
Kernel fixups may be special so add a flag to quickly detect if they are necessary. Signed-off-by: Ian Rogers <irogers@google.com> --- tools/perf/arch/arm64/util/machine.c | 3 ++- tools/perf/arch/powerpc/util/machine.c | 4 +++- tools/perf/arch/s390/util/machine.c | 3 ++- tools/perf/util/symbol-elf.c | 2 +- tools/perf/util/symbol.c | 9 +++++---- tools/perf/util/symbol.h | 4 ++-- 6 files changed, 15 insertions(+), 10 deletions(-)