summaryrefslogtreecommitdiffstats
path: root/tools/objtool/elf.h
diff options
context:
space:
mode:
authorPeter Zijlstra <peterz@infradead.org>2020-03-12 14:29:38 +0100
committerIngo Molnar <mingo@kernel.org>2020-04-22 10:53:50 +0200
commit34f7c96d96d5e11b03a612017fcc3a6e645bb481 (patch)
treed195501e9422a163be083b1a65da155581317cb0 /tools/objtool/elf.h
parentc4a33939a7eb396acbb05569e57eebe4374cc57c (diff)
downloadlinux-stable-34f7c96d96d5e11b03a612017fcc3a6e645bb481.tar.gz
linux-stable-34f7c96d96d5e11b03a612017fcc3a6e645bb481.tar.bz2
linux-stable-34f7c96d96d5e11b03a612017fcc3a6e645bb481.zip
objtool: Optimize !vmlinux.o again
When doing kbuild tests to see if the objtool changes affected those I found that there was a measurable regression: pre post real 1m13.594 1m16.488s user 34m58.246s 35m23.947s sys 4m0.393s 4m27.312s Perf showed that for small files the increased hash-table sizes were a measurable difference. Since we already have -l "vmlinux" to distinguish between the modes, make it also use a smaller portion of the hash-tables. This flips it into a small win: real 1m14.143s user 34m49.292s sys 3m44.746s Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Reviewed-by: Miroslav Benes <mbenes@suse.cz> Reviewed-by: Alexandre Chartre <alexandre.chartre@oracle.com> Acked-by: Josh Poimboeuf <jpoimboe@redhat.com> Link: https://lkml.kernel.org/r/20200416115119.167588731@infradead.org Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'tools/objtool/elf.h')
-rw-r--r--tools/objtool/elf.h13
1 files changed, 8 insertions, 5 deletions
diff --git a/tools/objtool/elf.h b/tools/objtool/elf.h
index eb79cb999209..2811d04346c9 100644
--- a/tools/objtool/elf.h
+++ b/tools/objtool/elf.h
@@ -70,17 +70,19 @@ struct rela {
bool jump_table_start;
};
+#define ELF_HASH_BITS 20
+
struct elf {
Elf *elf;
GElf_Ehdr ehdr;
int fd;
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);
- DECLARE_HASHTABLE(rela_hash, 20);
+ DECLARE_HASHTABLE(symbol_hash, ELF_HASH_BITS);
+ DECLARE_HASHTABLE(symbol_name_hash, ELF_HASH_BITS);
+ DECLARE_HASHTABLE(section_hash, ELF_HASH_BITS);
+ DECLARE_HASHTABLE(section_name_hash, ELF_HASH_BITS);
+ DECLARE_HASHTABLE(rela_hash, ELF_HASH_BITS);
};
#define OFFSET_STRIDE_BITS 4
@@ -127,6 +129,7 @@ struct section *elf_create_rela_section(struct elf *elf, struct section *base);
int elf_rebuild_rela_section(struct section *sec);
int elf_write(struct elf *elf);
void elf_close(struct elf *elf);
+void elf_add_rela(struct elf *elf, struct rela *rela);
#define for_each_sec(file, sec) \
list_for_each_entry(sec, &file->elf->sections, list)