public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Adhemerval Zanella <adhemerval.zanella@linaro.org>
To: Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com>,
	libc-alpha@sourceware.org
Cc: Fangrui Song <maskray@google.com>,
	Nemanja Ivanovic <nemanjai@ca.ibm.com>
Subject: Re: [PATCH] powerpc: Define USE_PPC64_NOTOC iff compiler and linker also supports it
Date: Mon, 22 Nov 2021 14:54:12 -0300	[thread overview]
Message-ID: <00d2e9c8-6018-c8ad-4306-09526376c74c@linaro.org> (raw)
In-Reply-To: <87pmqwywf8.fsf@linux.ibm.com>



On 19/11/2021 12:52, Tulio Magno Quites Machado Filho wrote:
> Adhemerval Zanella via Libc-alpha <libc-alpha@sourceware.org> writes:
> 
>> diff --git a/sysdeps/powerpc/powerpc64/configure.ac b/sysdeps/powerpc/powerpc64/configure.ac
>> index b77156f696..05f0000807 100644
>> --- a/sysdeps/powerpc/powerpc64/configure.ac
>> +++ b/sysdeps/powerpc/powerpc64/configure.ac
>> @@ -22,13 +22,22 @@ if test x$libc_cv_overlapping_opd = xyes; then
>>    AC_DEFINE(USE_PPC64_OVERLAPPING_OPD)
>>  fi
>>  
>> -# @notoc started to be supported in GNU Binutils 2.31.
>> -AC_CACHE_CHECK([if the assembler supports @notoc],
>> -	       libc_cv_ppc64_notoc, [
>> -	       AC_COMPILE_IFELSE([AC_LANG_SOURCE([
>> -void foo (void) {asm("b foo@notoc");}
>> -		  ])],
>> -		  [libc_cv_ppc64_notoc=yes],
>> -		  [libc_cv_ppc64_notoc=no])])
>> +# We check if compiler supports @notoc generation since there is no
>> +# gain by enabling it if it will be optimized away by the linker.
>> +# It also helps linkers that might not optimize it and end up
>> +# generating stubs with ISA 3.1 instruction even targetting older ISA.
>> +AC_CACHE_CHECK([if the compiler supports @notoc],
>> +	       libc_cv_ppc64_notoc, [dnl
>> +  cat > conftest.c <<EOF
>> +int bar (void);
>> +int foo (void) { return bar () + 1; }
>> +EOF
>> +  libc_cv_ppc64_notoc=no
>> +  if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -S -o conftest.s conftest.c]) \
> 
> In order to use the -mcpu flag set via --with-cpu=power10, this command should be:
> 
>     ${CC-cc} $libc_cv_cc_submachine $CFLAGS $CPPFLAGS -S -o conftest.s conftest.c
> 
> LGTM with that fix.
> 
> Reviewed-by: Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com>

Ack.

> 
> Notice that I'm still not able to complete building the tests using lld 13.0 on
> powerpc64le after this patch.  I've seen 2 issues:
> 
> 1. Some distributions modify the version output, causing an error when parsing
>    LLD's version, e.g.
> 
>     $ ld.lld --version
>     Debian LLD 13.0.0 (compatible with GNU linkers)

I am using the provided package from llvm.org itself, where it returns:

$ ld.lld --version
LLD 13.0.0 (https://github.com/llvm/llvm-project/ 24c8eaec9467b2aaf70b0db33a4e4dd415139a50) (compatible with GNU linkers)

And I could build everything, including tests, for default (no --with-cpu),
and with --with-cpu=power8 and --with-cpu=power9.  The --with-cpu=power10
still shows same issues while linking the loader:

ld.lld: error: ../sysdeps/powerpc/powerpc64/dl-trampoline.S:55:(.text+0x29AE4): call to save__dl_fixup lacks nop, can't restore toc
ld.lld: error: ../sysdeps/powerpc/powerpc64/dl-trampoline.S:286:(.text+0x29C58): call to save__dl_profile_fixup lacks nop, can't restore toc
ld.lld: error: ../sysdeps/powerpc/powerpc64/dl-trampoline.S:455:(.text+0x29E78): call to save__dl_call_pltexit lacks nop, can't restore toc
collect2: error: ld returned 1 exit status

Which I am not sure it is something related to lld or something we should
fix on glibc.

> 
> The following change to the case test in configure fixes this issue:
> 
> -  "LLD"*)
> +  *"LLD"*)
> 
> Is this a GNU Bash-ism?

I think Debian is patching LLD, so we will need to support anything before
"LLD" string.

> 
> 
> 2. LLD itself crashes while linking the tests.
>    I need to collect more details.
> 

Do you have a log of what is happening? Could it be something related to the
debian provided LLD? Could you check with the official package?

  reply	other threads:[~2021-11-22 17:54 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-08 11:33 Adhemerval Zanella
2021-11-08 22:48 ` Fangrui Song
2021-11-09 11:05   ` Alan Modra
2021-11-16 19:42     ` Tulio Magno Quites Machado Filho
2021-11-16 20:20       ` Tulio Magno Quites Machado Filho
2021-11-16 20:48         ` Florian Weimer
2021-11-16 22:12           ` Fāng-ruì Sòng
2021-11-16 22:46           ` Bill Schmidt
2021-11-17  2:16       ` Alan Modra
2021-11-17  2:30         ` Alan Modra
2021-11-09 13:03   ` Adhemerval Zanella
2021-11-09 17:44     ` Fangrui Song
2021-11-09 18:44       ` Adhemerval Zanella
2021-11-19 15:52 ` Tulio Magno Quites Machado Filho
2021-11-22 17:54   ` Adhemerval Zanella [this message]
2021-11-25 17:02     ` Tulio Magno Quites Machado Filho
2021-11-25 17:16       ` Adhemerval Zanella

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=00d2e9c8-6018-c8ad-4306-09526376c74c@linaro.org \
    --to=adhemerval.zanella@linaro.org \
    --cc=libc-alpha@sourceware.org \
    --cc=maskray@google.com \
    --cc=nemanjai@ca.ibm.com \
    --cc=tuliom@linux.ibm.com \
    /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: link
Be 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).