aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/tools/objtool/include
diff options
context:
space:
mode:
authorThomas Weißschuh <linux@weissschuh.net>2022-12-27 16:00:59 +0000
committerJosh Poimboeuf <jpoimboe@kernel.org>2023-02-01 09:15:23 -0800
commit8045b8f0b17edf375849f83c80dd05194850b6ed (patch)
tree24aa73268610f0191db29d47503f49490824edca /tools/objtool/include
parentobjtool: Make struct check_options static (diff)
downloadwireguard-linux-8045b8f0b17edf375849f83c80dd05194850b6ed.tar.xz
wireguard-linux-8045b8f0b17edf375849f83c80dd05194850b6ed.zip
objtool: Allocate multiple structures with calloc()
By using calloc() instead of malloc() in a loop, libc does not have to keep around bookkeeping information for each single structure. This reduces maximum memory usage while processing vmlinux.o from 3153325 KB to 3035668 KB (-3.7%) on my notebooks "localmodconfig". Note this introduces memory leaks, because some additional structs get added to the lists later after reading the symbols and sections from the original object. Luckily we don't really care about memory leaks in objtool. Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> Link: https://lore.kernel.org/r/20221216-objtool-memory-v2-3-17968f85a464@weissschuh.net Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
Diffstat (limited to 'tools/objtool/include')
-rw-r--r--tools/objtool/include/objtool/elf.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/tools/objtool/include/objtool/elf.h b/tools/objtool/include/objtool/elf.h
index bb60fd42b46f..1c90f0ac0d53 100644
--- a/tools/objtool/include/objtool/elf.h
+++ b/tools/objtool/include/objtool/elf.h
@@ -39,6 +39,7 @@ struct section {
char *name;
int idx;
bool changed, text, rodata, noinstr, init, truncate;
+ struct reloc *reloc_data;
};
struct symbol {
@@ -104,6 +105,9 @@ struct elf {
struct hlist_head *section_hash;
struct hlist_head *section_name_hash;
struct hlist_head *reloc_hash;
+
+ struct section *section_data;
+ struct symbol *symbol_data;
};
#define OFFSET_STRIDE_BITS 4