diff options
author | Josh Poimboeuf <jpoimboe@kernel.org> | 2023-05-30 20:21:05 +0300 |
---|---|---|
committer | Josh Poimboeuf <jpoimboe@kernel.org> | 2023-06-07 20:03:21 +0300 |
commit | be9a4c116824c39720001db5bc45fe7528b26cff (patch) | |
tree | baceb62de9286ebccbf559a181020ab002ab5cdf /tools/objtool/elf.c | |
parent | ebcef730a19ba7ca446169f391d2e51722d68043 (diff) | |
download | linux-be9a4c116824c39720001db5bc45fe7528b26cff.tar.xz |
objtool: Get rid of reloc->idx
Use the array offset to calculate the reloc index.
With allyesconfig + CONFIG_DEBUG_INFO:
- Before: peak heap memory consumption: 45.56G
- After: peak heap memory consumption: 43.83G
Link: https://lore.kernel.org/r/7351d2ebad0519027db14a32f6204af84952574a.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 | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/tools/objtool/elf.c b/tools/objtool/elf.c index 19ac53ad76ee..70c801254566 100644 --- a/tools/objtool/elf.c +++ b/tools/objtool/elf.c @@ -829,7 +829,6 @@ static struct reloc *elf_init_reloc(struct elf *elf, struct section *rsec, return NULL; } - reloc->idx = reloc_idx; reloc->sec = rsec; reloc->offset = offset; reloc->type = type; @@ -954,7 +953,6 @@ static int read_relocs(struct elf *elf) return -1; reloc->sec = rsec; - reloc->idx = i; symndx = GELF_R_SYM(reloc->rel.r_info); reloc->sym = sym = find_symbol_by_index(elf, symndx); if (!reloc->sym) { @@ -1237,9 +1235,9 @@ int elf_write_reloc(struct elf *elf, struct reloc *reloc) if (rsec->sh.sh_type == SHT_RELA) { reloc->rela.r_addend = reloc->addend; - ret = gelf_update_rela(rsec->data, reloc->idx, &reloc->rela); + ret = gelf_update_rela(rsec->data, reloc_idx(reloc), &reloc->rela); } else { - ret = gelf_update_rel(rsec->data, reloc->idx, &reloc->rel); + ret = gelf_update_rel(rsec->data, reloc_idx(reloc), &reloc->rel); } if (!ret) { |