[PATCH 10/10][HACK] objtool: Shrink reloc

Peter Zijlstra posted 10 patches 2 years, 7 months ago
[PATCH 10/10][HACK] objtool: Shrink reloc
Posted by Peter Zijlstra 2 years, 7 months ago
Glorious hack, do not merge. Good for another ~850M of allyesconfig
savings.

Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
---
 tools/objtool/include/objtool/elf.h |   12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

--- a/tools/objtool/include/objtool/elf.h
+++ b/tools/objtool/include/objtool/elf.h
@@ -71,17 +71,23 @@ struct reloc {
 	union {
 		GElf_Rela rela;
 		GElf_Rel  rel;
+		struct {
+			u64 offset;
+			u64 __bar;
+			s64 addend;
+		};
 	};
 	struct section *sec;
 	struct symbol *sym;
 	struct list_head sym_reloc_entry;
-	unsigned long offset;
-	unsigned int type;
-	s64 addend;
 	int idx;
+	unsigned short type;
 	bool jump_table_start;
 };
 
+static_assert(offsetof(struct reloc, rela.r_offset) == offsetof(struct reloc, offset));
+static_assert(offsetof(struct reloc, rela.r_addend) == offsetof(struct reloc, addend));
+
 #define ELF_HASH_BITS	20
 
 struct elf {