[10/10,HACK] objtool: Shrink reloc

Message ID 20230208172245.922980544@infradead.org
State New
Headers
Series objtool: Honey, I shrunk the instruction |

Commit Message

Peter Zijlstra Feb. 8, 2023, 5:18 p.m. UTC
  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(-)
  

Patch

--- 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 {