From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ua1-x92e.google.com (mail-ua1-x92e.google.com [IPv6:2607:f8b0:4864:20::92e]) by sourceware.org (Postfix) with ESMTPS id 005E93858406 for ; Mon, 22 Nov 2021 17:54:15 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 005E93858406 Received: by mail-ua1-x92e.google.com with SMTP id t13so38216189uad.9 for ; Mon, 22 Nov 2021 09:54:15 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=Jc2WZX8THNhamHxaqCmUuX97vRQrWu6Im01wav2s7YM=; b=km9mkhid5pb4WARM0N0TA8seiAoz9pqtllRFvSUz+gRh/424ufqgB1FSNfvqEnUlyv 7XxSYXNYZm8nPln7gitpK808EGwOEwTJ6lXv/6q1S93yiaJMylNgXm1U0DX9k8egTFxn 2pV9QuiW11UDUXCzOGxKytOPue3hX1phOUTjSyDUlhaJX1ledk7KjiC1gwmy7oLb94/z OHnFXm2Dy4D3mfXkcTX9atpi60d4lScHp3eWi9ImQmUNOHqyMQl/kcncqWs9jNAzYzQ8 5la3FIVpeG1118lH8kFEIYdAZsht5Nw2GrfaUtVt1k5UiV5h4LkeWZ4GsKaEoG9vuqY9 xZGg== X-Gm-Message-State: AOAM530vLxDcLm2voB0ik8R4cS+PeIC/ENP6WnoMxCoCaFb9wNWGRl4k JLsQzXptrGDgMuM52yXoTJmuqA== X-Google-Smtp-Source: ABdhPJzzN4Eb9knLvuSxvpw/LmKaj97bS2txoTQDwlqxYRdUUyop0kyT5yyFaKHnKBY0ol8XrxcJlw== X-Received: by 2002:ab0:6eca:: with SMTP id c10mr89182173uav.118.1637603655453; Mon, 22 Nov 2021 09:54:15 -0800 (PST) Received: from ?IPV6:2804:431:c7cb:e054:bce6:bc54:280c:f077? ([2804:431:c7cb:e054:bce6:bc54:280c:f077]) by smtp.gmail.com with ESMTPSA id r13sm4757475vkl.13.2021.11.22.09.54.14 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 22 Nov 2021 09:54:15 -0800 (PST) Message-ID: <00d2e9c8-6018-c8ad-4306-09526376c74c@linaro.org> Date: Mon, 22 Nov 2021 14:54:12 -0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.3.1 Subject: Re: [PATCH] powerpc: Define USE_PPC64_NOTOC iff compiler and linker also supports it Content-Language: en-US To: Tulio Magno Quites Machado Filho , libc-alpha@sourceware.org Cc: Fangrui Song , Nemanja Ivanovic References: <20211108113316.8867-1-adhemerval.zanella@linaro.org> <87pmqwywf8.fsf@linux.ibm.com> From: Adhemerval Zanella In-Reply-To: <87pmqwywf8.fsf@linux.ibm.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-13.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Nov 2021 17:54:20 -0000 On 19/11/2021 12:52, Tulio Magno Quites Machado Filho wrote: > Adhemerval Zanella via Libc-alpha 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 <> +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 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?