[PATCH 07/10] ARM: always assume the unified syntax for assembly code

Sascha Hauer s.hauer at pengutronix.de
Wed Sep 25 06:55:30 PDT 2024


Adoption of Linux Commit:

| commit 75fea300d73ae5b18957949a53ec770daaeb6fc2
| Author: Nicolas Pitre <nico at fluxnic.net>
| Date:   Wed Nov 29 07:52:52 2017 +0100
|
|     ARM: 8723/2: always assume the "unified" syntax for assembly code
|
|     The GNU assembler has implemented the "unified syntax" parsing since
|     2005. This "unified" syntax is required when the kernel is built in
|     Thumb2 mode. However the "unified" syntax is a mixed bag of features,
|     including not requiring a `#' prefix with immediate operands. This leads
|     to situations where some code builds just fine in Thumb2 mode and fails
|     to build in ARM mode if that prefix is missing. This behavior
|     discrepancy makes build tests less valuable, forcing both ARM and Thumb2
|     builds for proper coverage.
|
|     Let's "fix" this issue by always using the "unified" syntax for both ARM
|     and Thumb2 mode. Given that the documented minimum binutils version that
|     properly builds the kernel is version 2.20 released in 2010, we can
|     assume that any toolchain capable of building the latest kernel is also
|     "unified syntax" capable.
|
|     Whith this, a bunch of macros used to mask some differences between both
|     syntaxes can be removed, with the side effect of making LTO easier.
|
|     Suggested-by: Robin Murphy <robin.murphy at arm.com>
|     Signed-off-by: Nicolas Pitre <nico at linaro.org>
|     Signed-off-by: Russell King <rmk+kernel at armlinux.org.uk>

Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
 arch/arm/Kconfig                  |  4 ---
 arch/arm/Makefile                 |  3 ++
 arch/arm/include/asm/unified.h    | 75 +--------------------------------------
 arch/arm/lib32/io-readsb.S        |  2 --
 arch/arm/lib32/io-readsl.S        |  2 --
 arch/arm/lib32/io-readsw-armv4.S  |  2 --
 arch/arm/lib32/io-writesb.S       |  2 --
 arch/arm/lib32/io-writesl.S       |  2 --
 arch/arm/lib32/io-writesw-armv4.S |  2 --
 arch/arm/lib32/lib1funcs.S        |  2 --
 10 files changed, 4 insertions(+), 92 deletions(-)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 9b90c8009a..0251f2dcef 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -286,9 +286,6 @@ config BOARD_ARM_GENERIC_DT_AARCH64
 	depends on BOARD_ARM_GENERIC_DT
 	default y
 
-config ARM_ASM_UNIFIED
-	bool
-
 config AEABI
 	bool "Use the ARM EABI to compile barebox"
 	depends on !CPU_V8
@@ -299,7 +296,6 @@ config AEABI
 	  To use this you need GCC version 4.0.0 or later.
 
 config THUMB2_BAREBOX
-	select ARM_ASM_UNIFIED
 	select AEABI
 	depends on !ARCH_TEGRA && !ARCH_AT91
 	depends on CPU_V7 && !CPU_32v4T && !CPU_32v5 && !CPU_32v6
diff --git a/arch/arm/Makefile b/arch/arm/Makefile
index 6785432c52..1c20e9b508 100644
--- a/arch/arm/Makefile
+++ b/arch/arm/Makefile
@@ -37,6 +37,9 @@ KBUILD_CFLAGS += -mstrict-align
 KBUILD_CFLAGS += -mgeneral-regs-only
 endif
 
+# Accept old syntax despite ".syntax unified"
+AFLAGS_NOWARN	:=$(call as-option,-Wa$(comma)-mno-warn-deprecated,-Wa$(comma)-W)
+
 # This selects which instruction set is used.
 # Note that GCC does not numerically define an architecture version
 # macro, but instead defines a whole series of macros which makes
diff --git a/arch/arm/include/asm/unified.h b/arch/arm/include/asm/unified.h
index 5501d7f703..68b1deecfb 100644
--- a/arch/arm/include/asm/unified.h
+++ b/arch/arm/include/asm/unified.h
@@ -6,7 +6,7 @@
 #ifndef __ASM_UNIFIED_H
 #define __ASM_UNIFIED_H
 
-#if defined(__ASSEMBLY__) && defined(CONFIG_ARM_ASM_UNIFIED)
+#if defined(__ASSEMBLY__) && defined(CONFIG_CPU_32)
 	.syntax unified
 #endif
 
@@ -40,77 +40,4 @@
 
 #endif	/* CONFIG_THUMB2_BAREBOX */
 
-#ifndef CONFIG_ARM_ASM_UNIFIED
-
-/*
- * If the unified assembly syntax isn't used (in ARM mode), these
- * macros expand to an empty string
- */
-#ifdef __ASSEMBLY__
-	.macro	it, cond
-	.endm
-	.macro	itt, cond
-	.endm
-	.macro	ite, cond
-	.endm
-	.macro	ittt, cond
-	.endm
-	.macro	itte, cond
-	.endm
-	.macro	itet, cond
-	.endm
-	.macro	itee, cond
-	.endm
-	.macro	itttt, cond
-	.endm
-	.macro	ittte, cond
-	.endm
-	.macro	ittet, cond
-	.endm
-	.macro	ittee, cond
-	.endm
-	.macro	itett, cond
-	.endm
-	.macro	itete, cond
-	.endm
-	.macro	iteet, cond
-	.endm
-	.macro	iteee, cond
-	.endm
-#else	/* !__ASSEMBLY__ */
-__asm__(
-"	.macro	it, cond\n"
-"	.endm\n"
-"	.macro	itt, cond\n"
-"	.endm\n"
-"	.macro	ite, cond\n"
-"	.endm\n"
-"	.macro	ittt, cond\n"
-"	.endm\n"
-"	.macro	itte, cond\n"
-"	.endm\n"
-"	.macro	itet, cond\n"
-"	.endm\n"
-"	.macro	itee, cond\n"
-"	.endm\n"
-"	.macro	itttt, cond\n"
-"	.endm\n"
-"	.macro	ittte, cond\n"
-"	.endm\n"
-"	.macro	ittet, cond\n"
-"	.endm\n"
-"	.macro	ittee, cond\n"
-"	.endm\n"
-"	.macro	itett, cond\n"
-"	.endm\n"
-"	.macro	itete, cond\n"
-"	.endm\n"
-"	.macro	iteet, cond\n"
-"	.endm\n"
-"	.macro	iteee, cond\n"
-"	.endm\n");
-#endif	/* __ASSEMBLY__ */
-
-#endif	/* CONFIG_ARM_ASM_UNIFIED */
-
 #endif	/* !__ASM_UNIFIED_H */
diff --git a/arch/arm/lib32/io-readsb.S b/arch/arm/lib32/io-readsb.S
index 2777a49b22..66a89074bf 100644
--- a/arch/arm/lib32/io-readsb.S
+++ b/arch/arm/lib32/io-readsb.S
@@ -7,8 +7,6 @@
 #include <linux/linkage.h>
 #include <asm/assembler.h>
 
-.syntax unified
-
 .section .text.__raw_readsb
 
 .Linsb_align:	rsb	ip, ip, #4
diff --git a/arch/arm/lib32/io-readsl.S b/arch/arm/lib32/io-readsl.S
index aecac1f9eb..6c01cb5dfa 100644
--- a/arch/arm/lib32/io-readsl.S
+++ b/arch/arm/lib32/io-readsl.S
@@ -7,8 +7,6 @@
 #include <linux/linkage.h>
 #include <asm/assembler.h>
 
-.syntax unified
-
 .section .text.__raw_readsl
 
 ENTRY(__raw_readsl)
diff --git a/arch/arm/lib32/io-readsw-armv4.S b/arch/arm/lib32/io-readsw-armv4.S
index f5c633027c..b82ec390e9 100644
--- a/arch/arm/lib32/io-readsw-armv4.S
+++ b/arch/arm/lib32/io-readsw-armv4.S
@@ -7,8 +7,6 @@
 #include <linux/linkage.h>
 #include <asm/assembler.h>
 
-.syntax unified
-
 		.macro	pack, rd, hw1, hw2
 #ifndef __ARMEB__
 		orr	\rd, \hw1, \hw2, lsl #16
diff --git a/arch/arm/lib32/io-writesb.S b/arch/arm/lib32/io-writesb.S
index 0bfb1f914e..e90fa9e340 100644
--- a/arch/arm/lib32/io-writesb.S
+++ b/arch/arm/lib32/io-writesb.S
@@ -7,8 +7,6 @@
 #include <linux/linkage.h>
 #include <asm/assembler.h>
 
-.syntax unified
-
 		.macro	outword, rd
 #ifndef __ARMEB__
 		strb	\rd, [r0]
diff --git a/arch/arm/lib32/io-writesl.S b/arch/arm/lib32/io-writesl.S
index c300a62daf..8f7128589d 100644
--- a/arch/arm/lib32/io-writesl.S
+++ b/arch/arm/lib32/io-writesl.S
@@ -7,8 +7,6 @@
 #include <linux/linkage.h>
 #include <asm/assembler.h>
 
-.syntax unified
-
 .section .text.__raw_writesl
 
 ENTRY(__raw_writesl)
diff --git a/arch/arm/lib32/io-writesw-armv4.S b/arch/arm/lib32/io-writesw-armv4.S
index 717237f3cc..9c478f5696 100644
--- a/arch/arm/lib32/io-writesw-armv4.S
+++ b/arch/arm/lib32/io-writesw-armv4.S
@@ -7,8 +7,6 @@
 #include <linux/linkage.h>
 #include <asm/assembler.h>
 
-.syntax unified
-
 		.macro	outword, rd
 #ifndef __ARMEB__
 		strh	\rd, [r0]
diff --git a/arch/arm/lib32/lib1funcs.S b/arch/arm/lib32/lib1funcs.S
index cd8af72737..7e402df1cd 100644
--- a/arch/arm/lib32/lib1funcs.S
+++ b/arch/arm/lib32/lib1funcs.S
@@ -37,8 +37,6 @@ Boston, MA 02111-1307, USA.  */
 #include <asm/assembler.h>
 #include <asm/unwind.h>
 
-.syntax unified
-
 .macro ARM_DIV_BODY dividend, divisor, result, curbit
 
 #if __LINUX_ARM_ARCH__ >= 5

-- 
2.39.5




More information about the barebox mailing list