RFC: Rearranging the layout of the _symbol_info and bfd_section structures

Nick Clifton nickc@redhat.com
Fri Mar 27 10:39:06 GMT 2026


Hi Guys,

  I am planning on applying the attached patch to close a couple of gaps
  in two of the structures used internally in the BFD library.  This
  reduces the size of the structures, which reduces the linker's overall
  memory requirements.  Not by a lot, but every bit helps.
  
  The first change is quite straightforward.  The _symbol_info structure
  has a 'char type' field sandwiched between several larger fields when
  it could quite happily use up some of the padding at the end of the
  structure.

  The second change is slightly more involved.  It moves all of the bit
  fields in the bfd_section structure to the end, and then also moves
  the target_index field to just before the bitfields.  This makes for a
  more efficient packing of the structure, saving 8 bytes on a 64-bit
  host.

  The is an issue however in that there is also a macro defined to
  initialise static sections (BFD_FAKE_SECTIONS) which expects a
  specific layout for the bfd_section structure.  Rather than fixing the
  macro to respect the new layout I decided instead to make use of the
  designated initialisers feature of C.  This I believe makes the macro
  more robust.

  Plus since I was changing BFD_FAKE_SECTIONS it seemed sensible to make
  a similar change to the GLOBAL_SYM_INIT macro which does a similar
  thing for static symbol declarations.

  Any thoughts or concerns ?

Cheers
  Nick

-------------- next part --------------
A non-text attachment was scrubbed...
Name: ld.gap-filling.patch
Type: text/x-patch
Size: 17602 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20260327/e28a9a54/attachment-0001.bin>


More information about the Binutils mailing list