diff options
author | Josh Poimboeuf <jpoimboe@kernel.org> | 2023-05-30 20:21:10 +0300 |
---|---|---|
committer | Josh Poimboeuf <jpoimboe@kernel.org> | 2023-06-07 20:03:25 +0300 |
commit | 890f10a433f51f95eccaec13d46dde769ccc113b (patch) | |
tree | e432aa71f46e517b431b879548cee3926cc40b24 /tools/objtool/elf.c | |
parent | be2f0b1e12644c956a347d7fde93c2ffe9cdb1af (diff) | |
download | linux-890f10a433f51f95eccaec13d46dde769ccc113b.tar.xz |
objtool: Shrink reloc->sym_reloc_entry
Convert it to a singly-linked list.
With allyesconfig + CONFIG_DEBUG_INFO:
- Before: peak heap memory consumption: 38.64G
- After: peak heap memory consumption: 36.89G
Link: https://lore.kernel.org/r/a51f0a6f9bbf2494d5a3a449807307e78a940988.1685464332.git.jpoimboe@kernel.org
Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
Diffstat (limited to 'tools/objtool/elf.c')
-rw-r--r-- | tools/objtool/elf.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/tools/objtool/elf.c b/tools/objtool/elf.c index 16e019a1762c..4b0de0e56068 100644 --- a/tools/objtool/elf.c +++ b/tools/objtool/elf.c @@ -356,7 +356,6 @@ static void elf_add_symbol(struct elf *elf, struct symbol *sym) struct rb_node *pnode; struct symbol *iter; - INIT_LIST_HEAD(&sym->reloc_list); INIT_LIST_HEAD(&sym->pv_target); sym->alias = sym; @@ -540,7 +539,7 @@ static int elf_update_sym_relocs(struct elf *elf, struct symbol *sym) { struct reloc *reloc; - list_for_each_entry(reloc, &sym->reloc_list, sym_reloc_entry) { + for (reloc = sym->relocs; reloc; reloc = reloc->sym_next_reloc) { reloc->rel.r_info = GELF_R_INFO(reloc->sym->idx, reloc_type(reloc)); if (elf_write_reloc(elf, reloc)) return -1; @@ -841,8 +840,9 @@ static struct reloc *elf_init_reloc(struct elf *elf, struct section *rsec, if (elf_write_reloc(elf, reloc)) return NULL; - list_add_tail(&reloc->sym_reloc_entry, &sym->reloc_list); elf_hash_add(reloc, &reloc->hash, reloc_hash(reloc)); + reloc->sym_next_reloc = sym->relocs; + sym->relocs = reloc; return reloc; } @@ -960,8 +960,9 @@ static int read_relocs(struct elf *elf) return -1; } - list_add_tail(&reloc->sym_reloc_entry, &sym->reloc_list); elf_hash_add(reloc, &reloc->hash, reloc_hash(reloc)); + reloc->sym_next_reloc = sym->relocs; + sym->relocs = reloc; nr_reloc++; } |