unofficial mirror of libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] powerpc: Use --no-tls-get-addr-optimize in test only if the linker supports it
@ 2021-08-17  7:41 Fangrui Song via Libc-alpha
  2021-08-24 16:11 ` Tulio Magno Quites Machado Filho via Libc-alpha
  0 siblings, 1 reply; 2+ messages in thread
From: Fangrui Song via Libc-alpha @ 2021-08-17  7:41 UTC (permalink / raw)
  To: libc-alpha, Tulio Magno Quites Machado Filho

LLD doesn't support --{,no-}tls-get-addr-optimize.

When LLD 13.0.0 is allowed in configure.ac
(https://sourceware.org/pipermail/libc-alpha/2021-August/129866.html),
`make check` result is on par with glibc built with GNU ld on ppc64le.
---
 sysdeps/unix/sysv/linux/powerpc/Makefile     |  2 ++
 sysdeps/unix/sysv/linux/powerpc/configure    | 34 ++++++++++++++++++++
 sysdeps/unix/sysv/linux/powerpc/configure.ac |  4 +++
 3 files changed, 40 insertions(+)

diff --git a/sysdeps/unix/sysv/linux/powerpc/Makefile b/sysdeps/unix/sysv/linux/powerpc/Makefile
index 733557ba13..fc7c29c695 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 6f883de396..ceb1bd7c1b 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 <<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
diff --git a/sysdeps/unix/sysv/linux/powerpc/configure.ac b/sysdeps/unix/sysv/linux/powerpc/configure.ac
index 598e44ab71..8d2ec60f68 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
-- 
2.33.0.rc1.237.g0d66db33f3-goog


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] powerpc: Use --no-tls-get-addr-optimize in test only if the linker supports it
  2021-08-17  7:41 [PATCH] powerpc: Use --no-tls-get-addr-optimize in test only if the linker supports it Fangrui Song via Libc-alpha
@ 2021-08-24 16:11 ` Tulio Magno Quites Machado Filho via Libc-alpha
  0 siblings, 0 replies; 2+ messages in thread
From: Tulio Magno Quites Machado Filho via Libc-alpha @ 2021-08-24 16:11 UTC (permalink / raw)
  To: Fangrui Song, libc-alpha

Fangrui Song via Libc-alpha <libc-alpha@sourceware.org> writes:

> LLD doesn't support --{,no-}tls-get-addr-optimize.
>
> When LLD 13.0.0 is allowed in configure.ac
> (https://sourceware.org/pipermail/libc-alpha/2021-August/129866.html),
> `make check` result is on par with glibc built with GNU ld on ppc64le.

I tested with LLD 12.0.1 and found no issues.
LGTM.

Reviewed-by: Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com>

-- 
Tulio Magno

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-08-24 16:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-17  7:41 [PATCH] powerpc: Use --no-tls-get-addr-optimize in test only if the linker supports it Fangrui Song via Libc-alpha
2021-08-24 16:11 ` Tulio Magno Quites Machado Filho via Libc-alpha

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).