diff options
author | Josh Poimboeuf <jpoimboe@kernel.org> | 2023-05-30 20:21:08 +0300 |
---|---|---|
committer | Josh Poimboeuf <jpoimboe@kernel.org> | 2023-06-07 20:03:23 +0300 |
commit | 0696b6e314dbe4bd2f24d5e749469f57ea095a9f (patch) | |
tree | 8f14e562b2d87c27a829295ca14964f346316132 /tools/objtool/elf.c | |
parent | fcee899d2794319c9dbeb7b877b0c4ac92f5dd16 (diff) | |
download | linux-0696b6e314dbe4bd2f24d5e749469f57ea095a9f.tar.xz |
objtool: Get rid of reloc->addend
Get the addend from the embedded GElf_Rel[a] struct.
With allyesconfig + CONFIG_DEBUG_INFO:
- Before: peak heap memory consumption: 42.10G
- After: peak heap memory consumption: 40.37G
Link: https://lore.kernel.org/r/ad2354f95d9ddd86094e3f7687acfa0750657784.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 | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/tools/objtool/elf.c b/tools/objtool/elf.c index be9d24dcdf56..16e019a1762c 100644 --- a/tools/objtool/elf.c +++ b/tools/objtool/elf.c @@ -833,10 +833,10 @@ static struct reloc *elf_init_reloc(struct elf *elf, struct section *rsec, reloc->sec = rsec; reloc->sym = sym; - reloc->addend = addend; reloc->rel.r_offset = offset; reloc->rel.r_info = GELF_R_INFO(sym->idx, type); + reloc->rela.r_addend = addend; if (elf_write_reloc(elf, reloc)) return NULL; @@ -911,8 +911,6 @@ static int read_reloc(struct section *rsec, int i, struct reloc *reloc) return -1; } - reloc->addend = rela ? reloc->rela.r_addend : 0; - return 0; } @@ -1231,12 +1229,10 @@ int elf_write_reloc(struct elf *elf, struct reloc *reloc) struct section *rsec = reloc->sec; int ret; - if (rsec->sh.sh_type == SHT_RELA) { - reloc->rela.r_addend = reloc->addend; + if (rsec->sh.sh_type == SHT_RELA) ret = gelf_update_rela(rsec->data, reloc_idx(reloc), &reloc->rela); - } else { + else ret = gelf_update_rel(rsec->data, reloc_idx(reloc), &reloc->rel); - } if (!ret) { WARN_ELF("gelf_update_rela"); |