diff mbox series

[1/2] powerpc/wrapper: Add "-z notext" flag to disable diagnostic

Message ID 20201017004752.415054-2-morbo@google.com (mailing list archive)
State Superseded
Headers show
Series Fixes for clang/lld | expand

Checks

Context Check Description
snowpatch_ozlabs/apply_patch success Successfully applied on branch powerpc/merge (4fa6f5d55f64e974784cfc8f38312d48479a4323)
snowpatch_ozlabs/checkpatch warning total: 0 errors, 1 warnings, 0 checks, 24 lines checked
snowpatch_ozlabs/needsstable success Patch has no Fixes tags

Commit Message

Bill Wendling Oct. 17, 2020, 12:47 a.m. UTC
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 | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/arch/powerpc/boot/wrapper b/arch/powerpc/boot/wrapper
index cd58a62e810d..e576d3e4b23f 100755
--- a/arch/powerpc/boot/wrapper
+++ b/arch/powerpc/boot/wrapper
@@ -46,6 +46,7 @@  compression=.gz
 uboot_comp=gzip
 pie=
 format=
+notext=
 
 # cross-compilation prefix
 CROSS=
@@ -353,6 +354,7 @@  epapr)
     platformo="$object/pseries-head.o $object/epapr.o $object/epapr-wrapper.o"
     link_address='0x20000000'
     pie=-pie
+    notext='-z notext'
     ;;
 mvme5100)
     platformo="$object/fixed-head.o $object/mvme5100.o"
@@ -493,8 +495,8 @@  if [ "$platform" != "miboot" ]; then
         text_start="-Ttext $link_address"
     fi
 #link everything
-    ${CROSS}ld -m $format -T $lds $text_start $pie $nodl -o "$ofile" $map \
-	$platformo $tmp $object/wrapper.a
+    ${CROSS}ld -m $format -T $lds $text_start $pie $notext $nodl -o "$ofile" \
+        $map $platformo $tmp $object/wrapper.a
     rm $tmp
 fi