* [PATCH v2 0/3] ARM: trivial assembly fixes to enable LLVM as
@ 2019-01-03 21:48 ` Stefan Agner
0 siblings, 0 replies; 16+ messages in thread
From: Stefan Agner @ 2019-01-03 21:48 UTC (permalink / raw)
To: linux
Cc: ndesaulniers, natechancellor, arnd, ard.biesheuvel,
nicolas.pitre, peterz, mingo, will.deacon, julien.thierry,
mark.rutland, linux-kernel, linux-arm-kernel, Stefan Agner
This patchset is a starting point to enable LLVM integrated assembler and
contains some trivial changes. With this patchset the LLVM integrated
assembler can be used to assemble almost all C files.
Changes since v1:
- Explicitly use unified syntax for inline assembly where necessary
Stefan Agner (3):
ARM: fix argument count to match macro definition
ARM: uaccess: use unified assembler language syntax
ARM: spinlock: use unified assembler language syntax
arch/arm/include/asm/spinlock.h | 3 ++-
arch/arm/include/asm/uaccess.h | 3 ++-
arch/arm/lib/copy_template.S | 2 +-
3 files changed, 5 insertions(+), 3 deletions(-)
--
2.20.1
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH v2 0/3] ARM: trivial assembly fixes to enable LLVM as
@ 2019-01-03 21:48 ` Stefan Agner
0 siblings, 0 replies; 16+ messages in thread
From: Stefan Agner @ 2019-01-03 21:48 UTC (permalink / raw)
To: linux
Cc: nicolas.pitre, mark.rutland, arnd, ard.biesheuvel, peterz,
will.deacon, julien.thierry, ndesaulniers, linux-kernel,
Stefan Agner, mingo, natechancellor, linux-arm-kernel
This patchset is a starting point to enable LLVM integrated assembler and
contains some trivial changes. With this patchset the LLVM integrated
assembler can be used to assemble almost all C files.
Changes since v1:
- Explicitly use unified syntax for inline assembly where necessary
Stefan Agner (3):
ARM: fix argument count to match macro definition
ARM: uaccess: use unified assembler language syntax
ARM: spinlock: use unified assembler language syntax
arch/arm/include/asm/spinlock.h | 3 ++-
arch/arm/include/asm/uaccess.h | 3 ++-
arch/arm/lib/copy_template.S | 2 +-
3 files changed, 5 insertions(+), 3 deletions(-)
--
2.20.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH v2 1/3] ARM: fix argument count to match macro definition
2019-01-03 21:48 ` Stefan Agner
@ 2019-01-03 21:48 ` Stefan Agner
-1 siblings, 0 replies; 16+ messages in thread
From: Stefan Agner @ 2019-01-03 21:48 UTC (permalink / raw)
To: linux
Cc: ndesaulniers, natechancellor, arnd, ard.biesheuvel,
nicolas.pitre, peterz, mingo, will.deacon, julien.thierry,
mark.rutland, linux-kernel, linux-arm-kernel, Stefan Agner
The macro str8w takes 10 arguments, abort being the 10th. In this
particular instantiation the abort argument is passed as 11th
argument leading to an error when using LLVM's integrated
assembler:
<instantiation>:46:47: error: too many positional arguments
str8w r0, r3, r4, r5, r6, r7, r8, r9, ip, , abort=19f
^
arch/arm/lib/copy_template.S:277:5: note: while in macro instantiation
18: forward_copy_shift pull=24 push=8
^
The argument is not used in the macro hence this does not change
code generation.
Signed-off-by: Stefan Agner <stefan@agner.ch>
---
arch/arm/lib/copy_template.S | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/arm/lib/copy_template.S b/arch/arm/lib/copy_template.S
index 652e4d98cd47..2d54491b0e22 100644
--- a/arch/arm/lib/copy_template.S
+++ b/arch/arm/lib/copy_template.S
@@ -241,7 +241,7 @@
orr r9, r9, ip, lspush #\push
mov ip, ip, lspull #\pull
orr ip, ip, lr, lspush #\push
- str8w r0, r3, r4, r5, r6, r7, r8, r9, ip, , abort=19f
+ str8w r0, r3, r4, r5, r6, r7, r8, r9, ip, abort=19f
bge 12b
PLD( cmn r2, #96 )
PLD( bge 13b )
--
2.20.1
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH v2 1/3] ARM: fix argument count to match macro definition
@ 2019-01-03 21:48 ` Stefan Agner
0 siblings, 0 replies; 16+ messages in thread
From: Stefan Agner @ 2019-01-03 21:48 UTC (permalink / raw)
To: linux
Cc: nicolas.pitre, mark.rutland, arnd, ard.biesheuvel, peterz,
will.deacon, julien.thierry, ndesaulniers, linux-kernel,
Stefan Agner, mingo, natechancellor, linux-arm-kernel
The macro str8w takes 10 arguments, abort being the 10th. In this
particular instantiation the abort argument is passed as 11th
argument leading to an error when using LLVM's integrated
assembler:
<instantiation>:46:47: error: too many positional arguments
str8w r0, r3, r4, r5, r6, r7, r8, r9, ip, , abort=19f
^
arch/arm/lib/copy_template.S:277:5: note: while in macro instantiation
18: forward_copy_shift pull=24 push=8
^
The argument is not used in the macro hence this does not change
code generation.
Signed-off-by: Stefan Agner <stefan@agner.ch>
---
arch/arm/lib/copy_template.S | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/arm/lib/copy_template.S b/arch/arm/lib/copy_template.S
index 652e4d98cd47..2d54491b0e22 100644
--- a/arch/arm/lib/copy_template.S
+++ b/arch/arm/lib/copy_template.S
@@ -241,7 +241,7 @@
orr r9, r9, ip, lspush #\push
mov ip, ip, lspull #\pull
orr ip, ip, lr, lspush #\push
- str8w r0, r3, r4, r5, r6, r7, r8, r9, ip, , abort=19f
+ str8w r0, r3, r4, r5, r6, r7, r8, r9, ip, abort=19f
bge 12b
PLD( cmn r2, #96 )
PLD( bge 13b )
--
2.20.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH v2 2/3] ARM: uaccess: use unified assembler language syntax
2019-01-03 21:48 ` Stefan Agner
@ 2019-01-03 21:48 ` Stefan Agner
-1 siblings, 0 replies; 16+ messages in thread
From: Stefan Agner @ 2019-01-03 21:48 UTC (permalink / raw)
To: linux
Cc: ndesaulniers, natechancellor, arnd, ard.biesheuvel,
nicolas.pitre, peterz, mingo, will.deacon, julien.thierry,
mark.rutland, linux-kernel, linux-arm-kernel, Stefan Agner
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" \
: "=&r" (flag), "=&r" (roksum) \
: "r" (addr), "Ir" (size), "0" (current_thread_info()->addr_limit) \
: "cc"); \
--
2.20.1
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH v2 2/3] ARM: uaccess: use unified assembler language syntax
@ 2019-01-03 21:48 ` Stefan Agner
0 siblings, 0 replies; 16+ messages in thread
From: Stefan Agner @ 2019-01-03 21:48 UTC (permalink / raw)
To: linux
Cc: nicolas.pitre, mark.rutland, arnd, ard.biesheuvel, peterz,
will.deacon, julien.thierry, ndesaulniers, linux-kernel,
Stefan Agner, mingo, natechancellor, linux-arm-kernel
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" \
: "=&r" (flag), "=&r" (roksum) \
: "r" (addr), "Ir" (size), "0" (current_thread_info()->addr_limit) \
: "cc"); \
--
2.20.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH v2 3/3] ARM: spinlock: use unified assembler language syntax
2019-01-03 21:48 ` Stefan Agner
@ 2019-01-03 21:48 ` Stefan Agner
-1 siblings, 0 replies; 16+ messages in thread
From: Stefan Agner @ 2019-01-03 21:48 UTC (permalink / raw)
To: linux
Cc: ndesaulniers, natechancellor, arnd, ard.biesheuvel,
nicolas.pitre, peterz, mingo, will.deacon, julien.thierry,
mark.rutland, linux-kernel, linux-arm-kernel, Stefan Agner
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/spinlock.h | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/arch/arm/include/asm/spinlock.h b/arch/arm/include/asm/spinlock.h
index 099c78fcf62d..8f009e788ad4 100644
--- a/arch/arm/include/asm/spinlock.h
+++ b/arch/arm/include/asm/spinlock.h
@@ -210,11 +210,12 @@ static inline void arch_read_lock(arch_rwlock_t *rw)
prefetchw(&rw->lock);
__asm__ __volatile__(
+" .syntax unified\n"
"1: ldrex %0, [%2]\n"
" adds %0, %0, #1\n"
" strexpl %1, %0, [%2]\n"
WFE("mi")
-" rsbpls %0, %1, #0\n"
+" rsbspl %0, %1, #0\n"
" bmi 1b"
: "=&r" (tmp), "=&r" (tmp2)
: "r" (&rw->lock)
--
2.20.1
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH v2 3/3] ARM: spinlock: use unified assembler language syntax
@ 2019-01-03 21:48 ` Stefan Agner
0 siblings, 0 replies; 16+ messages in thread
From: Stefan Agner @ 2019-01-03 21:48 UTC (permalink / raw)
To: linux
Cc: nicolas.pitre, mark.rutland, arnd, ard.biesheuvel, peterz,
will.deacon, julien.thierry, ndesaulniers, linux-kernel,
Stefan Agner, mingo, natechancellor, linux-arm-kernel
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/spinlock.h | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/arch/arm/include/asm/spinlock.h b/arch/arm/include/asm/spinlock.h
index 099c78fcf62d..8f009e788ad4 100644
--- a/arch/arm/include/asm/spinlock.h
+++ b/arch/arm/include/asm/spinlock.h
@@ -210,11 +210,12 @@ static inline void arch_read_lock(arch_rwlock_t *rw)
prefetchw(&rw->lock);
__asm__ __volatile__(
+" .syntax unified\n"
"1: ldrex %0, [%2]\n"
" adds %0, %0, #1\n"
" strexpl %1, %0, [%2]\n"
WFE("mi")
-" rsbpls %0, %1, #0\n"
+" rsbspl %0, %1, #0\n"
" bmi 1b"
: "=&r" (tmp), "=&r" (tmp2)
: "r" (&rw->lock)
--
2.20.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 16+ messages in thread
* Re: [PATCH v2 1/3] ARM: fix argument count to match macro definition
2019-01-03 21:48 ` Stefan Agner
@ 2019-01-05 16:05 ` Nicolas Pitre
-1 siblings, 0 replies; 16+ messages in thread
From: Nicolas Pitre @ 2019-01-05 16:05 UTC (permalink / raw)
To: Stefan Agner
Cc: linux, ndesaulniers, natechancellor, arnd, ard.biesheuvel,
peterz, mingo, will.deacon, julien.thierry, mark.rutland,
linux-kernel, linux-arm-kernel
On Thu, 3 Jan 2019, Stefan Agner wrote:
> The macro str8w takes 10 arguments, abort being the 10th. In this
> particular instantiation the abort argument is passed as 11th
> argument leading to an error when using LLVM's integrated
> assembler:
> <instantiation>:46:47: error: too many positional arguments
> str8w r0, r3, r4, r5, r6, r7, r8, r9, ip, , abort=19f
> ^
> arch/arm/lib/copy_template.S:277:5: note: while in macro instantiation
> 18: forward_copy_shift pull=24 push=8
> ^
>
> The argument is not used in the macro hence this does not change
> code generation.
>
> Signed-off-by: Stefan Agner <stefan@agner.ch>
Reviewed-by: Nicolas Pitre <nico@linaro.org>
> ---
> arch/arm/lib/copy_template.S | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/arm/lib/copy_template.S b/arch/arm/lib/copy_template.S
> index 652e4d98cd47..2d54491b0e22 100644
> --- a/arch/arm/lib/copy_template.S
> +++ b/arch/arm/lib/copy_template.S
> @@ -241,7 +241,7 @@
> orr r9, r9, ip, lspush #\push
> mov ip, ip, lspull #\pull
> orr ip, ip, lr, lspush #\push
> - str8w r0, r3, r4, r5, r6, r7, r8, r9, ip, , abort=19f
> + str8w r0, r3, r4, r5, r6, r7, r8, r9, ip, abort=19f
> bge 12b
> PLD( cmn r2, #96 )
> PLD( bge 13b )
> --
> 2.20.1
>
>
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH v2 1/3] ARM: fix argument count to match macro definition
@ 2019-01-05 16:05 ` Nicolas Pitre
0 siblings, 0 replies; 16+ messages in thread
From: Nicolas Pitre @ 2019-01-05 16:05 UTC (permalink / raw)
To: Stefan Agner
Cc: mark.rutland, arnd, ard.biesheuvel, peterz, will.deacon,
julien.thierry, ndesaulniers, linux, linux-kernel, mingo,
natechancellor, linux-arm-kernel
On Thu, 3 Jan 2019, Stefan Agner wrote:
> The macro str8w takes 10 arguments, abort being the 10th. In this
> particular instantiation the abort argument is passed as 11th
> argument leading to an error when using LLVM's integrated
> assembler:
> <instantiation>:46:47: error: too many positional arguments
> str8w r0, r3, r4, r5, r6, r7, r8, r9, ip, , abort=19f
> ^
> arch/arm/lib/copy_template.S:277:5: note: while in macro instantiation
> 18: forward_copy_shift pull=24 push=8
> ^
>
> The argument is not used in the macro hence this does not change
> code generation.
>
> Signed-off-by: Stefan Agner <stefan@agner.ch>
Reviewed-by: Nicolas Pitre <nico@linaro.org>
> ---
> arch/arm/lib/copy_template.S | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/arm/lib/copy_template.S b/arch/arm/lib/copy_template.S
> index 652e4d98cd47..2d54491b0e22 100644
> --- a/arch/arm/lib/copy_template.S
> +++ b/arch/arm/lib/copy_template.S
> @@ -241,7 +241,7 @@
> orr r9, r9, ip, lspush #\push
> mov ip, ip, lspull #\pull
> orr ip, ip, lr, lspush #\push
> - str8w r0, r3, r4, r5, r6, r7, r8, r9, ip, , abort=19f
> + str8w r0, r3, r4, r5, r6, r7, r8, r9, ip, abort=19f
> bge 12b
> PLD( cmn r2, #96 )
> PLD( bge 13b )
> --
> 2.20.1
>
>
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH v2 2/3] ARM: uaccess: use unified assembler language syntax
2019-01-03 21:48 ` Stefan Agner
@ 2019-01-05 16:12 ` Nicolas Pitre
-1 siblings, 0 replies; 16+ messages in thread
From: Nicolas Pitre @ 2019-01-05 16:12 UTC (permalink / raw)
To: Stefan Agner
Cc: linux, ndesaulniers, natechancellor, arnd, ard.biesheuvel,
peterz, mingo, will.deacon, julien.thierry, mark.rutland,
linux-kernel, linux-arm-kernel
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.
Nicolas
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH v2 2/3] ARM: uaccess: use unified assembler language syntax
@ 2019-01-05 16:12 ` Nicolas Pitre
0 siblings, 0 replies; 16+ messages in thread
From: Nicolas Pitre @ 2019-01-05 16:12 UTC (permalink / raw)
To: Stefan Agner
Cc: mark.rutland, arnd, ard.biesheuvel, peterz, will.deacon,
julien.thierry, ndesaulniers, linux, linux-kernel, mingo,
natechancellor, linux-arm-kernel
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.
Nicolas
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH v2 3/3] ARM: spinlock: use unified assembler language syntax
2019-01-03 21:48 ` Stefan Agner
@ 2019-01-05 16:13 ` Nicolas Pitre
-1 siblings, 0 replies; 16+ messages in thread
From: Nicolas Pitre @ 2019-01-05 16:13 UTC (permalink / raw)
To: Stefan Agner
Cc: linux, ndesaulniers, natechancellor, arnd, ard.biesheuvel,
peterz, mingo, will.deacon, julien.thierry, mark.rutland,
linux-kernel, linux-arm-kernel
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.
Same comment as for patch 2/3.
>
> Signed-off-by: Stefan Agner <stefan@agner.ch>
> ---
> Changes since v1:
> - Explicitly use unified syntax for inline assembly
>
>
> arch/arm/include/asm/spinlock.h | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/arch/arm/include/asm/spinlock.h b/arch/arm/include/asm/spinlock.h
> index 099c78fcf62d..8f009e788ad4 100644
> --- a/arch/arm/include/asm/spinlock.h
> +++ b/arch/arm/include/asm/spinlock.h
> @@ -210,11 +210,12 @@ static inline void arch_read_lock(arch_rwlock_t *rw)
>
> prefetchw(&rw->lock);
> __asm__ __volatile__(
> +" .syntax unified\n"
> "1: ldrex %0, [%2]\n"
> " adds %0, %0, #1\n"
> " strexpl %1, %0, [%2]\n"
> WFE("mi")
> -" rsbpls %0, %1, #0\n"
> +" rsbspl %0, %1, #0\n"
> " bmi 1b"
> : "=&r" (tmp), "=&r" (tmp2)
> : "r" (&rw->lock)
> --
> 2.20.1
>
>
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH v2 3/3] ARM: spinlock: use unified assembler language syntax
@ 2019-01-05 16:13 ` Nicolas Pitre
0 siblings, 0 replies; 16+ messages in thread
From: Nicolas Pitre @ 2019-01-05 16:13 UTC (permalink / raw)
To: Stefan Agner
Cc: mark.rutland, arnd, ard.biesheuvel, peterz, will.deacon,
julien.thierry, ndesaulniers, linux, linux-kernel, mingo,
natechancellor, linux-arm-kernel
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.
Same comment as for patch 2/3.
>
> Signed-off-by: Stefan Agner <stefan@agner.ch>
> ---
> Changes since v1:
> - Explicitly use unified syntax for inline assembly
>
>
> arch/arm/include/asm/spinlock.h | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/arch/arm/include/asm/spinlock.h b/arch/arm/include/asm/spinlock.h
> index 099c78fcf62d..8f009e788ad4 100644
> --- a/arch/arm/include/asm/spinlock.h
> +++ b/arch/arm/include/asm/spinlock.h
> @@ -210,11 +210,12 @@ static inline void arch_read_lock(arch_rwlock_t *rw)
>
> prefetchw(&rw->lock);
> __asm__ __volatile__(
> +" .syntax unified\n"
> "1: ldrex %0, [%2]\n"
> " adds %0, %0, #1\n"
> " strexpl %1, %0, [%2]\n"
> WFE("mi")
> -" rsbpls %0, %1, #0\n"
> +" rsbspl %0, %1, #0\n"
> " bmi 1b"
> : "=&r" (tmp), "=&r" (tmp2)
> : "r" (&rw->lock)
> --
> 2.20.1
>
>
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH v2 2/3] ARM: uaccess: use unified assembler language syntax
2019-01-05 16:12 ` Nicolas Pitre
@ 2019-01-07 21:50 ` Stefan Agner
-1 siblings, 0 replies; 16+ messages in thread
From: Stefan Agner @ 2019-01-07 21:50 UTC (permalink / raw)
To: Nicolas Pitre
Cc: linux, ndesaulniers, natechancellor, arnd, ard.biesheuvel,
peterz, mingo, will.deacon, julien.thierry, mark.rutland,
linux-kernel, linux-arm-kernel
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
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH v2 2/3] ARM: uaccess: use unified assembler language syntax
@ 2019-01-07 21:50 ` Stefan Agner
0 siblings, 0 replies; 16+ messages in thread
From: Stefan Agner @ 2019-01-07 21:50 UTC (permalink / raw)
To: Nicolas Pitre
Cc: mark.rutland, arnd, ard.biesheuvel, peterz, will.deacon,
julien.thierry, ndesaulniers, linux, linux-kernel, mingo,
natechancellor, linux-arm-kernel
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
^ permalink raw reply [flat|nested] 16+ messages in thread
end of thread, other threads:[~2019-01-07 21:51 UTC | newest]
Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-03 21:48 [PATCH v2 0/3] ARM: trivial assembly fixes to enable LLVM as Stefan Agner
2019-01-03 21:48 ` Stefan Agner
2019-01-03 21:48 ` [PATCH v2 1/3] ARM: fix argument count to match macro definition Stefan Agner
2019-01-03 21:48 ` Stefan Agner
2019-01-05 16:05 ` Nicolas Pitre
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-03 21:48 ` Stefan Agner
2019-01-05 16:12 ` Nicolas Pitre
2019-01-05 16:12 ` Nicolas Pitre
2019-01-07 21:50 ` Stefan Agner
2019-01-07 21:50 ` Stefan Agner
2019-01-03 21:48 ` [PATCH v2 3/3] ARM: spinlock: " Stefan Agner
2019-01-03 21:48 ` Stefan Agner
2019-01-05 16:13 ` Nicolas Pitre
2019-01-05 16:13 ` Nicolas Pitre
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.