aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/tools/objtool/include
diff options
context:
space:
mode:
authorPeter Zijlstra <peterz@infradead.org>2022-11-02 22:31:19 +0100
committerPeter Zijlstra <peterz@infradead.org>2022-11-05 11:28:02 +0100
commit19526717f768bf2f89ca01bd2a595728ebe57540 (patch)
tree60198c6408870ad2725459b6a8fbe4b05e622721 /tools/objtool/include
parentx86/cfi: Add boot time hash randomization (diff)
downloadwireguard-linux-19526717f768bf2f89ca01bd2a595728ebe57540.tar.xz
wireguard-linux-19526717f768bf2f89ca01bd2a595728ebe57540.zip
objtool: Optimize elf_dirty_reloc_sym()
When moving a symbol in the symtab its index changes and any reloc referring that symtol-table-index will need to be rewritten too. In order to facilitate this, objtool simply marks the whole reloc section 'changed' which will cause the whole section to be re-generated. However, finding the relocs that use any given symbol is implemented rather crudely -- a fully iteration of all sections and their relocs. Given that some builds have over 20k sections (kallsyms etc..) iterating all that for *each* symbol moved takes a bit of time. Instead have each symbol keep a list of relocs that reference it. This *vastly* improves build times for certain configs. Reported-by: Borislav Petkov <bp@alien8.de> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Link: https://lkml.kernel.org/r/Y2LlRA7x+8UsE1xf@hirez.programming.kicks-ass.net
Diffstat (limited to 'tools/objtool/include')
-rw-r--r--tools/objtool/include/objtool/elf.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/tools/objtool/include/objtool/elf.h b/tools/objtool/include/objtool/elf.h
index b6974e3173aa..bca719b2104b 100644
--- a/tools/objtool/include/objtool/elf.h
+++ b/tools/objtool/include/objtool/elf.h
@@ -62,6 +62,7 @@ struct symbol {
u8 fentry : 1;
u8 profiling_func : 1;
struct list_head pv_target;
+ struct list_head reloc_list;
};
struct reloc {
@@ -73,6 +74,7 @@ struct reloc {
};
struct section *sec;
struct symbol *sym;
+ struct list_head sym_reloc_entry;
unsigned long offset;
unsigned int type;
s64 addend;