summaryrefslogtreecommitdiffstats
path: root/tools/objtool/elf.h
diff options
context:
space:
mode:
authorPeter Zijlstra <peterz@infradead.org>2020-03-12 10:17:38 +0100
committerPeter Zijlstra <peterz@infradead.org>2020-03-25 18:28:30 +0100
commitcdb3d057a17d56363a831e486ea39e4c389a6cf9 (patch)
tree87c68d4378ff885e3efaba3cbad947f100c1c071 /tools/objtool/elf.h
parent513b5ca6b5fbeb766999fb1a4bc9a55c9fb7c9ca (diff)
objtool: Optimize find_symbol_by_name()
Perf showed that find_symbol_by_name() takes time; add a symbol name hash. This shaves another second off of objtool on vmlinux.o runtime, down to 15 seconds. Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Reviewed-by: Miroslav Benes <mbenes@suse.cz> Acked-by: Josh Poimboeuf <jpoimboe@redhat.com> Link: https://lkml.kernel.org/r/20200324160924.676865656@infradead.org
Diffstat (limited to 'tools/objtool/elf.h')
-rw-r--r--tools/objtool/elf.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/tools/objtool/elf.h b/tools/objtool/elf.h
index d18f466829b0..3088d925d640 100644
--- a/tools/objtool/elf.h
+++ b/tools/objtool/elf.h
@@ -47,6 +47,7 @@ struct symbol {
struct list_head list;
struct rb_node node;
struct hlist_node hash;
+ struct hlist_node name_hash;
GElf_Sym sym;
struct section *sec;
char *name;
@@ -77,6 +78,7 @@ struct elf {
char *name;
struct list_head sections;
DECLARE_HASHTABLE(symbol_hash, 20);
+ DECLARE_HASHTABLE(symbol_name_hash, 20);
DECLARE_HASHTABLE(section_hash, 16);
DECLARE_HASHTABLE(section_name_hash, 16);
};