objtool: reduce memory usage of struct reloc
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 8 lines · Thomas Weißschuh
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_64from 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;
}