linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] powerpc/boot: request no dynamic linker for boot wrapper
@ 2016-11-28  1:42 Nicholas Piggin
  2016-11-28  2:26 ` Alan Modra
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Nicholas Piggin @ 2016-11-28  1:42 UTC (permalink / raw)
  To: Michael Ellerman
  Cc: Nicholas Piggin, linuxppc-dev, Anton Blanchard, Alan Modra

The boot wrapper performs its own relocations and does not require
PT_INTERP segment.

Without this option, binutils 2.28 and newer tries to create a program
header segment due to PT_INTERP, and the link fails because there is no
space for it.

   A recent binutils commit:
   https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff;h=1a9ccd70f9a75dc6b48d340059f28ef3550c107b
   has broken kernel builds:

     ld: arch/powerpc/boot/zImage.pseries: Not enough room for program headers, try linking with -N
     ld: final link failed: Bad value

Reported-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
---

Hi,

I think this should do the trick (zImage.pseries compiles and boots
mambo here, haven't tested zImage.epapr). Cc'ing Alan just in case :)

Thanks,
Nick

 arch/powerpc/boot/wrapper | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/boot/wrapper b/arch/powerpc/boot/wrapper
index 404b3aa..cd941a8 100755
--- a/arch/powerpc/boot/wrapper
+++ b/arch/powerpc/boot/wrapper
@@ -181,6 +181,13 @@ case "$elfformat" in
     elf32-powerpc)	format=elf32ppc	;;
 esac
 
+# Do not include PT_INTERP segment when linking pie. Non-pie linking
+# just ignores this option.
+LD_VERSION=$(${CROSS}ld --version | $srctree/scripts/ld-version.sh)
+LD_NO_DL_MIN_VERSION=$(echo 2.26 | $srctree/scripts/ld-version.sh)
+if [ "$LD_VERSION" -ge "$LD_NO_DL_MIN_VERSION" ] ; then
+	nodl="--no-dynamic-linker"
+fi
 
 platformo=$object/"$platform".o
 lds=$object/zImage.lds
@@ -446,7 +453,7 @@ if [ "$platform" != "miboot" ]; then
         text_start="-Ttext $link_address"
     fi
 #link everything
-    ${CROSS}ld -m $format -T $lds $text_start $pie -o "$ofile" \
+    ${CROSS}ld -m $format -T $lds $text_start $pie $nodl -o "$ofile" \
 	$platformo $tmp $object/wrapper.a
     rm $tmp
 fi
-- 
2.10.2

^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2016-12-05  7:47 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-11-28  1:42 [PATCH] powerpc/boot: request no dynamic linker for boot wrapper Nicholas Piggin
2016-11-28  2:26 ` Alan Modra
2016-11-28 11:07 ` Michael Ellerman
2016-11-28 12:07   ` Nicholas Piggin
2016-11-28 12:39     ` Nick Clifton
2016-11-28 13:02       ` Nicholas Piggin
2016-11-28 14:25         ` Nick Clifton
2016-11-29  1:49           ` Nicholas Piggin
2016-11-29  3:42     ` Michael Ellerman
2016-11-30 17:47       ` Gustavo Luiz Duarte
2016-12-05  7:47 ` Michael Ellerman

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).