patching file config.h.in Hunk #1 FAILED at 198. 1 out of 1 hunk FAILED -- saving rejects to file config.h.in.rej patching file elf/tst-tls1.c Hunk #1 FAILED at 1. Hunk #2 FAILED at 39. Hunk #3 FAILED at 56. Hunk #4 FAILED at 74. 4 out of 4 hunks FAILED -- saving rejects to file elf/tst-tls1.c.rej patching file elf/tst-tls2.c Hunk #1 FAILED at 1. Hunk #2 FAILED at 39. Hunk #3 FAILED at 56. Hunk #4 FAILED at 74. 4 out of 4 hunks FAILED -- saving rejects to file elf/tst-tls2.c.rej patching file elf/tst-tls3.c Hunk #1 FAILED at 1. Hunk #2 FAILED at 17. Hunk #3 FAILED at 33. Hunk #4 FAILED at 56. 4 out of 4 hunks FAILED -- saving rejects to file elf/tst-tls3.c.rej patching file elf/tst-tlsmod1.c Hunk #1 FAILED at 1. Hunk #2 FAILED at 14. Hunk #3 FAILED at 34. Hunk #4 FAILED at 57. 4 out of 4 hunks FAILED -- saving rejects to file elf/tst-tlsmod1.c.rej patching file elf/tst-tlsmod2.c Hunk #1 FAILED at 1. Hunk #2 FAILED at 9. Hunk #3 FAILED at 29. 3 out of 3 hunks FAILED -- saving rejects to file elf/tst-tlsmod2.c.rej patching file elf/tst-tlsmod3.c Hunk #1 FAILED at 1. Hunk #2 FAILED at 12. Hunk #3 FAILED at 32. 3 out of 3 hunks FAILED -- saving rejects to file elf/tst-tlsmod3.c.rej patching file elf/tst-tlsmod4.c Hunk #1 FAILED at 1. Hunk #2 FAILED at 9. Hunk #3 FAILED at 29. 3 out of 3 hunks FAILED -- saving rejects to file elf/tst-tlsmod4.c.rej patching file sysdeps/aarch64/configure Hunk #1 FAILED at 332. 1 out of 1 hunk FAILED -- saving rejects to file sysdeps/aarch64/configure.rej patching file sysdeps/aarch64/configure.ac Hunk #1 FAILED at 105. 1 out of 1 hunk FAILED -- saving rejects to file sysdeps/aarch64/configure.ac.rej Reject file config.h.in.rej: --- config.h.in +++ config.h.in @@ -198,6 +198,9 @@ /* Define if CC supports attribute retain. */ #undef HAVE_GNU_RETAIN +/* Define if CC and LD support traditional TLS GD/LD models. */ +#define HAVE_TRAD_TLS 1 + /* Define to 1 if the assembler needs intermediate aliases to define multiple symbol versions for one symbol. */ #define SYMVER_NEEDS_ALIAS 0 Reject file elf/tst-tls1.c.rej: --- elf/tst-tls1.c +++ elf/tst-tls1.c @@ -1,4 +1,5 @@ /* glibc test for TLS in ld.so. */ +#include #include #include "tls-macros.h" @@ -39,7 +40,8 @@ do_test (void) result = 1; } - + /* Clang and LLD do not support traditional GD/LD TLS on aarch64. */ +#if HAVE_TRAD_TLS /* Get variables using local dynamic model. */ fputs ("get sum of foo and bar (LD)", stdout); ap = TLS_LD (foo); @@ -56,8 +58,9 @@ do_test (void) printf ("bar = %d\n", *bp); result = 1; } +#endif - +#if HAVE_TRAD_TLS /* Get variables using generic dynamic model. */ fputs ("get sum of foo and bar (GD)", stdout); ap = TLS_GD (foo); @@ -74,6 +77,7 @@ do_test (void) printf ("bar = %d\n", *bp); result = 1; } +#endif return result; } Reject file elf/tst-tls2.c.rej: --- elf/tst-tls2.c +++ elf/tst-tls2.c @@ -1,4 +1,5 @@ /* glibc test for TLS in ld.so. */ +#include #include #include "tls-macros.h" @@ -39,7 +40,7 @@ do_test (void) result = 1; } - +#if HAVE_TRAD_TLS /* Get variables using local dynamic model. */ fputs ("get sum of foo and bar (LD)", stdout); ap = TLS_LD (foo); @@ -56,8 +57,9 @@ do_test (void) printf ("bar = %d\n", *bp); result = 1; } +#endif - +#if HAVE_TRAD_TLS /* Get variables using generic dynamic model. */ fputs ("get sum of foo and bar (GD)", stdout); ap = TLS_GD (foo); @@ -74,6 +76,7 @@ do_test (void) printf ("bar = %d\n", *bp); result = 1; } +#endif return result; } Reject file elf/tst-tls3.c.rej: --- elf/tst-tls3.c +++ elf/tst-tls3.c @@ -1,4 +1,5 @@ /* glibc test for TLS in ld.so. */ +#include #include #include "tls-macros.h" @@ -17,8 +18,7 @@ static int do_test (void) { int result = 0; - int *ap, *bp, *cp; - + int *ap, *bp; /* Set the variable using the local exec model. */ puts ("set baz to 3 (LE)"); @@ -33,7 +33,8 @@ do_test (void) bp = TLS_IE (bar); *bp = 2; - +#if HAVE_TRAD_TLS + int *cp; /* Get variables using local dynamic model. */ fputs ("get sum of foo, bar (GD) and baz (LD)", stdout); ap = TLS_GD (foo); @@ -56,7 +57,7 @@ do_test (void) printf ("baz = %d\n", *cp); result = 1; } - +#endif result |= in_dso (); Reject file elf/tst-tlsmod1.c.rej: --- elf/tst-tlsmod1.c +++ elf/tst-tlsmod1.c @@ -1,3 +1,4 @@ +#include #include #include "tls-macros.h" @@ -14,7 +15,7 @@ int in_dso (void) { int result = 0; - int *ap, *bp, *cp; + int *ap, *bp; /* Get variables using initial exec model. */ fputs ("get sum of foo and bar (IE)", stdout); @@ -34,7 +35,8 @@ in_dso (void) result = 1; } - +#if HAVE_TRAD_TLS + int *cp; /* Get variables using generic dynamic model. */ fputs ("get sum of foo and bar and baz (GD)", stdout); ap = TLS_GD (foo); @@ -57,6 +59,7 @@ in_dso (void) printf ("baz = %d\n", *cp); result = 1; } +#endif return result; } Reject file elf/tst-tlsmod2.c.rej: --- elf/tst-tlsmod2.c +++ elf/tst-tlsmod2.c @@ -1,3 +1,4 @@ +#include #include #include "tls-macros.h" @@ -9,9 +10,10 @@ COMMON_INT_DEF(foo); int in_dso (int n, int *caller_foop) { - int *foop; int result = 0; +#if HAVE_TRAD_TLS + int *foop; puts ("foo"); /* Make sure PLT is used before macros. */ asm ("" ::: "memory"); @@ -29,6 +31,7 @@ in_dso (int n, int *caller_foop) } *foop = 16; +#endif return result; } Reject file elf/tst-tlsmod3.c.rej: --- elf/tst-tlsmod3.c +++ elf/tst-tlsmod3.c @@ -1,3 +1,4 @@ +#include #include #include "tls-macros.h" @@ -12,8 +13,10 @@ COMMON_INT_DEF(comm_n); int in_dso2 (void) { - int *foop; int result = 0; + +#if HAVE_TRAD_TLS + int *foop; static int n; int *np; @@ -32,6 +35,7 @@ in_dso2 (void) result |= in_dso (*foop = 42 + n++, foop); *foop = 16; +#endif return result; } Reject file elf/tst-tlsmod4.c.rej: --- elf/tst-tlsmod4.c +++ elf/tst-tlsmod4.c @@ -1,3 +1,4 @@ +#include #include #include "tls-macros.h" @@ -9,9 +10,10 @@ COMMON_INT_DEF(baz); int in_dso (int n, int *caller_bazp) { - int *bazp; int result = 0; +#if HAVE_TRAD_TLS + int *bazp; puts ("foo"); /* Make sure PLT is used before macros. */ asm ("" ::: "memory"); @@ -29,6 +31,7 @@ in_dso (int n, int *caller_bazp) } *bazp = 16; +#endif return result; } Reject file sysdeps/aarch64/configure.rej: --- sysdeps/aarch64/configure +++ sysdeps/aarch64/configure @@ -332,3 +332,33 @@ if test $libc_cv_aarch64_sve_asm = yes; then $as_echo "#define HAVE_AARCH64_SVE_ASM 1" >>confdefs.h fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for -mtls-dialect=trad" >&5 +$as_echo_n "checking for -mtls-dialect=trad... " >&6; } +if ${libc_cv_aarch64_trad_tls+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat > conftest.c <&5 + (eval $ac_try) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; } + then + libc_cv_aarch64_trad_tls=yes + else + libc_cv_aarch64_trad_tls=no + fi + rm -f conftest* +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_aarch64_trad_tls" >&5 +$as_echo "$libc_cv_aarch64_trad_tls" >&6; } +if test $libc_cv_aarch64_trad_tls = no; then + $as_echo "#define HAVE_TRAD_TLS 0" >>confdefs.h + +fi Reject file sysdeps/aarch64/configure.ac.rej: --- sysdeps/aarch64/configure.ac +++ sysdeps/aarch64/configure.ac @@ -105,3 +105,21 @@ rm -f conftest*]) if test $libc_cv_aarch64_sve_asm = yes; then AC_DEFINE(HAVE_AARCH64_SVE_ASM) fi + +# Check if both CC and LD support traditional TLS GD/LD models. +AC_CACHE_CHECK([for -mtls-dialect=trad], libc_cv_aarch64_trad_tls, [dnl +cat > conftest.c <