From: Fangrui Song Date: Tue, 24 Aug 2021 16:26:44 +0000 (-0700) Subject: powerpc: Use --no-tls-get-addr-optimize in test only if the linker supports it X-Git-Tag: glibc-2.35~560 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f9cd7d5d194c652e9ec31634da3fc8ef1bf06780;p=thirdparty%2Fglibc.git powerpc: Use --no-tls-get-addr-optimize in test only if the linker supports it LLD doesn't support --{,no-}tls-get-addr-optimize. Reviewed-by: Tulio Magno Quites Machado Filho --- diff --git a/sysdeps/unix/sysv/linux/powerpc/Makefile b/sysdeps/unix/sysv/linux/powerpc/Makefile index 733557ba130..fc7c29c6953 100644 --- a/sysdeps/unix/sysv/linux/powerpc/Makefile +++ b/sysdeps/unix/sysv/linux/powerpc/Makefile @@ -14,8 +14,10 @@ endif ifeq ($(subdir),elf) # Otherwise tst-tls-dlinfo fails due to tst-tlsmod2.so using static tls. +ifeq ($(have-tls-get-addr-optimize),yes) LDFLAGS-tst-tlsmod2.so += -Wl,--no-tls-get-addr-optimize endif +endif ifeq ($(subdir),misc) sysdep_headers += bits/ppc.h diff --git a/sysdeps/unix/sysv/linux/powerpc/configure b/sysdeps/unix/sysv/linux/powerpc/configure index 6f883de396e..ceb1bd7c1b0 100644 --- a/sysdeps/unix/sysv/linux/powerpc/configure +++ b/sysdeps/unix/sysv/linux/powerpc/configure @@ -76,4 +76,38 @@ $as_echo "$libc_cv_mabi_ibmlongdouble" >&6; } fi fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for linker that supports --no-tls-get-addr-optimize" >&5 +$as_echo_n "checking for linker that supports --no-tls-get-addr-optimize... " >&6; } +libc_linker_feature=no +if test x"$gnu_ld" = x"yes"; then + libc_linker_check=`$LD -v --help 2>/dev/null | grep "\--no-tls-get-addr-optimize"` + if test -n "$libc_linker_check"; then + 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_linker_feature=yes + fi + rm -f conftest* + fi +fi +if test $libc_linker_feature = yes; then + libc_cv_tls_get_addr_optimize=yes +else + libc_cv_tls_get_addr_optimize=no +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_linker_feature" >&5 +$as_echo "$libc_linker_feature" >&6; } +config_vars="$config_vars +have-tls-get-addr-optimize = $libc_cv_tls_get_addr_optimize" + ldd_rewrite_script=sysdeps/unix/sysv/linux/powerpc/ldd-rewrite.sed diff --git a/sysdeps/unix/sysv/linux/powerpc/configure.ac b/sysdeps/unix/sysv/linux/powerpc/configure.ac index 598e44ab71f..8d2ec60f68a 100644 --- a/sysdeps/unix/sysv/linux/powerpc/configure.ac +++ b/sysdeps/unix/sysv/linux/powerpc/configure.ac @@ -36,4 +36,8 @@ long double foobar (long double x) { return x; }]])], fi fi +LIBC_LINKER_FEATURE([--no-tls-get-addr-optimize], [-Wl,--no-tls-get-addr-optimize], + [libc_cv_tls_get_addr_optimize=yes], [libc_cv_tls_get_addr_optimize=no]) +LIBC_CONFIG_VAR([have-tls-get-addr-optimize], [$libc_cv_tls_get_addr_optimize]) + ldd_rewrite_script=sysdeps/unix/sysv/linux/powerpc/ldd-rewrite.sed