From: Adhemerval Zanella Date: Tue, 20 Jan 2026 13:11:10 +0000 (-0300) Subject: arm: Fix tst-gnu2-tls2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ba0fedc2b9412792a410ca580da221f4e5c36599;p=thirdparty%2Fglibc.git arm: Fix tst-gnu2-tls2 On armv7a vfpv4 tst-gnu2-tls2 fails with: open tst-gnu2-tls2mod0.so open tst-gnu2-tls2mod1.so open tst-gnu2-tls2mod2.so close tst-gnu2-tls2mod0.so close tst-gnu2-tls2mod1.so open tst-gnu2-tls2mod0.so open tst-gnu2-tls2mod1.so Didn't expect signal from child: got `Aborted' Because AFTER_TLSDESC_CALL might clobber caller-saved registers and the zero array might call the memset function resolution, which itself might clobber some vector registers. The AFTER_TLSDESC_CALL calls memset and memcmp, and both the lazy resolution and the routines themselves can clobber the caller-saved registes used in the tests. Checked on arm-linux-gnueabihf (armv7-a vpfv4 / QEMU). Reviewed-by: Florian Weimer --- diff --git a/sysdeps/arm/tst-gnu2-tls2.h b/sysdeps/arm/tst-gnu2-tls2.h index 821551c856..6fa98f83f6 100644 --- a/sysdeps/arm/tst-gnu2-tls2.h +++ b/sysdeps/arm/tst-gnu2-tls2.h @@ -77,27 +77,19 @@ SAVE_VFP_D32 \ } -# define VFP_STACK_REQ (16*8) -# if __BYTE_ORDER == __BIG_ENDIAN -# define DISP 7 -# else -# define DISP 0 -# endif +# define VFP_STACK_REQ (16) # ifdef HAVE_ARM_PCS_VFP_D32 # define CHECK_VFP_D32 \ - char vfp[VFP_STACK_REQ]; \ + uint64_t vfp[VFP_STACK_REQ]; \ asm volatile ("vstmia %0, {d16-d31}\n" \ : \ : "r" (vfp) \ : "memory"); \ \ - char expected[VFP_STACK_REQ] = { 0 }; \ for (int i = 0; i < 16; ++i) \ - expected[i * 8 + DISP] = i + 17; \ - \ - if (memcmp (vfp, expected, VFP_STACK_REQ) != 0) \ - abort (); + if (vfp[i] != i + 17) \ + abort (); # else # define CHECK_VFP_D32 # endif @@ -105,18 +97,15 @@ # define AFTER_TLSDESC_CALL() \ if (hwcap & HWCAP_ARM_VFP) \ { \ - char vfp[VFP_STACK_REQ]; \ + uint64_t vfp[VFP_STACK_REQ]; \ asm volatile ("vstmia %0, {d0-d15}\n" \ : \ : "r" (vfp) \ : "memory"); \ \ - char expected[VFP_STACK_REQ] = { 0 }; \ for (int i = 0; i < 16; ++i) \ - expected[i * 8 + DISP] = i + 1; \ - \ - if (memcmp (vfp, expected, VFP_STACK_REQ) != 0) \ - abort (); \ + if (vfp[i] != i + 1) \ + abort (); \ } \ if (hwcap & HWCAP_ARM_VFPD32) \ { \