[PATCH 0/2] sparc: Fix IFUNC startup and ldd-trace regressions

Andreas K. Huettel dilfridge@gentoo.org
Wed Jul 15 13:08:32 GMT 2026


Am Mittwoch, 15. Juli 2026, 21:10:40 Japanische Normalzeit schrieb Adhemerval Zanella Netto:
> 
> On 15/07/26 09:00, Andreas K. Huettel wrote:
> >> Patch 1 fixes BZ#34396: on a static (non-PIE) binary __libc_setup_tls
> >> issuse _dl_allocate_tls_init which copies the TLS init image with the
> >> IFUNC __mempcpy, which now runs before the static IFUNC (IRELATIVE)
> >> relocations are applied, so the call jumps through an unrelocated PLT
> >> slot and dies with SIGILL.  It redirects the mem* routines reached on
> >> that path to their non-IFUNC ultra1 implementations.
> > [...]
> >> With an working toolchain, running the sparc testsuite with patch 1 applied
> >> exposed two further regressions:
> >>
> >>   FAIL: elf/tst-ifunc-fault-bindnow
> >>   FAIL: elf/tst-ifunc-fault-lazy
> >>
> >> Patch 2 fixes those by proper handling R_SPARC_JMP_IREL.  I also checked
> >> other ABIs for similar issues and powerpc64 (ELFv1) uses a similar second
> >> reloc (R_PPC64_JMP_IREL).  The patch fixes it as well.
> > 
> > Tested on sparc64 (catbus) and improves the situation a lot - down to 12 failures
> > from >200. Feel free to add 
> > 
> > Tested-by: Andreas K. Hüttel <dilfridge@gentoo.org>
> 
> Thanks, I think I will install them by the end of the week.
> 
> > 
> > In detail, the remaining failures are:
> > 
> > FAIL: elf/tst-pldd (*)
> > FAIL: elf/tst-thp-1
> > FAIL: elf/tst-thp-1-no-s-code
> > FAIL: elf/tst-thp-1-no-s-code-pde
> > FAIL: elf/tst-thp-1-no-s-code-static
> > FAIL: elf/tst-thp-1-pde
> > FAIL: elf/tst-thp-1-static
> 
> This is because PMD for THP on sparc is 8MB instead of default 2MB, this
> should fix it:
> 
> diff --git a/sysdeps/unix/sysv/linux/sparc/Makefile b/sysdeps/unix/sysv/linux/sparc/Makefile
> index e0056c9413f..57e73d0a14d 100644
> --- a/sysdeps/unix/sysv/linux/sparc/Makefile
> +++ b/sysdeps/unix/sysv/linux/sparc/Makefile
> @@ -14,3 +14,8 @@ endif
>  ifeq ($(subdir),signal)
>  sysdep_routines += sigreturn_stub
>  endif
> +
> +ifeq ($(subdir),elf)
> +# The sparc64 uses an 8KB base page and 8MB PMD transparent huge page
> +THP-PAGE-SIZE = 0x800000
> +endif
> 

That works indeed:

FAIL: elf/tst-pldd
FAIL: math/test-float64x-float128-mul
FAIL: socket/tst-socket-timestamp
FAIL: stdlib/tst-setcontext2
                === Summary of results ===
      4 FAIL
   6735 PASS
     70 UNSUPPORTED
     17 XFAIL
      2 XPASS

(and none of these 4 are regressions compared to 2.41). Thank you! \o/


-- 
PD Dr. Andreas K. Hüttel
dilfridge@gentoo.org
Gentoo Linux developer 
(council, comrel, toolchain, base-system, perl, libreoffice)
https://wiki.gentoo.org/wiki/User:Dilfridge
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 870 bytes
Desc: This is a digitally signed message part.
URL: <https://sourceware.org/pipermail/libc-alpha/attachments/20260715/24b5409f/attachment.sig>


More information about the Libc-alpha mailing list