[PATCH v2 1/7] arm: lib: remove leading whitespace in bitop macro

Mark Rutland mark.rutland at arm.com
Tue Jan 25 03:31:54 PST 2022


The `bitop` macro is used to create assembly functions for bit
operations, handling all the boilderplate such as ENTRY(), ENDPROC(),
etc.

Within the `bitop` macro, the argument to ENTRY() has leading whitespace
for alignment, but there is no leading whitespace for the argument to
ENDPROC().

The leading whitespace in the argument to ENTRY() prevents the value
from safely being token-pasted to form a longer symbol name, as
subsequent patches will need to do, where the value will be passed into
a new SYM_ENTRY_AT() macro:

  ENTRY(name)
  -> SYM_FUNC_START(name)
  -> SYM_START(name, [...])
  -> SYM_START_AT(name, [...])
  -> SYM_ENTRY_AT(name, [...])

... where SYM_ENTRY_AT() will token-paste name to form a local label
used by later macros:

| .set .L____sym_entry__##name, location ASM_NL

... but as this happens before assembler macros are evaluated, and
`name` will expand to `\name`, the token-pasting will retain the leading
space:

| .L____sym_entry__ \name

... and when evaluated within an assembler macro this will result in
build errors:

| [mark at lakrids:~/src/linux]% git clean -qfdx
| [mark at lakrids:~/src/linux]% usekorg 10.3.0 make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- -s multi_v7_defconfig
| [mark at lakrids:~/src/linux]% usekorg 10.3.0 make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- -s arch/arm/lib
| arch/arm/lib/changebit.S: Assembler messages:
| arch/arm/lib/changebit.S:12: Error: expected comma after ".L____sym_entry__"
| make[1]: *** [scripts/Makefile.build:388: arch/arm/lib/changebit.o] Error 1
| make: *** [Makefile:1846: arch/arm/lib] Error 2

This patch removes the leading space such that the name can be
token-pasted.

There should be no functional change as a result of this patch.

Signed-off-by: Mark Rutland <mark.rutland at arm.com>
Cc: Russell King <linux at armlinux.org.uk>
Cc: Will Deacon <will at kernel.org>
---
 arch/arm/lib/bitops.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/arm/lib/bitops.h b/arch/arm/lib/bitops.h
index 95bd359912889..36195edeb0b9f 100644
--- a/arch/arm/lib/bitops.h
+++ b/arch/arm/lib/bitops.h
@@ -4,7 +4,7 @@
 
 #if __LINUX_ARM_ARCH__ >= 6
 	.macro	bitop, name, instr
-ENTRY(	\name		)
+ENTRY(\name		)
 UNWIND(	.fnstart	)
 	ands	ip, r1, #3
 	strbne	r1, [ip]		@ assert word-aligned
@@ -29,7 +29,7 @@ ENDPROC(\name		)
 	.endm
 
 	.macro	testop, name, instr, store
-ENTRY(	\name		)
+ENTRY(\name		)
 UNWIND(	.fnstart	)
 	ands	ip, r1, #3
 	strbne	r1, [ip]		@ assert word-aligned
@@ -59,7 +59,7 @@ ENDPROC(\name		)
 	.endm
 #else
 	.macro	bitop, name, instr
-ENTRY(	\name		)
+ENTRY(\name		)
 UNWIND(	.fnstart	)
 	ands	ip, r1, #3
 	strbne	r1, [ip]		@ assert word-aligned
@@ -86,7 +86,7 @@ ENDPROC(\name		)
  * to avoid dirtying the data cache.
  */
 	.macro	testop, name, instr, store
-ENTRY(	\name		)
+ENTRY(\name		)
 UNWIND(	.fnstart	)
 	ands	ip, r1, #3
 	strbne	r1, [ip]		@ assert word-aligned
-- 
2.30.2




More information about the linux-arm-kernel mailing list