Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp4014659imu; Mon, 7 Jan 2019 13:52:16 -0800 (PST) X-Google-Smtp-Source: AFSGD/UViRflr/prMaUvltSw2WPHcnzJmQ5cIMrKfLRIWE8qAyurixOpT3CA77tSyKok4WNZtFWw X-Received: by 2002:a62:140a:: with SMTP id 10mr63638706pfu.157.1546897936675; Mon, 07 Jan 2019 13:52:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1546897936; cv=none; d=google.com; s=arc-20160816; b=t/qayiSxuAz5m6l5hQif6Jvg1+dIRqDZNCIzSXMafhAtmiCAFm6WFxdsFVJTfIw0FU ayc3O0Z18COu8v7eK4G8U/wAQsG9kR90ZFtw4oFJenSR7wcvG988dpEewxpUx+5JqZ+7 OzAg0oBwRECgsGzmM+MG/QjCDdZGgFoh9plZKDkOEgeNQghnL7NFC+C0O8iKGjObKeQO fIy1KMW/cb2rRhMaoW1YhQAdDVOyxpPChuxJDKShLmJ5GKtAYrzQn4YZOXz4STuvMzMq sWuIBPttE+APRKACB/qf9gR6AuFRQV8IOad5NF+fXUfA+koROvulcQKmj8MxbdtjhERv 0lmg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:message-id:references :in-reply-to:subject:cc:to:from:date:content-transfer-encoding :mime-version:dkim-signature; bh=psMMRwMe3dh8O9dmvDsVPlF676cuwlu4ZsKyROzhdTw=; b=i79/51ive//vmMCmtpwXhd9QzKAT0wXHLRIbpQZsF83GaMits4u8TsNbaaNu+LFAYU rz0fD9+ErANOSxF9e31FO97MUbCItlk66ZeGZpqrQ/bek9KZia2/sNaho2KUOxw6d8fh C5ZuWPkRj/7uV40y/aAmI1zf1RsJROcY03lB5sXE0NVHY2UBEYgxrNMgqFkW71OEgyPJ jOSkNrR8yMJrCnRTAr9D0VGKZJsQbyPjyrzT7QIZmAe/gZzPsWliyZaRsaMX1wqQ4BGX YQE5RwT9S0QrIBIquwIT2MZ4x+xZI6pWzSCx0zAHRDuODkgbToZKJMpwfYjKh1jVlUKC F2AQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@agner.ch header.s=dkim header.b=YraNo2eF; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f1si62126469pgq.553.2019.01.07.13.52.00; Mon, 07 Jan 2019 13:52:16 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@agner.ch header.s=dkim header.b=YraNo2eF; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727132AbfAGVuo (ORCPT + 99 others); Mon, 7 Jan 2019 16:50:44 -0500 Received: from mail.kmu-office.ch ([178.209.48.109]:48836 "EHLO mail.kmu-office.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726746AbfAGVun (ORCPT ); Mon, 7 Jan 2019 16:50:43 -0500 Received: from webmail.kmu-office.ch (unknown [IPv6:2a02:418:6a02::a3]) by mail.kmu-office.ch (Postfix) with ESMTPSA id AC5C15C1536; Mon, 7 Jan 2019 22:50:41 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=agner.ch; s=dkim; t=1546897841; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=psMMRwMe3dh8O9dmvDsVPlF676cuwlu4ZsKyROzhdTw=; b=YraNo2eFRUxtwPvLHDJfsgXzwGw/y95mPvGUakQiaJZH8MUYogQwjHJ56BkWcGErBQkvpQ 46SFYUt6hkou4ZRertpFf1Av2fPyjHcDtbHpBDbI5gHIZwoSU3z+YAZFhEz8uvQAysFvXw T0vrHTu/h/yjoZldgGiXhP1VN6goR1c= MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Date: Mon, 07 Jan 2019 22:50:41 +0100 From: Stefan Agner To: Nicolas Pitre Cc: linux@armlinux.org.uk, ndesaulniers@google.com, natechancellor@gmail.com, arnd@arndb.de, ard.biesheuvel@linaro.org, peterz@infradead.org, mingo@redhat.com, will.deacon@arm.com, julien.thierry@arm.com, mark.rutland@arm.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH v2 2/3] ARM: uaccess: use unified assembler language syntax In-Reply-To: References: <5ef2acc655abfbe8bfa2cd30ecc5c2286b8fdfa3.1546551693.git.stefan@agner.ch> Message-ID: <3f615e62b2d3eefab0b1c17fe19bf1d2@agner.ch> X-Sender: stefan@agner.ch User-Agent: Roundcube Webmail/1.3.7 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 05.01.2019 17:12, Nicolas Pitre wrote: > On Thu, 3 Jan 2019, Stefan Agner wrote: > >> Convert the conditional infix to a postfix to make sure this inline >> assembly is unified syntax. Since gcc assumes non-unified syntax >> when emitting ARM instructions, make sure to define the syntax as >> unified. >> >> This allows to use LLVM's integrated assembler. >> >> Signed-off-by: Stefan Agner >> --- >> Changes since v1: >> - Explicitly use unified syntax for inline assembly >> >> >> arch/arm/include/asm/uaccess.h | 3 ++- >> 1 file changed, 2 insertions(+), 1 deletion(-) >> >> diff --git a/arch/arm/include/asm/uaccess.h b/arch/arm/include/asm/uaccess.h >> index 6390a40f16e7..a50f9b4e2574 100644 >> --- a/arch/arm/include/asm/uaccess.h >> +++ b/arch/arm/include/asm/uaccess.h >> @@ -86,7 +86,8 @@ static inline void set_fs(mm_segment_t fs) >> #define __range_ok(addr, size) ({ \ >> unsigned long flag, roksum; \ >> __chk_user_ptr(addr); \ >> - __asm__("adds %1, %2, %3; sbcccs %1, %1, %0; movcc %0, #0" \ >> + __asm__(".syntax unified\n" \ >> + "adds %1, %2, %3; sbcscc %1, %1, %0; movcc %0, #0" \ > > Instead of sprinkling ".syntax unified" around, you could consider > including when needed. This seems not to help in this case. When I include at the beginning of uaccess.h GCC still seems to emit ".syntax unified". I guess this is since we are dealing with inline assembly. As far as I understand its really gcc which emits a ".syntax divided" by default when compiling ARM mode. There is an option "-masm-syntax-unified" which according to the gcc man page should do what we need, but it seems broken, see also: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88648 I agree this patch is not particularly pretty, but it is the only solution I found to make this inline assembly work with gcc and Clang. -- Stefan