objtool: Improve reloc hash size guestimate
authorPeter Zijlstra <peterz@infradead.org>
Fri, 11 Jun 2021 06:33:36 +0000 (08:33 +0200)
committerPeter Zijlstra <peterz@infradead.org>
Mon, 14 Jun 2021 12:05:36 +0000 (14:05 +0200)
commitd33b9035e14a35f6f2a5f067f0b156a93581811d
treec1ea88952eeffb4a3b2967108fe769e7369f7f36
parentc199f64ff93c48a45add92eee4456ffcabfc838e
objtool: Improve reloc hash size guestimate

Nathan reported that LLVM ThinLTO builds have a performance regression
with commit 25cf0d8aa2a3 ("objtool: Rewrite hashtable sizing"). Sami
was quick to note that this is due to their use of -ffunction-sections.

As a result the .text section is small and basing the number of relocs
off of that no longer works. Instead have read_sections() compute the
sum of all SHF_EXECINSTR sections and use that.

Fixes: 25cf0d8aa2a3 ("objtool: Rewrite hashtable sizing")
Reported-by: Nathan Chancellor <nathan@kernel.org>
Debugged-by: Sami Tolvanen <samitolvanen@google.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Tested-by: Nathan Chancellor <nathan@kernel.org>
Link: https://lkml.kernel.org/r/YMJpGLuGNsGtA5JJ@hirez.programming.kicks-ass.net
tools/objtool/elf.c
tools/objtool/include/objtool/elf.h