[PATCH 2/7] x86: handle a local IFUNC referenced only from a non-alloc section

Harshit Kumar harshit7kr@gmail.com
Fri Nov 13 13:21:01 GMT 2026


> But a GNU one at least, i.e. ...
> ... I'm not sure these tests should work as expected there. (IOW if they
> do, this may point at another problem.)

As far as I can tell x86_64-elf is one.  Its vectors, x86_64_elf64_vec
and i386_elf32_vec, have ELF_OSABI ELFOSABI_GNU (FreeBSD and Solaris
have their own), and the linked output is marked OS/ABI GNU.
supports_gnu_osabi in binutils-common.exp is true for *-*-elf*, so
ld-ifunc/ifunc.exp runs there as well (98 passes on master), and
i386.exp already runs IFUNC tests such as pr20253-5 and pr22929 ahead
of the return.

> I think all options explicitly specified should be there for a reason.
> Hence if there's none here, I'd prefer them to be omitted.

-melf_i386 is needed when i386.exp runs on an x86_64 target, where ld
otherwise rejects the --32 objects.  -melf_x86_64 is needed for
x86_64-*-linux-gnux32, whose default emulation is elf32_x86_64: an x32
ld rejects the --64 object without it.  -Ttext=0x10000 fixes the
address the dump checks.  -e _start has no reason, so I'll drop it in v2.

Thanks,
Harshit

On Fri, 13 Nov 2026 at 18:36, Jan Beulich <jbeulich@suse.com> wrote:
>
> On 13.11.2026 13:45, Harshit Kumar wrote:
> >> How did you pick this insertion point?
> >
> > On purpose ahead of the return.  The new tests are static links with
> > no shared library or run step, so they don't need a Linux target,
>
> But a GNU one at least, i.e. ...
>
> > and I wanted x86_64-elf to run them too.
>
> ... I'm not sure these tests should work as expected there. (IOW if they
> do, this may point at another problem.)
>
> >  In x86-64.exp I first had them
> > after pr20253-5b, but in an x86_64-elf build that is past the return
> > and they silently stopped running, so I put them at the end of the
> > pr-numbered run instead (after pr20093-2).  In i386.exp they follow
> > pr20253-5, the end of the IFUNC tests there.  All eight pass in an
> > x86_64-elf build as well as natively.  The ifunc-textrel tests below
> > the return link with -pie, which I took to be why they are there.
> >
> >> These -melf_i386 (if really needed) may in fact get in the way of
> >> invoking these testcases ahead of said conditional return.
> >
> > The neighbouring tests use -melf_i386 and -melf_x86_64 the same way
> > (e.g. pr20253-5, pr20093-2), and they work on x86_64-elf.  I can drop
> > the option if you prefer.
>
> I think all options explicitly specified should be there for a reason.
> Hence if there's none here, I'd prefer them to be omitted.
>
> >> Note also that there is a whole ld-ifunc/ subdir.
> >
> > ld-ifunc/ holds mostly shared or run tests built from C, and the
> > related pr22929 test lives in ld-i386/ and ld-x86-64/, so I'd keep
> > them there unless you prefer otherwise.
>
> I have no particular preference, seeing that it's a mix already.
>
> Jan


More information about the Binutils mailing list