From 65fb11a7f6aeae678043738d06248a4e21f4e4e4 Mon Sep 17 00:00:00 2001 From: Peter Zijlstra Date: Tue, 10 Mar 2020 18:39:45 +0100 Subject: objtool: Optimize find_symbol_by_index() The symbol index is object wide, not per section, so it makes no sense to have the symbol_hash be part of the section object. By moving it to the elf object we avoid the linear sections iteration. This reduces the runtime of objtool on vmlinux.o from over 3 hours (I gave up) to a few minutes. The defconfig vmlinux.o has around 20k sections. Signed-off-by: Peter Zijlstra (Intel) Reviewed-by: Miroslav Benes Acked-by: Josh Poimboeuf Link: https://lkml.kernel.org/r/20200324160924.261852348@infradead.org --- tools/objtool/elf.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'tools/objtool/elf.h') diff --git a/tools/objtool/elf.h b/tools/objtool/elf.h index a1963259b930..12229801b13f 100644 --- a/tools/objtool/elf.h +++ b/tools/objtool/elf.h @@ -27,7 +27,6 @@ struct section { struct list_head list; GElf_Shdr sh; struct list_head symbol_list; - DECLARE_HASHTABLE(symbol_hash, 8); struct list_head rela_list; DECLARE_HASHTABLE(rela_hash, 16); struct section *base, *rela; @@ -71,7 +70,7 @@ struct elf { int fd; char *name; struct list_head sections; - DECLARE_HASHTABLE(rela_hash, 16); + DECLARE_HASHTABLE(symbol_hash, 20); }; -- cgit v1.2.3