aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/tools/objtool/include
diff options
context:
space:
mode:
authorJosh Poimboeuf <jpoimboe@kernel.org>2023-05-30 10:21:06 -0700
committerJosh Poimboeuf <jpoimboe@kernel.org>2023-06-07 10:03:21 -0700
commite4cbb9b81f1f7519c7ae3abda09cb15794022952 (patch)
treeb70dff6bc5c62979ac59ecaf4b5f87ca36ad6821 /tools/objtool/include
parentobjtool: Get rid of reloc->idx (diff)
downloadwireguard-linux-e4cbb9b81f1f7519c7ae3abda09cb15794022952.tar.xz
wireguard-linux-e4cbb9b81f1f7519c7ae3abda09cb15794022952.zip
objtool: Get rid of reloc->offset
Get the offset from the embedded GElf_Rel[a] struct. With allyesconfig + CONFIG_DEBUG_INFO: - Before: peak heap memory consumption: 43.83G - After: peak heap memory consumption: 42.10G Link: https://lore.kernel.org/r/2b9ec01178baa346a99522710bf2e82159412e3a.1685464332.git.jpoimboe@kernel.org Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
Diffstat (limited to 'tools/objtool/include')
-rw-r--r--tools/objtool/include/objtool/elf.h8
1 files changed, 6 insertions, 2 deletions
diff --git a/tools/objtool/include/objtool/elf.h b/tools/objtool/include/objtool/elf.h
index 2a14da633d56..2070860a099e 100644
--- a/tools/objtool/include/objtool/elf.h
+++ b/tools/objtool/include/objtool/elf.h
@@ -75,7 +75,6 @@ struct reloc {
struct section *sec;
struct symbol *sym;
struct list_head sym_reloc_entry;
- unsigned long offset;
s64 addend;
unsigned int type;
bool jump_table_start;
@@ -204,6 +203,11 @@ static inline unsigned int reloc_idx(struct reloc *reloc)
return reloc - reloc->sec->relocs;
}
+static inline unsigned long reloc_offset(struct reloc *reloc)
+{
+ return reloc->rel.r_offset;
+}
+
#define for_each_sec(file, sec) \
list_for_each_entry(sec, &file->elf->sections, list)
@@ -253,7 +257,7 @@ static inline u32 sec_offset_hash(struct section *sec, unsigned long offset)
static inline u32 reloc_hash(struct reloc *reloc)
{
- return sec_offset_hash(reloc->sec, reloc->offset);
+ return sec_offset_hash(reloc->sec, reloc_offset(reloc));
}
#endif /* _OBJTOOL_ELF_H */