From patchwork Tue Jul 10 17:00:17 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Allen Martin X-Patchwork-Id: 170252 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 139D22C01D3 for ; Wed, 11 Jul 2012 03:00:47 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 85A3F2808A; Tue, 10 Jul 2012 19:00:41 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de 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 DHVArp+-iV0x; Tue, 10 Jul 2012 19:00:41 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id CAEDC2808C; Tue, 10 Jul 2012 19:00:33 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 3CF7228081 for ; Tue, 10 Jul 2012 19:00:30 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de 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 8qsc88iNdpZH for ; Tue, 10 Jul 2012 19:00:29 +0200 (CEST) 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 hqemgate03.nvidia.com (hqemgate03.nvidia.com [216.228.121.140]) by theia.denx.de (Postfix) with ESMTPS id B17192807D for ; Tue, 10 Jul 2012 19:00:26 +0200 (CEST) Received: from hqnvupgp05.nvidia.com (Not Verified[216.228.121.13]) by hqemgate03.nvidia.com id ; Tue, 10 Jul 2012 10:00:48 -0700 Received: from hqemhub02.nvidia.com ([172.17.108.22]) by hqnvupgp05.nvidia.com (PGP Universal service); Tue, 10 Jul 2012 10:00:23 -0700 X-PGP-Universal: processed; by hqnvupgp05.nvidia.com on Tue, 10 Jul 2012 10:00:23 -0700 Received: from badger.nvidia.com (172.20.144.16) by hqemhub02.nvidia.com (172.20.150.31) with Microsoft SMTP Server id 8.3.264.0; Tue, 10 Jul 2012 10:00:23 -0700 From: Allen Martin To: , , , , Date: Tue, 10 Jul 2012 10:00:17 -0700 Message-ID: <1341939617-26450-2-git-send-email-amartin@nvidia.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1341939617-26450-1-git-send-email-amartin@nvidia.com> References: <1341939617-26450-1-git-send-email-amartin@nvidia.com> X-NVConfidentiality: public MIME-Version: 1.0 Cc: u-boot@lists.denx.de Subject: [U-Boot] [PATCH v2 2/2] arm: work around assembler bug X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de Disable sibling call optimization based on binutils version. This is to work around a bug in the assember in binutils versions < 2.22. Branches to weak symbols can be incorrectly optimized in thumb mode to a short branch (b.n instruction) that won't reach when the symbol gets preempted. http://sourceware.org/bugzilla/show_bug.cgi?id=12532 Signed-off-by: Allen Martin --- changes for v2: -changed GAS_BUG_12532 from yes/no to y/n to be consistent -added additional warning about code size increase --- arch/arm/config.mk | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/arch/arm/config.mk b/arch/arm/config.mk index 3f4453a..bcabf17 100644 --- a/arch/arm/config.mk +++ b/arch/arm/config.mk @@ -87,3 +87,24 @@ endif ifndef CONFIG_NAND_SPL LDFLAGS_u-boot += -pie endif + +# +# binutils versions < 2.22 have a bug in the assembler where branches +# to weak symbols can be incorrectly optimized in thumb mode to a +# short branch (b.n instruction) that won't reach when the symbol +# gets preempted +# +# http://sourceware.org/bugzilla/show_bug.cgi?id=12532 +# +ifeq ($(CONFIG_SYS_THUMB_BUILD),y) +ifeq ($(GAS_BUG_12532),) +export GAS_BUG_12532:=$(shell if [ $(call binutils-version) -lt 0222 ] ; then echo y; else echo n; fi) +ifeq ($(GAS_BUG_12532),y) +$(warning *** disabling sibling call optimzation because binutils version < 2.22) +$(warning *** code size may be slightly larger) +endif +endif +ifeq ($(GAS_BUG_12532),y) +PLATFORM_RELFLAGS += -fno-optimize-sibling-calls +endif +endif