From patchwork Fri Dec 16 04:53:30 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Joel Stanley X-Patchwork-Id: 88263 Delivered-To: patch@linaro.org Received: by 10.182.112.6 with SMTP id im6csp88223obb; Thu, 15 Dec 2016 22:20:15 -0800 (PST) X-Received: by 10.194.122.65 with SMTP id lq1mr1147714wjb.12.1481869215374; Thu, 15 Dec 2016 22:20:15 -0800 (PST) Return-Path: Received: from theia.denx.de (theia.denx.de. [85.214.87.163]) by mx.google.com with ESMTP id 199si1881332wmm.166.2016.12.15.22.20.15; Thu, 15 Dec 2016 22:20:15 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 85.214.87.163 as permitted sender) client-ip=85.214.87.163; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 85.214.87.163 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 5F7DA4BDBD; Fri, 16 Dec 2016 07:20:11 +0100 (CET) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id LMh0UrVSujY2; Fri, 16 Dec 2016 07:20:11 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 615C5A75CD; Fri, 16 Dec 2016 07:20:06 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 2F3E04B99D for ; Fri, 16 Dec 2016 05:53:55 +0100 (CET) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 38LnmS9UEMZO for ; Fri, 16 Dec 2016 05:53:55 +0100 (CET) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mail-pg0-f68.google.com (mail-pg0-f68.google.com [74.125.83.68]) by theia.denx.de (Postfix) with ESMTPS id A8A194B98B for ; Fri, 16 Dec 2016 05:53:50 +0100 (CET) Received: by mail-pg0-f68.google.com with SMTP id a1so1346084pgf.3 for ; Thu, 15 Dec 2016 20:53:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=jnFeEwln3xFjwZLFzwYdxINHY2D4iRV1tbJJKqiXP5s=; b=IbTrktu2fDeMjQCVPlCLBHRPuferoDLe0xIklpBL+JKnUlFEhNOZPrFIL1MHA+Xpfa 2NSiG4z+gaxprD8Uz9lkxPiasrjLuMoav7PTtuSthYKJYUz2q8r0mLc8lp3EZv6gMjAg kfce4quNiqUPetfCizR5EQsKx+IBVzndwck7XO/3/FFZ/eZoodpXksVTARw2vYnlzhBy 7V2wiZNDtlO374jxMg39hKXfHelCdBg7VW4CZH1w6qJeF3bDZoB7MT9pFV3kyarwTkE3 +RpQ+zCrOUIV2gSOcNhagMGn57KQQ7iM11PSiLKInYiJCHGVsQUrfxMN17GWcNM82tnY zBng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :mime-version:content-transfer-encoding; bh=jnFeEwln3xFjwZLFzwYdxINHY2D4iRV1tbJJKqiXP5s=; b=t+64mKmtMWCr+seNm5V0PMeADoVnjAd/Mn9olt9YF1WODuB0r6kJoluCriRUDJMmPo zjek7tSIODXJ9fwtlHN5aap8qafMV6UghFSZbv7Hww+GCFDwUV1Dy/DIpCMFMlqbrN3O h9WttuNF71zbDlZnBsQ97kKkSEgiYMOb7n1wA/v3IWx8UY109/sJSBeFb2c+krXgNp03 BDcS3LmZnrpcV3Y1lg14EtQDk+64o1mUXYCluvqk6Gy0nFzF/bx8cRVczosOb8W4Wx95 9kQkvtxEMoE1UxjXxH70xZSF+f2YcH24fzsbioRCMM+PicVKfTJzu5jVdIET/4kGoNLB djCw== X-Gm-Message-State: AKaTC01XNhSvIi/Izj54vZng1LtDrU21g/XIJhyS+D54yGjNkhMaYvEJ/yzS4ThLNxtX6Q== X-Received: by 10.84.176.100 with SMTP id u91mr2604453plb.7.1481864028427; Thu, 15 Dec 2016 20:53:48 -0800 (PST) Received: from aurora.jms.id.au ([203.0.153.9]) by smtp.gmail.com with ESMTPSA id r124sm8008106pgr.6.2016.12.15.20.53.43 (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 15 Dec 2016 20:53:46 -0800 (PST) Received: by aurora.jms.id.au (sSMTP sendmail emulation); Fri, 16 Dec 2016 15:23:40 +1030 From: Joel Stanley To: u-boot@lists.denx.de Date: Fri, 16 Dec 2016 15:23:30 +1030 Message-Id: <20161216045330.31257-1-joel@jms.id.au> X-Mailer: git-send-email 2.11.0 MIME-Version: 1.0 X-Mailman-Approved-At: Fri, 16 Dec 2016 07:20:03 +0100 Cc: npiggin@gmail.com, amodra@gmail.com Subject: [U-Boot] [PATCH v2] Makefile: Fix linking with modern binutils X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.15 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Since Binutils 1a9ccd70f9a7[1] u-boot will not link targets that set CONFIG_SYS_TEXT_BASE=0 with the following error: LD u-boot arm-linux-gnueabi-ld.bfd: u-boot: Not enough room for program headers, try linking with -N arm-linux-gnueabi-ld.bfd: final link failed: Bad value The issue can reproduced the bad binutils and the rock2_defconfig target. This issue was also encountered by the powerpc kernel[2], with the fix being to pass --no-dynamic-linker for linkers newer than 2.26 when this flag was introduced. The option tells ld that the PIE or shared lib does not need loaded program headers. Ubuntu Zesty's Binutils 2.27.51.20161202 hits this error. [1] https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=commit;h=1a9ccd70f9a7 [2] https://git.kernel.org/cgit/linux/kernel/git/powerpc/linux.git/commit/?h=next&id=ff45000fcb56b5b0f1a14a865d3541746d838a0a Signed-off-by: Joel Stanley Tested-by: Sjoerd Simons Tested-by: Jon Disnard --- v2: - use ld-option to test for the flag instead of the version, as suggested by Måns - update commit message with clarification from Alan Makefile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Makefile b/Makefile index dfed58bec661..c98a8361654a 100644 --- a/Makefile +++ b/Makefile @@ -793,6 +793,10 @@ ALL-y += $(CONFIG_BUILD_TARGET:"%"=%) endif LDFLAGS_u-boot += $(LDFLAGS_FINAL) + +# Avoid 'Not enough room for program headers' error on binutils 2.28 onwards. +LDFLAGS_u-boot += $(call ld-option, --no-dynamic-linker) + ifneq ($(CONFIG_SYS_TEXT_BASE),) LDFLAGS_u-boot += -Ttext $(CONFIG_SYS_TEXT_BASE) endif