From patchwork Thu Aug 2 15:01:23 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Will Deacon X-Patchwork-Id: 1267671 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork1.kernel.org (Postfix) with ESMTP id 256ED3FCC5 for ; Thu, 2 Aug 2012 15:04:48 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1Swwu8-0004dA-IB; Thu, 02 Aug 2012 15:01:36 +0000 Received: from cam-admin0.cambridge.arm.com ([217.140.96.50]) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1Swwu4-0004bf-EU for linux-arm-kernel@lists.infradead.org; Thu, 02 Aug 2012 15:01:33 +0000 Received: from mudshark.cambridge.arm.com (mudshark.cambridge.arm.com [10.1.79.58]) by cam-admin0.cambridge.arm.com (8.12.6/8.12.6) with ESMTP id q72F1NOK021695; Thu, 2 Aug 2012 16:01:23 +0100 (BST) Date: Thu, 2 Aug 2012 16:01:23 +0100 From: Will Deacon To: Russell King - ARM Linux Subject: Re: [PATCH] ARM: makefile: work around toolchain bug in recent versions of binutils Message-ID: <20120802150123.GE9838@mudshark.cambridge.arm.com> References: <1343910206-3684-1-git-send-email-will.deacon@arm.com> <20120802130411.GU6802@n2100.arm.linux.org.uk> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20120802130411.GU6802@n2100.arm.linux.org.uk> Thread-Topic: [PATCH] ARM: makefile: work around toolchain bug in recent versions of binutils Accept-Language: en-GB, en-US Content-Language: en-US User-Agent: Mutt/1.5.21 (2010-09-15) X-Spam-Note: CRM114 invocation failed X-Spam-Score: -6.9 (------) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-6.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at http://www.dnswl.org/, high trust [217.140.96.50 listed in list.dnswl.org] -0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: "linux-arm-kernel@lists.infradead.org" X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Hi Russell, On Thu, Aug 02, 2012 at 02:04:11PM +0100, Russell King - ARM Linux wrote: > On Thu, Aug 02, 2012 at 01:23:26PM +0100, Will Deacon wrote: > > Recent upstream versions of binutils fail to assembler compressed/head.S > > when passed the -march=all option: > > > > http://lists.gnu.org/archive/html/bug-binutils/2011-04/msg00162.html > > > > The recommended workaround from the tools folks is not to pass the > > option, and instead let the assembler deduce the CPU type based on the > > features used by the code. > > That doesn't work for all binutils - binutils historically has had to be > told explicitly what architecture its building for and won't "deduce" > it from the code. Damn. I thought there would be a reason why we passed the option in the first place. > Maybe this needs to be a build-time test whether the assembler accepts it? That could be tricky since gas still accepts the option, but fails later with: arch/arm/boot/compressed/head.S: Assembler messages: arch/arm/boot/compressed/head.S:127: Error: selected processor does not support requested special purpose register -- `mrs r2,cpsr' arch/arm/boot/compressed/head.S:134: Error: selected processor does not support requested special purpose register -- `mrs r2,cpsr' arch/arm/boot/compressed/head.S:136: Error: selected processor does not support requested special purpose register -- `msr cpsr_c,r2' How about grabbing the march from KBUILD_AFLAGS instead (see below)? Will ---8<--- diff --git a/arch/arm/boot/compressed/Makefile b/arch/arm/boot/compressed/Makefile index bb26756..3774f0d 100644 --- a/arch/arm/boot/compressed/Makefile +++ b/arch/arm/boot/compressed/Makefile @@ -126,7 +126,7 @@ KBUILD_CFLAGS = $(subst -pg, , $(ORIG_CFLAGS)) endif ccflags-y := -fpic -fno-builtin -I$(obj) -asflags-y := -Wa,-march=all +asflags-y := -Wa,$(lastword $(filter -march=%,$(KBUILD_AFLAGS))) # Supply kernel BSS size to the decompressor via a linker symbol. KBSS_SZ = $(shell $(CROSS_COMPILE)size $(obj)/../../../../vmlinux | \