[PATCH v3] elf: Keep unused section symbols for Solaris binary
H.J. Lu
hjl.tools@gmail.com
Wed Dec 10 02:20:35 GMT 2025
More information about the Binutils mailing list
Wed Dec 10 02:20:35 GMT 2025
- Previous message (by thread): [PATCH v3] elf: Keep unused section symbols for Solaris binary
- Next message (by thread): [PATCH v3] elf: Keep unused section symbols for Solaris binary
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Wed, Dec 10, 2025 at 2:12 AM Ali Bahrami <Ali.Bahrami@oracle.com> wrote: > > On 12/9/25 00:31, Jan Beulich wrote: > >> 1. Update bfd_keep_unused_section_symbols to return true for Solaris > >> binary. > >> 2. Keep section symbols if input section symbols should be kept and > >> output target is the same as input target. > > This is okay afaic, but please give Rainer and/or Ali a chance to comment. > > > > Irrespective I have a question here, though (perhaps also to Alan and Nick): > > Isn't it wrong for objcopy to remove_any_ symbols (including section ones) > > without an explicit request to do so? IOW shouldn't objcopy without any > > specific options largely generate an output identical to the input? > > > I asked the same question fairly early in the bug. I was > surprised to see a change like this done by default, and also > that it's an x86-only optimization not done consistently > across platforms. > > I'm sure that the counter argument to all of that is > that if it's not enabled by default, it won't get used. > > Since I'm opining, I'll also ask why this isn't more > appropriately done only by the link-editor. I'd say > that if gld doesn't want section symbols, it doesn't > need to make them, but that objcopy ought (by default) > to preserve the choice made by the link-editor. It is Solaris: [17] .bss NOBITS 00000000001008f8 0008f8 000004 00 WA 0 0 4 [18] .symtab SYMTAB 0000000000000000 0008f8 000378 18 19 28 8 [19] .strtab STRTAB 0000000000000000 000c70 00007d 00 S 0 0 1 [20] .SUNW_symtabsort SUNW_symsort 0000000000000000 000cf0 000018 04 18 0 8 [21] .SUNW_symtabnsort SUNW_symnsort 0000000000000000 000d08 000028 04 18 0 8 [22] .comment PROGBITS 0000000000000000 000d30 000013 01 0 0 1 [23] .shstrtab STRTAB 0000000000000000 000d43 0000ea 00 S 0 0 1 vs GNU [17] .bss NOBITS 00000000001008f8 0008f8 000004 00 WA 0 0 4 [18] .SUNW_symtabsort SUNW_symsort 0000000000000000 0008f8 000018 04 21 0 8 [19] .SUNW_symtabnsort SUNW_symnsort 0000000000000000 000910 000028 04 21 0 8 [20] .comment PROGBITS 0000000000000000 000938 000013 01 0 0 1 [21] .symtab SYMTAB 0000000000000000 000950 000378 18 22 28 8 [22] .strtab STRTAB 0000000000000000 000cc8 00007d 00 0 0 1 [23] .shstrtab STRTAB 0000000000000000 000d45 0000ea 00 0 0 1 .symtab, .strtab and .shstrtab aren't treated as opaque sections. Their contents are decoded and stored internally. During output, they are written out from the internal presentation in the GNU order. which is different from Solaris order. > Anyway, I just tried this latest v3 patch. I had to > drop the testsuite part, and for reasons I don't > fully understand, had to recreate the objcopy.c part > of it manually. That's probably not an upstream issue. > Having done that, it builds, and it seems to preserve > the section symbols, so it addresses my main concern. > > Thanks. > > - Ali > -- H.J.
- Previous message (by thread): [PATCH v3] elf: Keep unused section symbols for Solaris binary
- Next message (by thread): [PATCH v3] elf: Keep unused section symbols for Solaris binary
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Binutils mailing list