linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Bill Wendling <morbo@google.com>
To: Michael Ellerman <mpe@ellerman.id.au>, linuxppc-dev@lists.ozlabs.org
Cc: Nick Desaulniers <ndesaulniers@google.com>,
	Bill Wendling <morbo@google.com>,
	Fangrui Song <maskray@google.com>, Alan Modra <amodra@gmail.com>
Subject: [PATCH 1/3] powerpc/wrapper: add "-z notext" flag to disable diagnostic
Date: Fri, 20 Nov 2020 14:40:32 -0800	[thread overview]
Message-ID: <20201120224034.191382-2-morbo@google.com> (raw)
In-Reply-To: <20201120224034.191382-1-morbo@google.com>

The "-z notext" flag disables reporting an error if DT_TEXTREL is set.

  ld.lld: error: can't create dynamic relocation R_PPC64_ADDR64 against
    symbol: _start in readonly segment; recompile object files with
    -fPIC or pass '-Wl,-z,notext' to allow text relocations in the
    output
  >>> defined in
  >>> referenced by crt0.o:(.text+0x8) in archive arch/powerpc/boot/wrapper.a

The BFD linker disables this by default (though it's configurable in
current versions). LLD enables this by default. So we add the flag to
keep LLD from emitting the error.

Cc: Fangrui Song <maskray@google.com>
Cc: Alan Modra <amodra@gmail.com>
Signed-off-by: Bill Wendling <morbo@google.com>
---
 arch/powerpc/boot/wrapper | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/boot/wrapper b/arch/powerpc/boot/wrapper
index e1194955adbb..41fa0a8715e3 100755
--- a/arch/powerpc/boot/wrapper
+++ b/arch/powerpc/boot/wrapper
@@ -46,6 +46,7 @@ compression=.gz
 uboot_comp=gzip
 pie=
 format=
+notext=
 rodynamic=
 
 # cross-compilation prefix
@@ -354,6 +355,7 @@ epapr)
     platformo="$object/pseries-head.o $object/epapr.o $object/epapr-wrapper.o"
     link_address='0x20000000'
     pie=-pie
+    notext='-z notext'
     rodynamic=$(if ${CROSS}ld -V 2>&1 | grep -q LLD ; then echo "-z rodynamic"; fi)
     ;;
 mvme5100)
@@ -495,7 +497,7 @@ if [ "$platform" != "miboot" ]; then
         text_start="-Ttext $link_address"
     fi
 #link everything
-    ${CROSS}ld -m $format -T $lds $text_start $pie $nodl $rodynamic -o "$ofile" $map \
+    ${CROSS}ld -m $format -T $lds $text_start $pie $nodl $rodynamic $notext -o "$ofile" $map \
 	$platformo $tmp $object/wrapper.a
     rm $tmp
 fi
-- 
2.29.2.454.gaff20da3a2-goog


  reply	other threads:[~2020-11-20 22:48 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-17  0:47 [PATCH 0/2] Fixes for clang/lld Bill Wendling
2020-10-17  0:47 ` [PATCH 1/2] powerpc/wrapper: Add "-z notext" flag to disable diagnostic Bill Wendling
2020-10-17  0:47 ` [PATCH 2/2] powerpc/boot: Use clang when CC is clang Bill Wendling
2020-11-18 22:35   ` [PATCH 0/3] PPC: fixes for clang support Bill Wendling
2020-11-20 22:40     ` [PATCH v3 " Bill Wendling
2020-11-20 22:40       ` Bill Wendling [this message]
2020-11-20 22:40       ` [PATCH v3 2/3] powerpc/boot: Use clang when CC is clang Bill Wendling
2020-11-20 22:40       ` [PATCH v3 3/3] powerpc/64s: feature: Work around inline asm issues Bill Wendling
2020-11-23  5:44         ` Michael Ellerman
2020-11-23  6:34           ` Segher Boessenkool
2020-11-23 19:43             ` Bill Wendling
2020-11-23 19:53               ` Bill Wendling
2020-11-23 19:56               ` Segher Boessenkool
2020-11-23 20:01                 ` Bill Wendling
2020-11-23 20:08                   ` Segher Boessenkool
2020-11-23 20:17                     ` Bill Wendling
2020-11-24  3:43                       ` Michael Ellerman
2020-11-25  5:13                         ` Bill Wendling
2020-11-27  1:03                           ` Michael Ellerman
2020-11-27  1:10                             ` Bill Wendling
2020-11-27  1:59                             ` Bill Wendling
2020-11-18 22:35   ` [PATCH 1/3] powerpc/wrapper: add "-z notext" flag to disable diagnostic Bill Wendling
2020-11-18 22:35   ` [PATCH 2/3] powerpc/boot: Use clang when CC is clang Bill Wendling
2020-11-18 22:35   ` [PATCH 3/3] powerpc/64s: feature: work around inline asm issues Bill Wendling

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=20201120224034.191382-2-morbo@google.com \
    --to=morbo@google.com \
    --cc=amodra@gmail.com \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=maskray@google.com \
    --cc=mpe@ellerman.id.au \
    --cc=ndesaulniers@google.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 NNTP newsgroup(s).