about summary refs log tree commit diff
path: root/sysdeps/loongarch/configure.ac
diff options
context:
space:
mode:
authorXi Ruoyao <xry111@xry111.site>2023-02-27 19:08:09 +0800
committercaiyinyu <caiyinyu@loongson.cn>2023-03-02 11:17:15 +0800
commita2ef941b2d74bfe47998e5afa29943f2f43642ae (patch)
treebdf2c9ca2b011b9f8fdee56e127524350ca76060 /sysdeps/loongarch/configure.ac
parent0d41182e0e987b0a256d55152c36103c88b35585 (diff)
downloadglibc-a2ef941b2d74bfe47998e5afa29943f2f43642ae.tar.gz
glibc-a2ef941b2d74bfe47998e5afa29943f2f43642ae.tar.xz
glibc-a2ef941b2d74bfe47998e5afa29943f2f43642ae.zip
LoongArch: Further refine the condition to enable static PIE
Before GCC r13-2728, it would produce a normal dynamic-linked executable
with -static-pie.  I mistakely believed it would produce a static-linked
executable, so failed to detect the breakage.  Then with Binutils 2.40
and (vanilla) GCC 12, libc_cv_static_pie_on_loongarch is mistakenly
enabled and cause a building failure with "undefined reference to
_DYNAMIC".

Fix the issue by disabling static PIE if -static-pie creates something
with a INTERP header.
Diffstat (limited to 'sysdeps/loongarch/configure.ac')
-rw-r--r--sysdeps/loongarch/configure.ac1
1 files changed, 1 insertions, 0 deletions
diff --git a/sysdeps/loongarch/configure.ac b/sysdeps/loongarch/configure.ac
index 9df387f086..eaee4a9f76 100644
--- a/sysdeps/loongarch/configure.ac
+++ b/sysdeps/loongarch/configure.ac
@@ -41,6 +41,7 @@ EOF
   libc_cv_static_pie_on_loongarch=no
   if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -static-pie -nostdlib -fPIE -o conftest1 conftest1.S]) \
      && AC_TRY_COMMAND([LC_ALL=C $READELF -Wr conftest1 | grep -q R_LARCH_RELATIVE]) \
+     && ! AC_TRY_COMMAND([LC_ALL=C $READELF -Wl conftest1 | grep -q INTERP]) \
      && AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -shared -fPIC -o conftest2.so conftest2.S]) \
      && AC_TRY_COMMAND([LC_ALL=C $READELF -Wr conftest2.so | grep -q 'R_LARCH_JUMP_SLOT.*external_func'])
   then