[PATCH v2] elf: Keep section symbols for Solaris binary

Jan Beulich jbeulich@suse.com
Mon Dec 8 07:52:03 GMT 2025


On 06.12.2025 04:04, H.J. Lu wrote:
> After
> 
> commit d1bcae833b32f1408485ce69f844dcd7ded093a8
> Author: H.J. Lu <hjl.tools@gmail.com>
> Date:   Thu Jan 7 06:42:00 2021 -0800
> 
>     ELF: Don't generate unused section symbols
> 
> x86 ELF binutils tools no longer generate unused section symbols.  But
> Solaris binary generated by Solaris linker may include symbol sort
> sections which hold indexes of data and function symbols, sorted by name
> or by address.  When objcopy removes section symbols, it corrupts Solaris
> symbol sort sections since symbol indexes are changed.  Keep section
> symbols for Solaris binary.
> 
> PR binutils/33684
> * objcopy.c (copy_object): Keep section symbols if input is a
> Solaris binary and output target is the same as input target.

Hmm, an open-coded OSABI check in objcopy. I was expecting change in libbfd
to e.g. make bfd_keep_unused_section_symbols() on ibfd true for Solaris, to
then copy that property to obfd. Is there a reason to not try to somewhat
abstract what is wanted / needed?

Jan


More information about the Binutils mailing list