diff options
author | Josh Poimboeuf <jpoimboe@kernel.org> | 2023-05-30 10:21:07 -0700 |
---|---|---|
committer | Josh Poimboeuf <jpoimboe@kernel.org> | 2023-06-07 10:03:22 -0700 |
commit | fcee899d2794319c9dbeb7b877b0c4ac92f5dd16 (patch) | |
tree | d5878b621427d0613909257645ded8d0d4efc6f0 /tools/objtool/elf.c | |
parent | e4cbb9b81f1f7519c7ae3abda09cb15794022952 (diff) |
objtool: Get rid of reloc->type
Get the type from the embedded GElf_Rel[a] struct.
Link: https://lore.kernel.org/r/d1c1f8da31e4f052a2478aea585fcf355cacc53a.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 2b45460225d1..be9d24dcdf56 100644 --- a/tools/objtool/elf.c +++ b/tools/objtool/elf.c @@ -541,6 +541,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) { + reloc->rel.r_info = GELF_R_INFO(reloc->sym->idx, reloc_type(reloc)); if (elf_write_reloc(elf, reloc)) return -1; } @@ -831,11 +832,11 @@ static struct reloc *elf_init_reloc(struct elf *elf, struct section *rsec, } reloc->sec = rsec; - reloc->type = type; reloc->sym = sym; reloc->addend = addend; reloc->rel.r_offset = offset; + reloc->rel.r_info = GELF_R_INFO(sym->idx, type); if (elf_write_reloc(elf, reloc)) return NULL; @@ -910,7 +911,6 @@ static int read_reloc(struct section *rsec, int i, struct reloc *reloc) return -1; } - reloc->type = GELF_R_TYPE(reloc->rel.r_info); reloc->addend = rela ? reloc->rela.r_addend : 0; return 0; @@ -1231,8 +1231,6 @@ int elf_write_reloc(struct elf *elf, struct reloc *reloc) struct section *rsec = reloc->sec; int ret; - reloc->rel.r_info = GELF_R_INFO(reloc->sym->idx, reloc->type); - if (rsec->sh.sh_type == SHT_RELA) { reloc->rela.r_addend = reloc->addend; ret = gelf_update_rela(rsec->data, reloc_idx(reloc), &reloc->rela); |