Messages in this thread | | | Date | Mon, 19 Dec 2022 11:52:03 +0100 | From | Peter Zijlstra <> | Subject | Re: [PATCH 4/7] objtool: reduce memory usage of struct reloc |
| |
On Sun, Dec 18, 2022 at 09:30:07PM +0000, Thomas Weißschuh wrote: > Use a smaller type for the relocation type and move it to a location in > the structure where it avoids wasted padding bytes. > > Technically ELF could use up to four bytes for the type. > But until now only types up to number 43 have been defined. > > Reduce the size of struct reloc on x86_64 from 120 to 112 bytes. > This structure is allocated a lot and never freed.
Please put in a assertion for this -- I can see this going sideways fast if we ever get this wrong.
static inline void reloc_set_type(struct reloc *reloc, int type) { if (type > (1U << (8*sizeof(reloc->type)))) WARN_ELF("reloc->type out of range");
reloc->type = type; }
| |