]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
powerpc: Use --no-tls-get-addr-optimize in test only if the linker supports it
authorFangrui Song <maskray@google.com>
Tue, 24 Aug 2021 16:26:44 +0000 (09:26 -0700)
committerFangrui Song <i@maskray.me>
Sat, 28 Aug 2021 00:27:51 +0000 (17:27 -0700)
LLD doesn't support --{,no-}tls-get-addr-optimize.

Reviewed-by: Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com>
(cherry picked from commit f9cd7d5d194c652e9ec31634da3fc8ef1bf06780)

sysdeps/unix/sysv/linux/powerpc/Makefile
sysdeps/unix/sysv/linux/powerpc/configure
sysdeps/unix/sysv/linux/powerpc/configure.ac

index 19ac59d8620bcec050b7b886e09edccbb2baca93..6ff5cc2fc18a91e9f107109de406b3b2abdb3b04 100644 (file)
@@ -19,8 +19,10 @@ ifeq ($(build-shared),yes)
 sysdep-dl-routines += dl-static
 endif
 # 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
index 6d2465fcac6dfd0c3df5457282e015f2a8943d11..dab587c81f9df876b90ba88b88b6419abb31ed9a 100644 (file)
@@ -79,4 +79,38 @@ fi
 
 fi # clang
 
+{ $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 <<EOF
+int _start (void) { return 42; }
+EOF
+    if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS $no_ssp
+                               -Wl,--no-tls-get-addr-optimize -nostdlib -nostartfiles
+                               -fPIC -shared -o conftest.so conftest.c
+                               1>&5'
+  { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&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
index d3e12079eecc32c40d9a0d9c61207a69c0b6c692..5f7eb3d05b4f45522313086442a8cecf08f152fd 100644 (file)
@@ -40,4 +40,8 @@ fi
 
 fi # clang
 
+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