public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] LoongArch: Fix static PIE condition for toolchain bootstrapping.
@ 2023-08-03  8:35 Yang Yujie
  2023-08-03 13:35 ` Adhemerval Zanella Netto
  0 siblings, 1 reply; 2+ messages in thread
From: Yang Yujie @ 2023-08-03  8:35 UTC (permalink / raw)
  To: libc-alpha; +Cc: xry111, caiyinyu, adhemerval.zanella

This patch allows the static PIE startfile rcrt1.o to be built
without requiring libgcc_s.so from GCC, which depends on libc
in the first place.
---
 sysdeps/loongarch/configure    | 2 +-
 sysdeps/loongarch/configure.ac | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/sysdeps/loongarch/configure b/sysdeps/loongarch/configure
index 7f1dabbc37..5843c7cf90 100644
--- a/sysdeps/loongarch/configure
+++ b/sysdeps/loongarch/configure
@@ -55,7 +55,7 @@ EOF
   ac_status=$?
   printf "%s\n" "$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'
+     && { ac_try='${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -shared -nostdlib -fPIC -o conftest2.so conftest2.S'
   { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
   (eval $ac_try) 2>&5
   ac_status=$?
diff --git a/sysdeps/loongarch/configure.ac b/sysdeps/loongarch/configure.ac
index 39efccfd8f..ba89d8346d 100644
--- a/sysdeps/loongarch/configure.ac
+++ b/sysdeps/loongarch/configure.ac
@@ -42,7 +42,7 @@ EOF
   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([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -shared -nostdlib -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
     libc_cv_static_pie_on_loongarch=yes
-- 
2.31.1


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

* Re: [PATCH] LoongArch: Fix static PIE condition for toolchain bootstrapping.
  2023-08-03  8:35 [PATCH] LoongArch: Fix static PIE condition for toolchain bootstrapping Yang Yujie
@ 2023-08-03 13:35 ` Adhemerval Zanella Netto
  0 siblings, 0 replies; 2+ messages in thread
From: Adhemerval Zanella Netto @ 2023-08-03 13:35 UTC (permalink / raw)
  To: Yang Yujie, libc-alpha; +Cc: xry111, caiyinyu



On 03/08/23 05:35, Yang Yujie wrote:
> This patch allows the static PIE startfile rcrt1.o to be built
> without requiring libgcc_s.so from GCC, which depends on libc
> in the first place.

LGTM, thanks.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>

> ---
>  sysdeps/loongarch/configure    | 2 +-
>  sysdeps/loongarch/configure.ac | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/sysdeps/loongarch/configure b/sysdeps/loongarch/configure
> index 7f1dabbc37..5843c7cf90 100644
> --- a/sysdeps/loongarch/configure
> +++ b/sysdeps/loongarch/configure
> @@ -55,7 +55,7 @@ EOF
>    ac_status=$?
>    printf "%s\n" "$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'
> +     && { ac_try='${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -shared -nostdlib -fPIC -o conftest2.so conftest2.S'
>    { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
>    (eval $ac_try) 2>&5
>    ac_status=$?
> diff --git a/sysdeps/loongarch/configure.ac b/sysdeps/loongarch/configure.ac
> index 39efccfd8f..ba89d8346d 100644
> --- a/sysdeps/loongarch/configure.ac
> +++ b/sysdeps/loongarch/configure.ac
> @@ -42,7 +42,7 @@ EOF
>    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([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -shared -nostdlib -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
>      libc_cv_static_pie_on_loongarch=yes

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

end of thread, other threads:[~2023-08-03 13:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-03  8:35 [PATCH] LoongArch: Fix static PIE condition for toolchain bootstrapping Yang Yujie
2023-08-03 13:35 ` Adhemerval Zanella Netto

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).