From: Stefan Agner <stefan@agner.ch>
To: Nicolas Pitre <nicolas.pitre@linaro.org>
Cc: mark.rutland@arm.com, arnd@arndb.de, ard.biesheuvel@linaro.org,
peterz@infradead.org, will.deacon@arm.com,
julien.thierry@arm.com, ndesaulniers@google.com,
linux@armlinux.org.uk, linux-kernel@vger.kernel.org,
mingo@redhat.com, natechancellor@gmail.com,
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v2 2/3] ARM: uaccess: use unified assembler language syntax
Date: Mon, 07 Jan 2019 22:50:41 +0100 [thread overview]
Message-ID: <3f615e62b2d3eefab0b1c17fe19bf1d2@agner.ch> (raw)
In-Reply-To: <nycvar.YSQ.7.76.1901051106410.1783@knanqh.ubzr>
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 <stefan@agner.ch>
>> ---
>> 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 <asm/unified.h> when needed.
This seems not to help in this case. When I include <asm/unified.h> 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
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2019-01-07 21:51 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-03 21:48 [PATCH v2 0/3] ARM: trivial assembly fixes to enable LLVM as Stefan Agner
2019-01-03 21:48 ` [PATCH v2 1/3] ARM: fix argument count to match macro definition Stefan Agner
2019-01-05 16:05 ` Nicolas Pitre
2019-01-03 21:48 ` [PATCH v2 2/3] ARM: uaccess: use unified assembler language syntax Stefan Agner
2019-01-05 16:12 ` Nicolas Pitre
2019-01-07 21:50 ` Stefan Agner [this message]
2019-01-03 21:48 ` [PATCH v2 3/3] ARM: spinlock: " Stefan Agner
2019-01-05 16:13 ` Nicolas Pitre
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3f615e62b2d3eefab0b1c17fe19bf1d2@agner.ch \
--to=stefan@agner.ch \
--cc=ard.biesheuvel@linaro.org \
--cc=arnd@arndb.de \
--cc=julien.thierry@arm.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=mark.rutland@arm.com \
--cc=mingo@redhat.com \
--cc=natechancellor@gmail.com \
--cc=ndesaulniers@google.com \
--cc=nicolas.pitre@linaro.org \
--cc=peterz@infradead.org \
--cc=will.deacon@arm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).