From patchwork Thu Jan 29 09:44:46 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 43900 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f200.google.com (mail-wi0-f200.google.com [209.85.212.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id F2D0A2410D for ; Thu, 29 Jan 2015 09:46:31 +0000 (UTC) Received: by mail-wi0-f200.google.com with SMTP id fb4sf10988384wid.3 for ; Thu, 29 Jan 2015 01:46:31 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:subject:date:message-id:cc :precedence:list-id:list-unsubscribe:list-archive:list-post :list-help:list-subscribe:mime-version:content-type :content-transfer-encoding:sender:errors-to:x-original-sender :x-original-authentication-results:mailing-list; bh=UC5ggz9muS8dtEawuYemrKRzk5Pn7OdNL98QHQS2m14=; b=kYlLUyY4ELPjmEV0Vfi1xdNbL0e3zdiWLHsION26LD2YH2xCVPZ+3yJteCAAPX52ZD 1DUQGpRqOBG0edsVDB86H22r25nmWwsa5njQvPi7OfZ+qq5NO/c9OyWXfUtCmqgCZzkE 7Xa5dSBiPTuEIvj2DIbaFH2i9GYlyN5VJEcIanImYSezz2mHVKmdhpVp8TiNLauTcXpw dHbYXubORCMp8Yd5ZDNo+3x8ifrICuYQhgZ17Of2IQSuo7GwCaAyyv7xOypVIoGGfCne 2NkDEI9iY8rvbt00rdJraLdvSv8MH9Qv+RIooSCIx5vDR8EzbFuf/wdCfhWBlQxShjT1 2nDQ== X-Gm-Message-State: ALoCoQnXgIVUWsfuamJHr+4FiRieorlZwDv/hr48SV8J2BIG9EaTwVyIz5gaSRXlZreSyhmd31Zf X-Received: by 10.194.221.65 with SMTP id qc1mr1077675wjc.7.1422524791282; Thu, 29 Jan 2015 01:46:31 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.45.6 with SMTP id i6ls274382lam.10.gmail; Thu, 29 Jan 2015 01:46:31 -0800 (PST) X-Received: by 10.152.5.226 with SMTP id v2mr13227531lav.34.1422524791020; Thu, 29 Jan 2015 01:46:31 -0800 (PST) Received: from mail-lb0-f182.google.com (mail-lb0-f182.google.com. [209.85.217.182]) by mx.google.com with ESMTPS id q8si6837509laj.104.2015.01.29.01.46.30 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 29 Jan 2015 01:46:30 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.182 as permitted sender) client-ip=209.85.217.182; Received: by mail-lb0-f182.google.com with SMTP id l4so26056354lbv.13 for ; Thu, 29 Jan 2015 01:46:30 -0800 (PST) X-Received: by 10.112.164.101 with SMTP id yp5mr13039601lbb.82.1422524790868; Thu, 29 Jan 2015 01:46:30 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.35.133 with SMTP id h5csp1706443lbj; Thu, 29 Jan 2015 01:46:30 -0800 (PST) X-Received: by 10.68.222.130 with SMTP id qm2mr13307696pbc.44.1422524788469; Thu, 29 Jan 2015 01:46:28 -0800 (PST) Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id gw4si9048427pbc.240.2015.01.29.01.46.27 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 29 Jan 2015 01:46:28 -0800 (PST) Received-SPF: none (google.com: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org does not designate permitted sender hosts) client-ip=2001:1868:205::9; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1YGlf7-0003l5-Hr; Thu, 29 Jan 2015 09:45:21 +0000 Received: from mail-wi0-f180.google.com ([209.85.212.180]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1YGlf4-0002Jy-MG for linux-arm-kernel@lists.infradead.org; Thu, 29 Jan 2015 09:45:19 +0000 Received: by mail-wi0-f180.google.com with SMTP id h11so21948814wiw.1 for ; Thu, 29 Jan 2015 01:44:53 -0800 (PST) X-Received: by 10.194.158.5 with SMTP id wq5mr16858295wjb.85.1422524693418; Thu, 29 Jan 2015 01:44:53 -0800 (PST) Received: from ards-macbook-pro.local ([197.131.19.240]) by mx.google.com with ESMTPSA id dn2sm1691249wib.14.2015.01.29.01.44.51 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 29 Jan 2015 01:44:52 -0800 (PST) From: Ard Biesheuvel To: elder@linaro.org, behanw@converseincode.com, linux@arm.linux.org.uk, linux-arm-kernel@lists.infradead.org Subject: [PATCH v2] ARM: teach __asmeq that r11 == fp and r12 == ip Date: Thu, 29 Jan 2015 09:44:46 +0000 Message-Id: <1422524686-30462-1-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 1.8.3.2 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150129_014518_886087_17EAE699 X-CRM114-Status: GOOD ( 11.67 ) X-Spam-Score: -0.7 (/) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-0.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.212.180 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [209.85.212.180 listed in wl.mailspike.net] -0.0 RCVD_IN_MSPIKE_WL Mailspike good senders Cc: Ard Biesheuvel , will.deacon@arm.com, nico@linaro.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 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+patch=linaro.org@lists.infradead.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: ard.biesheuvel@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.182 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 The __asmeq macro is used inside inline asm statements to ensure that register asm variables that explicitly specify a register are mapped correctly onto those registers when used in inline asm input and output constraints. However, the string based matching fails to take into account that 'fp' is often referred to as 'r11' and 'ip' is often referred to as 'r12', (e.g., by clang), causing false negatives. Fix this by making __asmeq consider the ("fp","r11"), ("r11","fp"), ("ip","r12") and ("r12","ip") cases specifically. Signed-off-by: Ard Biesheuvel Reviewed-by: Alex Elder Acked-by: Nicolas Pitre --- v2: Added r11 but not r10, as the latter is only referred to as 'sl' in objdump output, but GCC emitted inline asm substitutes the references with 'r10' instead. sp/lr/pc are unambiguous between GCC and clang. Primary purpose of this patch is to fix the incompatibility between clang and GCC, but the side effect is that it relaxes the requirement imposed on the programmer to refer to a register by the same name as the compiler does. If that is seen as a substantial upside by some, we could indeed still decide to add r10, r13, r14 and r15 (for which no such incompatibility exists) as well. However, those are not currently used in __asmeq invocations anywhere under arch/arm arch/arm/include/asm/compiler.h | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/arch/arm/include/asm/compiler.h b/arch/arm/include/asm/compiler.h index 8155db2f7fa1..29fe85e59439 100644 --- a/arch/arm/include/asm/compiler.h +++ b/arch/arm/include/asm/compiler.h @@ -8,8 +8,21 @@ * This string is meant to be concatenated with the inline asm string and * will cause compilation to stop on mismatch. * (for details, see gcc PR 15089) + * For compatibility with clang, we have to specifically take the equivalence + * of 'r11' <-> 'fp' and 'r12' <-> 'ip' into account as well. */ -#define __asmeq(x, y) ".ifnc " x "," y " ; .err ; .endif\n\t" +#define __asmeq(x, y) \ + ".ifnc " x "," y "; " \ + ".ifnc " x y ",fpr11; " \ + ".ifnc " x y ",r11fp; " \ + ".ifnc " x y ",ipr12; " \ + ".ifnc " x y ",r12ip; " \ + ".err; " \ + ".endif; " \ + ".endif; " \ + ".endif; " \ + ".endif; " \ + ".endif\n\t" #endif /* __ASM_ARM_COMPILER_H */