Skip to content

Commit 21a899f

Browse files
t-8chjpoimboe
authored andcommitted
objtool: Optimize layout of struct symbol
Reduce the size of struct symbol on x86_64 from 208 to 200 bytes. This structure is allocated a lot and never freed. This reduces maximum memory usage while processing vmlinux.o from 2919716 KB to 2917988 KB (-0.5%) on my notebooks "localmodconfig". Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> Link: https://lore.kernel.org/r/20221216-objtool-memory-v2-6-17968f85a464@weissschuh.net Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
1 parent 8045b8f commit 21a899f

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

  • tools/objtool/include/objtool

tools/objtool/include/objtool/elf.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,11 @@ struct symbol {
5050
GElf_Sym sym;
5151
struct section *sec;
5252
char *name;
53-
unsigned int idx;
54-
unsigned char bind, type;
53+
unsigned int idx, len;
5554
unsigned long offset;
56-
unsigned int len;
5755
unsigned long __subtree_last;
5856
struct symbol *pfunc, *cfunc, *alias;
57+
unsigned char bind, type;
5958
u8 uaccess_safe : 1;
6059
u8 static_call_tramp : 1;
6160
u8 retpoline_thunk : 1;

0 commit comments

Comments
 (0)