public inbox for glibc-cvs@sourceware.org help / color / mirror / Atom feed
From: Yinyu Cai <caiyinyu@sourceware.org> To: glibc-cvs@sourceware.org Subject: [glibc] LoongArch: Further refine the condition to enable static PIE Date: Thu, 2 Mar 2023 06:06:37 +0000 (GMT) [thread overview] Message-ID: <20230302060637.8A7C03858D33@sourceware.org> (raw) https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=a2ef941b2d74bfe47998e5afa29943f2f43642ae commit a2ef941b2d74bfe47998e5afa29943f2f43642ae Author: Xi Ruoyao <xry111@xry111.site> Date: Mon Feb 27 19:08:09 2023 +0800 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. Diff: --- sysdeps/loongarch/configure | 6 ++++++ sysdeps/loongarch/configure.ac | 1 + 2 files changed, 7 insertions(+) diff --git a/sysdeps/loongarch/configure b/sysdeps/loongarch/configure index f6c078c1ad..b3c203ba4b 100644 --- a/sysdeps/loongarch/configure +++ b/sysdeps/loongarch/configure @@ -47,6 +47,12 @@ EOF (eval $ac_try) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; } \ + && ! { ac_try='LC_ALL=C $READELF -Wl conftest1 | grep -q INTERP' + { { 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; }; } \ && { ac_try='${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -shared -fPIC -o conftest2.so conftest2.S' { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 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
reply other threads:[~2023-03-02 6:06 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20230302060637.8A7C03858D33@sourceware.org \ --to=caiyinyu@sourceware.org \ --cc=glibc-cvs@sourceware.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).