[PATCH 0/8] bfd: section merging for PE/COFF images

Jan Beulich jbeulich@suse.com
Mon Oct 13 09:03:50 GMT 2025
When linking (larger) ELF and PE images from more or less the same ELF object
files, a very noticeable difference is the (perhaps significantly) different
size of the resulting binaries. The bulk of this difference, especially when
Dwarf debug info is also present, can be attributed to the lack of section
merging. Section merging, while presently being possible to be requested only
by ELF objects, is itself an entirely object-format independent operation
though, and hence can be generalized accordingly. While in turn allows for a
few small unrelated improvements.

1: move merge_info from ELF to general link hash table
2: move sec_info from ELF to general section struct
3: simplify _bfd_{add_merge,write_merged}_section() interface
4: simplify _bfd_merged_section_offset() interface
5: simplify _bfd_{link,write,discard}_section_stabs() interface
6: generalize _bfd_elf_merge_sections()
7: replace _bfd_merge_sections() hook with simple boolean
8: section merging for PE/COFF images

Jan


More information about the Binutils mailing list