lkml.org 
[lkml]   [2022]   [Dec]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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;
}

\
 
 \ /
  Last update: 2022-12-19 11:53    [W:0.268 / U:0.040 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site