From patchwork Mon Nov 28 01:42:26 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicholas Piggin X-Patchwork-Id: 699815 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3tRqGY3sYTz9s9c for ; Mon, 28 Nov 2016 12:44:05 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="VsTrD/49"; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3tRqGY2mbGzDvnY for ; Mon, 28 Nov 2016 12:44:05 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="VsTrD/49"; dkim-atps=neutral X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Received: from mail-pg0-x241.google.com (mail-pg0-x241.google.com [IPv6:2607:f8b0:400e:c05::241]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3tRqDy0h0gzDrHj for ; Mon, 28 Nov 2016 12:42:42 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="VsTrD/49"; dkim-atps=neutral Received: by mail-pg0-x241.google.com with SMTP id 3so11554293pgd.0 for ; Sun, 27 Nov 2016 17:42:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=aUnkMK8bCeJpkWqn8cXAFTOCftUH29EQ6wkwDcULG+4=; b=VsTrD/49cers2wAUYa08Y3bsZ7A82nLflKr0BRmjY435/lqo7ummPFwGCoM8E72D3x j68oZgkp73PyQPO/kqsnxIWLE38PziML5KfVJBvg7mnhgWTEcfiLZtAtOfxt/af65DwG K6RqQFDz6t8rPgGvUCeDvp7Fht8wxyPw3ygeh/3QFYVXdA1LnXuIuV1HlWl2vCyn5RmL Tra5VzOhKiKsvuETd0t/dmxdeK5j5LdXz5Q5+LorauN3ruZ5lDcqtm13ZXUtae5K3F0d iZdqpBYiSjOj/pZ61Rmtd8sZQSkPZrFGwS5SZd5n4PPzCG9PIGwU6/316Pt9GM64QG85 4AEQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=aUnkMK8bCeJpkWqn8cXAFTOCftUH29EQ6wkwDcULG+4=; b=Ri8WmCD58Hm0Wi4KXndmmKxc6CYuM7KHzzKw0UXKJvb/x/RvivAySR+X70GKNUfXdi 63Eo+TqeZn4E6HN74Xv0TFqipJKjn385upLRgydCO5l7lydHyivw413/gIxOaD2aZyEM aThJCDfmEvoqgvkKM4fXRY32dKZ0VyUomk2y3Th1wNfeIqWhDsmOFbIQE2Rzyo7aMUaP pW5PPeASZbYQyRCZt23b7AP8P6PtZceNjQ/j6JHnJ0iVriDdcYXRF9j0YOTx1MYIyrI+ Rk9oe8U1/lyTCagsIjs/4YpLuoa6EOwjlhhuy92rqki/OhMMectgLu2GCksVmPszAjg2 HbkQ== X-Gm-Message-State: AKaTC02tl7xdioYSNRqMwOPtMZ4RFQYnc6bDJ6Tu2TmzTxd4wdAXdR3oIP5Ts/K1qmFkxg== X-Received: by 10.84.143.68 with SMTP id 62mr29229713ply.63.1480297360438; Sun, 27 Nov 2016 17:42:40 -0800 (PST) Received: from roar.au.ibm.com (27-33-21-189.tpgi.com.au. [27.33.21.189]) by smtp.gmail.com with ESMTPSA id b126sm82515980pfg.90.2016.11.27.17.42.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 27 Nov 2016 17:42:39 -0800 (PST) From: Nicholas Piggin To: Michael Ellerman Subject: [PATCH] powerpc/boot: request no dynamic linker for boot wrapper Date: Mon, 28 Nov 2016 12:42:26 +1100 Message-Id: <20161128014226.7656-1-npiggin@gmail.com> X-Mailer: git-send-email 2.10.2 X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linuxppc-dev@lists.ozlabs.org, Anton Blanchard , Nicholas Piggin , Alan Modra Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" 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 Signed-off-by: Nicholas Piggin --- 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