[linux] 01/06: [powerpc*] boot: Request no dynamic linker for boot wrapper

debian-kernel at lists.debian.org debian-kernel at lists.debian.org
Mon Jan 2 03:42:49 UTC 2017


This is an automated email from the git hooks/post-receive script.

benh pushed a commit to branch sid
in repository linux.

commit bc0de8a222c9b4e29f615e29f17ba0b62a4b2dd0
Author: Ben Hutchings <ben at decadent.org.uk>
Date:   Mon Jan 2 03:09:22 2017 +0000

    [powerpc*] boot: Request no dynamic linker for boot wrapper
    
    Closes: #848851, FTBFS on ppc6el
---
 debian/changelog                                   |  2 +
 ...t-request-no-dynamic-linker-for-boot-wrap.patch | 70 ++++++++++++++++++++++
 debian/patches/series                              |  1 +
 3 files changed, 73 insertions(+)

diff --git a/debian/changelog b/debian/changelog
index 1b985b7..fdcf7cc 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -6,6 +6,8 @@ linux (4.8.15-2) UNRELEASED; urgency=medium
     asciidoc-base, so we don't pull in LaTeX unnecessarily
   * [x86] Enable LEDS_DELL_NETBOOKS and DELL_SMBIOS as modules; re-enable
     DELL_LAPTOP and DELL_WMI as modules (Closes: #849674)
+  * [powerpc*] boot: Request no dynamic linker for boot wrapper
+    (Closes: #848851, FTBFS on ppc6el)
 
   [ Salvatore Bonaccorso ]
   * sg_write()/bsg_write() is not fit to be called under KERNEL_DS
diff --git a/debian/patches/bugfix/powerpc/powerpc-boot-request-no-dynamic-linker-for-boot-wrap.patch b/debian/patches/bugfix/powerpc/powerpc-boot-request-no-dynamic-linker-for-boot-wrap.patch
new file mode 100644
index 0000000..22fff5b
--- /dev/null
+++ b/debian/patches/bugfix/powerpc/powerpc-boot-request-no-dynamic-linker-for-boot-wrap.patch
@@ -0,0 +1,70 @@
+From: Nicholas Piggin <npiggin at gmail.com>
+Date: Mon, 28 Nov 2016 12:42:26 +1100
+Subject: powerpc/boot: Request no dynamic linker for boot wrapper
+Origin: https://git.kernel.org/linus/ff45000fcb56b5b0f1a14a865d3541746d838a0a
+Bug-Debian: https://bugs.debian.org/848851
+
+The boot wrapper performs its own relocations and does not require
+PT_INTERP segment. However currently we don't tell the linker that.
+
+Prior to binutils 2.28 that works OK. But since binutils commit
+1a9ccd70f9a7 ("Fix the linker so that it will not silently generate ELF
+binaries with invalid program headers. Fix readelf to report such
+invalid binaries.") binutils tries to create a program header segment
+due to PT_INTERP, and the link fails because there is no space for it:
+
+  ld: arch/powerpc/boot/zImage.pseries: Not enough room for program headers, try linking with -N
+  ld: final link failed: Bad value
+
+So tell the linker not to do that, by passing --no-dynamic-linker.
+
+Cc: stable at vger.kernel.org
+Reported-by: Anton Blanchard <anton at samba.org>
+Signed-off-by: Nicholas Piggin <npiggin at gmail.com>
+[mpe: Drop dependency on ld-version.sh and massage change log]
+Signed-off-by: Michael Ellerman <mpe at ellerman.id.au>
+[bwh: Backported to 4.8: adjust context]
+---
+ arch/powerpc/boot/wrapper | 24 +++++++++++++++++++++++-
+ 1 file changed, 23 insertions(+), 1 deletion(-)
+
+--- a/arch/powerpc/boot/wrapper
++++ b/arch/powerpc/boot/wrapper
+@@ -161,6 +161,28 @@ case "$elfformat" in
+     elf32-powerpc)	format=elf32ppc	;;
+ esac
+ 
++ld_version()
++{
++    # Poached from scripts/ld-version.sh, but we don't want to call that because
++    # this script (wrapper) is distributed separately from the kernel source.
++    # Extract linker version number from stdin and turn into single number.
++    awk '{
++	gsub(".*\\)", "");
++	gsub(".*version ", "");
++	gsub("-.*", "");
++	split($1,a, ".");
++	print a[1]*100000000 + a[2]*1000000 + a[3]*10000;
++	exit
++    }'
++}
++
++# Do not include PT_INTERP segment when linking pie. Non-pie linking
++# just ignores this option.
++LD_VERSION=$(${CROSS}ld --version | ld_version)
++LD_NO_DL_MIN_VERSION=$(echo 2.26 | ld_version)
++if [ "$LD_VERSION" -ge "$LD_NO_DL_MIN_VERSION" ] ; then
++	nodl="--no-dynamic-linker"
++fi
+ 
+ platformo=$object/"$platform".o
+ lds=$object/zImage.lds
+@@ -417,7 +439,7 @@ if [ "$platform" != "miboot" ]; then
+     if [ -n "$link_address" ] ; then
+         text_start="-Ttext $link_address"
+     fi
+-    ${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
diff --git a/debian/patches/series b/debian/patches/series
index c7ac9b3..e4547f2 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -47,6 +47,7 @@ debian/fanotify-taint-on-use-of-fanotify_access_permissions.patch
 
 # Arch bug fixes
 bugfix/arm64/arm64-mm-limit-task_size_64-for-compatibility.patch
+bugfix/powerpc/powerpc-boot-request-no-dynamic-linker-for-boot-wrap.patch
 
 # Arch features
 features/mips/MIPS-increase-MAX-PHYSMEM-BITS-on-Loongson-3-only.patch

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/kernel/linux.git



More information about the Kernel-svn-changes mailing list