objtool: Optimize read_sections()
authorPeter Zijlstra <peterz@infradead.org>
Thu, 12 Mar 2020 10:23:36 +0000 (11:23 +0100)
committerPeter Zijlstra <peterz@infradead.org>
Wed, 25 Mar 2020 17:28:30 +0000 (18:28 +0100)
commit8b5fa6bc326bf02f293b5a39a8f5b3de816265d3
tree11121ed0c5015841e16a84207a1bf80a31f09dfb
parentcdb3d057a17d56363a831e486ea39e4c389a6cf9
objtool: Optimize read_sections()

Perf showed that __hash_init() is a significant portion of
read_sections(), so instead of doing a per section rela_hash, use an
elf-wide rela_hash.

Statistics show us there are about 1.1 million relas, so size it
accordingly.

This reduces the objtool on vmlinux.o runtime to a third, from 15 to 5
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.739153726@infradead.org
tools/objtool/check.c
tools/objtool/elf.c
tools/objtool/elf.h
tools/objtool/orc_gen.c
tools/objtool/special.c