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: Dave Martin X-Patchwork-Id: 16115 Return-Path: X-Original-To: linaro@staging.patches.linaro.org Delivered-To: linaro@staging.patches.linaro.org Received: from mail-gg0-f197.google.com (mail-gg0-f197.google.com [209.85.161.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id D4AFF26EB0 for ; Fri, 12 Apr 2013 14:12:19 +0000 (UTC) Received: by mail-gg0-f197.google.com with SMTP id k5sf3710645ggn.4 for ; Fri, 12 Apr 2013 07:11:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:mime-version:x-beenthere:x-received:received-spf :x-received:x-forwarded-to:x-forwarded-for:delivered-to:x-received :received-spf:x-received:from:to:cc:subject:date:message-id:x-mailer :x-gm-message-state:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-google-group-id:list-post:list-help:list-archive:list-unsubscribe; bh=lJqfWJn+mwIseLhj9qB5BWo4kC1eVxMxTXmhJcz5+xI=; b=gWI7N8SnhYYcFaFN7ZKHeITHo9BoS8eerWJLyw9BpdRYUPkJ1eALg9B4857ZDvvHnY +xFq7LHLvZUNdcioywMab1VhFp2zhwWM4k0EIQKRxasgfBmk0K+wTVpI02gyOfVUpNGj FF8LbhlYkB18CUVaodxN0qNoLspR6/53kOlPNWMfLnsbeJW0rMo6+IK3MyIPcAXmJk0R IwcaLlk2UyQ2KA3zmeUgao8tGD2AF14oGfrQnTZ0vdyQ64cg+RAndLyxthhkfk2KKjTZ KLwSYsZkHf4vNBg3ZZs2ipaX4oIn7qHgz8PLlGO+Q3S6uiVvFQT+h4akfvbGZyeM2gUP PsaA== X-Received: by 10.236.111.106 with SMTP id v70mr5675356yhg.34.1365775915705; Fri, 12 Apr 2013 07:11:55 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.4.71 with SMTP id i7ls177120qei.86.gmail; Fri, 12 Apr 2013 07:11:55 -0700 (PDT) X-Received: by 10.58.173.131 with SMTP id bk3mr8441396vec.48.1365775915492; Fri, 12 Apr 2013 07:11:55 -0700 (PDT) Received: from mail-vc0-f170.google.com (mail-vc0-f170.google.com [209.85.220.170]) by mx.google.com with ESMTPS id p12si6578423vce.22.2013.04.12.07.11.55 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 12 Apr 2013 07:11:55 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.170 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.170; Received: by mail-vc0-f170.google.com with SMTP id lf10so2254062vcb.1 for ; Fri, 12 Apr 2013 07:11:55 -0700 (PDT) X-Received: by 10.52.71.4 with SMTP id q4mr7275336vdu.8.1365775915272; Fri, 12 Apr 2013 07:11:55 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.58.127.98 with SMTP id nf2csp67789veb; Fri, 12 Apr 2013 07:11:54 -0700 (PDT) X-Received: by 10.194.122.166 with SMTP id lt6mr17834325wjb.56.1365775913134; Fri, 12 Apr 2013 07:11:53 -0700 (PDT) Received: from mail-we0-x22e.google.com (mail-we0-x22e.google.com [2a00:1450:400c:c03::22e]) by mx.google.com with ESMTPS id fc4si923947wib.0.2013.04.12.07.11.52 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 12 Apr 2013 07:11:53 -0700 (PDT) Received-SPF: neutral (google.com: 2a00:1450:400c:c03::22e is neither permitted nor denied by best guess record for domain of dave.martin@linaro.org) client-ip=2a00:1450:400c:c03::22e; Received: by mail-we0-f174.google.com with SMTP id u12so2040173wey.33 for ; Fri, 12 Apr 2013 07:11:52 -0700 (PDT) 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 Cc: patches@linaro.org, Tim Bird , Andi Kleen , Catalin Marinas , linux-kernel@vger.kernel.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: ALoCoQl+PbmBhc+jOfCY5zFUaQxXgsayOQJqOpwIbYw3azPSfmrSjxxSaClYl5rskJ0NBVSBJoIB X-Original-Sender: dave.martin@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.170 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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 */