Re: [PATCH 0/4] alpha: add IFUNC support

Matt Turner <[email protected]>
Newsgroups gmane.comp.gnu.binutils
Message-ID <CAEdQ38G-+WOvW72J8tRpnX28SNFsPJ3y6hbSziZhM0e=2nreTg@mail.gmail.com>
On Sun, Aug 9, 2026 at 5:41 PM Matt Turner <[email protected]> wrote:
>
> Testing this series against glibc turned up a case it got wrong, so I have
> sent v2 of two of the four patches, each in reply to the patch it replaces:
>
>   [PATCH v2 2/4] alpha: resolve IFUNCs this link resolves itself out of
>                  .rela.iplt
>   [PATCH v2 4/4] alpha: handle IFUNC symbols with local binding
>
> 1/4 and 3/4 are unchanged.  3/4 still applies on top of v2 2/4; only its
> hunk offsets move.
>
> An IFUNC referenced from a non-PIE executable killed the linker:
>
>   BFD assertion fail bfd/elf64-alpha.c:4216
>   collect2: fatal error: ld terminated with signal 11 [Segmentation fault]
>
> Such an IFUNC cannot be preempted, so it never becomes a dynamic symbol
> and the sizing code reserves nothing for it in .rela.got or .rela.<sec>.
> check_relocs knew that and reserved .rela.iplt space instead, but
> relocate_section decided where to emit by asking whether the link had
> dynamic sections at all, and so took the ordinary path and was handed the
> dynamic reloc section for the input section, which is a null pointer
> because nothing ever created one.
>
> v2 2/4 makes both sides ask the same question -- does this link resolve
> the IFUNC itself, which is so both when there is no dynamic linker and
> when the link is not position-independent.  It also sizes the .rela.iplt
> space for such a symbol's GOT entries in a dynamic link, which only the
> static path did before, and skips a symbol with a PLT entry in both the
> sizing and the emitting, since finish_dynamic_symbol handles those and
> .rela.iplt would otherwise overrun.
>
> Because the fix belongs where the mistake was, I folded it into 2/4 rather
> than adding a fifth patch: without it, 2/4 and 3/4 segfault the linker on
> an ordinary non-PIE executable, which is unpleasant to bisect through.
> 2/4 is retitled, since it no longer only concerns static links.
>
> Each patch builds on its own, and check-ld at the tip of the series has no
> unexpected failures.  New tests cover a dynamic executable that references
> and calls an IFUNC, with local and with global binding; both fail without
> this change.
>
> With the series applied, glibc builds on alpha with --enable-multi-arch
> and its IFUNC tests link, where before six of them did not.
>
> Thanks,
> Matt

Anything I can to do to help get this series (or any of my other
recent patches) reviewed?
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.