[PATCH] ld: Fix elf_x86_64 and elf_i386 emulations for Solaris x86

Rainer Orth ro@CeBiTec.Uni-Bielefeld.DE
Fri Sep 5 07:46:46 GMT 2025


Hi H.J.,
>
>> On Thu, Sep 4, 2025 at 12:25 PM Rainer Orth <ro@cebitec.uni-bielefeld.de> wrote:
>>>
>>> Hi H.J.,
>>>
>>> > Linkers configured for i[3-7]86-*-solaris2* and x86_64-*-solaris2* report:
>>> >
>>> > $ ./ld-new -V
>>> > GNU ld (GNU Binutils) 2.45.50.20250904
>>> >   Supported emulations:
>>> >    elf_x86_64_sol2
>>> >    elf_x86_64
>>> >    elf_i386_sol2
>>> >    elf_i386_ldso
>>> >    elf_i386
>>> >    elf_iamcu
>>> >
>>> > However, elf_x86_64 and elf_i386 emulations aren't really working:
>>> >
>>> > $ ./ld-new -melf_x86_64 -shared x.o
>>> > ./ld-new: target elf64-x86-64 not found
>>> > ...
>>> > $ ./ld-new -melf_i386 -shared x.o
>>> > ./ld-new: target elf32-i386 not found
>>> > $
>>> >
>>> > Fix it by adding i386_elf32_vec and x86_64_elf64_vec to Solaris x86
>>> > linkers.
>>>
>>> I need to test this first (and if it really works, Solaris/SPARC needs
>>> the same treatment.  However, I recall that we had something like this
>>> initially, but it didn't work because target detection didn't work
>>> anymore because of the ambiguity between elf32-i386 and elf32-i386-sol2.
>>
>> That is a possibility.   Or we can drop elf_x86_64 and elf_i386 from
>> "ld -V".
>
> before we do anything, let me investigate what happens one way or
> another.  No need to be hasty.

I found why the non-*_sol2 emulations are excluded on Solaris.  See PR
binutils/27666 for details.

The fact that they are listed in ld -V output clearly is a but, but
re-adding them certainly isn't the solution.  Besides, testing some code
with emulations that aren't otherwise used on Solaris seems pointless to
me: the patch in question should work *with the code that is actually
used there*, not something else.  After all, the readelf --got-contents
and --plt-contents patches are always present (well, at least on x86),
so they should work (and be tested) there as well.

It didn't help at all that you didn't tell if and how you tested your
patch, unfortunately.

	Rainer

-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University


More information about the Binutils mailing list