Re: [PATCH v2 5/8] objtool: reduce memory usage of struct reloc
From: Thomas Weißschuh
Date: Thu Dec 29 2022 - 00:58:28 EST
Hi Rong,
On Thu, Dec 29, 2022 at 11:29:07AM +0800, Rong Tao wrote:
> Hi, Thomas:
>
> In /usr/include/elf.h has:
>
> #define ELF32_R_TYPE(val) ((val) & 0xff)
> #define ELF64_R_TYPE(i) ((i) & 0xffffffff)
> ^^^^^^^^^^
>
> So, I still feel that keeping 'unsigned int' is a good option. Can we just
> use __attribute__((packed)) for wasted padding bytes?
As the struct contains addresses, packing it will create a ton of
compiler warnings and will be much more likely to break than reducing
the width of 'type'.
Given that reducing the width of 'type'
* is currently absolutely safe,
* is unlikely to break in the future, as the elf designers seem to be
actively trying to stay within this range anyways,
* saves 8 bytes from a very heavily allocated struct, having a
measurable impact on the build process,
I continue to propose this aproach.
Let's let the maintainers decide.
Thomas