[3/3] Check if linker also support -mtls-dialect=gnu2

Message ID 20211026200346.3371750-4-adhemerval.zanella@linaro.org
State Committed
Commit 04e8169f1d0397b1ffc77fbb49f4344f1ae53a82
Headers
Series Improve lld support and current status |

Checks

Context Check Description
dj/TryBot-apply_patch success Patch applied to master at the time it was sent
dj/TryBot-32bit success Build for i686

Commit Message

Adhemerval Zanella Oct. 26, 2021, 8:03 p.m. UTC
  Since some linkers (for instance lld for i386) does not support it
for all architectures.

Checked on i686-linux-gnu.
---
 configure    | 4 ++--
 configure.ac | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)
  

Comments

Fangrui Song Oct. 27, 2021, 2:04 a.m. UTC | #1
On Tue, Oct 26, 2021 at 1:03 PM Adhemerval Zanella
<adhemerval.zanella@linaro.org> wrote:
>
> Since some linkers (for instance lld for i386) does not support it
> for all architectures.
>
> Checked on i686-linux-gnu.
> ---
>  configure    | 4 ++--
>  configure.ac | 4 ++--
>  2 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/configure b/configure
> index 2a28c58cd6..c66082232e 100755
> --- a/configure
> +++ b/configure
> @@ -6324,8 +6324,8 @@ void foo (void)
>    i = 10;
>  }
>  EOF
> -if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS -S -fPIC -mtls-dialect=gnu2
> -                  conftest.c 1>&5'
> +if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS -fPIC -mtls-dialect=gnu2 -nostdlib -nostartfiles
> +                  conftest.c -o conftest 1>&5'
>    { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
>    (eval $ac_try) 2>&5
>    ac_status=$?
> diff --git a/configure.ac b/configure.ac
> index 00f49f09f7..7eb4239359 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -1493,8 +1493,8 @@ void foo (void)
>    i = 10;
>  }
>  EOF
> -if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -S -fPIC -mtls-dialect=gnu2
> -                  conftest.c 1>&AS_MESSAGE_LOG_FD])
> +if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -fPIC -mtls-dialect=gnu2 -nostdlib -nostartfiles
> +                  conftest.c -o conftest 1>&AS_MESSAGE_LOG_FD])
>  then
>    libc_cv_mtls_dialect_gnu2=yes
>  else
> --
> 2.32.0
>

Looks good to me.

I'll add R_386_TLS_DESC support to LLD with https://reviews.llvm.org/D112582
  
Fangrui Song Oct. 29, 2021, 12:56 a.m. UTC | #2
On Tue, Oct 26, 2021 at 7:04 PM Fāng-ruì Sòng <maskray@google.com> wrote:
>
> On Tue, Oct 26, 2021 at 1:03 PM Adhemerval Zanella
> <adhemerval.zanella@linaro.org> wrote:
> >
> > Since some linkers (for instance lld for i386) does not support it
> > for all architectures.
> >
> > Checked on i686-linux-gnu.
> > ---
> >  configure    | 4 ++--
> >  configure.ac | 4 ++--
> >  2 files changed, 4 insertions(+), 4 deletions(-)
> >
> > diff --git a/configure b/configure
> > index 2a28c58cd6..c66082232e 100755
> > --- a/configure
> > +++ b/configure
> > @@ -6324,8 +6324,8 @@ void foo (void)
> >    i = 10;
> >  }
> >  EOF
> > -if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS -S -fPIC -mtls-dialect=gnu2
> > -                  conftest.c 1>&5'
> > +if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS -fPIC -mtls-dialect=gnu2 -nostdlib -nostartfiles
> > +                  conftest.c -o conftest 1>&5'
> >    { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
> >    (eval $ac_try) 2>&5
> >    ac_status=$?
> > diff --git a/configure.ac b/configure.ac
> > index 00f49f09f7..7eb4239359 100644
> > --- a/configure.ac
> > +++ b/configure.ac
> > @@ -1493,8 +1493,8 @@ void foo (void)
> >    i = 10;
> >  }
> >  EOF
> > -if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -S -fPIC -mtls-dialect=gnu2
> > -                  conftest.c 1>&AS_MESSAGE_LOG_FD])
> > +if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -fPIC -mtls-dialect=gnu2 -nostdlib -nostartfiles
> > +                  conftest.c -o conftest 1>&AS_MESSAGE_LOG_FD])
> >  then
> >    libc_cv_mtls_dialect_gnu2=yes
> >  else
> > --
> > 2.32.0
> >
>
> Looks good to me.
>
> I'll add R_386_TLS_DESC support to LLD with https://reviews.llvm.org/D112582

Reviewed-by: Fangrui Song <maskray@google.com>

I pushed https://reviews.llvm.org/D112582 as a maintainer of lld/ELF.

You can say that LLD before 14 did not support x86-32 TLSDESC.
  

Patch

diff --git a/configure b/configure
index 2a28c58cd6..c66082232e 100755
--- a/configure
+++ b/configure
@@ -6324,8 +6324,8 @@  void foo (void)
   i = 10;
 }
 EOF
-if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS -S -fPIC -mtls-dialect=gnu2
-		   conftest.c 1>&5'
+if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS -fPIC -mtls-dialect=gnu2 -nostdlib -nostartfiles
+		   conftest.c -o conftest 1>&5'
   { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
   (eval $ac_try) 2>&5
   ac_status=$?
diff --git a/configure.ac b/configure.ac
index 00f49f09f7..7eb4239359 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1493,8 +1493,8 @@  void foo (void)
   i = 10;
 }
 EOF
-if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -S -fPIC -mtls-dialect=gnu2
-		   conftest.c 1>&AS_MESSAGE_LOG_FD])
+if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -fPIC -mtls-dialect=gnu2 -nostdlib -nostartfiles
+		   conftest.c -o conftest 1>&AS_MESSAGE_LOG_FD])
 then
   libc_cv_mtls_dialect_gnu2=yes
 else