From patchwork Fri Apr 12 14:11:45 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: tip-bot for Dave Martin X-Patchwork-Id: 2435981 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) by patchwork2.kernel.org (Postfix) with ESMTP id 241E4DF2A1 for ; Fri, 12 Apr 2013 14:22:31 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UQejc-0006pY-3r; Fri, 12 Apr 2013 14:13:50 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1UQeiG-00050g-IA; Fri, 12 Apr 2013 14:12:24 +0000 Received: from mail-wi0-x233.google.com ([2a00:1450:400c:c05::233]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UQeho-00050M-1v for linux-arm-kernel@lists.infradead.org; Fri, 12 Apr 2013 14:11:56 +0000 Received: by mail-wi0-f179.google.com with SMTP id hn17so1633725wib.0 for ; Fri, 12 Apr 2013 07:11:52 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer :x-gm-message-state; bh=lJqfWJn+mwIseLhj9qB5BWo4kC1eVxMxTXmhJcz5+xI=; b=RWbHbXO1JQfFUxkhdYnu/oGAgFd4zA4+XxenmIZ04RJxhbzU28am3qrZVyN0jpmOXY LqWg+A4Iq6Zvh1Ve3aPIvCkpka1nfX/rWnrk/hC4nVgSoPYdu/bjoEp4GMqMLA/ewb5z UUuA62DagtMJyUzint4wkBIfitgf4fvx0ftVK6jMdiPGiOnfv4AlIUtFziQ5Q0DHIQzg aP4Ugy2N8nJpFBWRbT6BoLxMvV6v+kAa1umO1EHp3rUljziP6NI3fE+oXEc+vn38VTPC ocXZ6mYwuXLqU2v5r84v21Ma00G+kn9OQ3DDGyUDl+QFVN/bX90ciWvqNHw8wnYwM9Oj i7Cg== X-Received: by 10.180.90.18 with SMTP id bs18mr4310128wib.31.1365775911771; Fri, 12 Apr 2013 07:11:51 -0700 (PDT) Received: from e103592.peterhouse.linaro.org (fw-lnat.cambridge.arm.com. [217.140.96.63]) by mx.google.com with ESMTPS id dp5sm3571448wib.1.2013.04.12.07.11.50 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 12 Apr 2013 07:11:50 -0700 (PDT) From: Dave Martin To: linux-arm-kernel@lists.infradead.org Subject: [RFC PATCH] ARM: Remove backwards-compatibility IT macros for CONFIG_LTO Date: Fri, 12 Apr 2013 15:11:45 +0100 Message-Id: <1365775905-13173-1-git-send-email-dave.martin@linaro.org> X-Mailer: git-send-email 1.7.9.5 X-Gm-Message-State: ALoCoQm8C618mfhfOd6fwhI506t6JE0CysLI+HHz3MlYuti5uQYpurLLHWVV9Z2uf4IQRbkM89ar X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130412_101156_237589_DBBC5535 X-CRM114-Status: GOOD ( 16.17 ) X-Spam-Score: -1.9 (-) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-1.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: Andi Kleen , Catalin Marinas , Tim Bird , linux-kernel@vger.kernel.org, patches@linaro.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Old assemblers which don't support Thumb-2 also don't accept the IT instructions. Currently, dummy macros are defined when CONFIG_ARM_ASM_UNIFIED=n, to allow assembly to annotate code with IT instructions even if the tools being used are too old to support them. These macro definitions interfere with link-time-optimisation (LTO) because LTO may optimise and wedge multiple compilation units together into huge, combined source files passed to the assembler. LTO may in general reorder compilation units at the top level, which may also cause the macro definitions to move after the point where they are needed. Since LTO depends on tools far too new to lack Thumb-2 support, this patch gets rid of the dummy macros when building .c files. Any IT instructions should be understood natively by the assembler and accepted [*] The macros are not strictly needed for .S files in this case either, but they are harmless and so retained for now. [*] Some GCC versions between 4.6 and 4.7 erroneously generate some IT instructions in the compiler output even with -marm. This doesn't seem to have been causing a lot of problems for people, so it looks like recent assemblers don't barf on those instructions. Signed-off-by: Dave Martin --- If this works, I believe it can supersede other currently proposed patches for working around this issue. I've done dome trivial build-testing, but haven't tried this with LTO yet and don't have a wide variety of older tools to play with. Testing/comments would be gratefully appreciated. arch/arm/include/asm/unified.h | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/arch/arm/include/asm/unified.h b/arch/arm/include/asm/unified.h index f5989f4..2fafbe9 100644 --- a/arch/arm/include/asm/unified.h +++ b/arch/arm/include/asm/unified.h @@ -54,12 +54,18 @@ #endif /* CONFIG_THUMB2_KERNEL */ -#ifndef CONFIG_ARM_ASM_UNIFIED - +#if !defined(CONFIG_ARM_ASM_UNIFIED) && !defined(CONFIG_LTO) /* * If the unified assembly syntax isn't used (in ARM mode), these - * macros expand to an empty string + * macros expand to an empty string. + * + * These macro definitions can leak between compilation units if LTO + * is enabled, causing post-LTO assembly failures. Newer versions of + * gas will silently accept IT instructions even in non-unified mode. + * So we'll assume the tools are new enough in that case and skip the + * macro definitions. */ + #ifdef __ASSEMBLY__ .macro it, cond .endm @@ -125,6 +131,6 @@ __asm__( " .endm\n"); #endif /* __ASSEMBLY__ */ -#endif /* CONFIG_ARM_ASM_UNIFIED */ +#endif /* CONFIG_ARM_ASM_UNIFIED || CONFIG_LTO */ #endif /* !__ASM_UNIFIED_H */