]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
ARM: 8723/2: always assume the "unified" syntax for assembly code
authorNicolas Pitre <nicolas.pitre@linaro.org>
Wed, 29 Nov 2017 06:52:52 +0000 (07:52 +0100)
committerRussell King <rmk+kernel@armlinux.org.uk>
Sun, 17 Dec 2017 22:14:21 +0000 (22:14 +0000)
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@arm.com>
Signed-off-by: Nicolas Pitre <nico@linaro.org>
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
arch/arm/Kconfig
arch/arm/Makefile
arch/arm/include/asm/unified.h

index 51c8df5610777459c727e30cc65ef6fe7aa41b66..438231500510508f029ff63af2c75604abd55b32 100644 (file)
@@ -1524,12 +1524,10 @@ config THUMB2_KERNEL
        bool "Compile the kernel in Thumb-2 mode" if !CPU_THUMBONLY
        depends on (CPU_V7 || CPU_V7M) && !CPU_V6 && !CPU_V6K
        default y if CPU_THUMBONLY
-       select ARM_ASM_UNIFIED
        select ARM_UNWIND
        help
          By enabling this option, the kernel will be compiled in
-         Thumb-2 mode. A compiler/assembler that understand the unified
-         ARM-Thumb syntax is needed.
+         Thumb-2 mode.
 
          If unsure, say N.
 
@@ -1564,9 +1562,6 @@ config THUMB2_AVOID_R_ARM_THM_JUMP11
 
          Unless you are sure your tools don't have this problem, say Y.
 
-config ARM_ASM_UNIFIED
-       bool
-
 config ARM_PATCH_IDIV
        bool "Runtime patch udiv/sdiv instructions into __aeabi_{u}idiv()"
        depends on CPU_32v7 && !XIP_KERNEL
index 80351e505fd57aeb0413a80e61214e341a3e2f48..e83f5161fdd883158decaa02c7545c68731faca7 100644 (file)
@@ -115,9 +115,11 @@ ifeq ($(CONFIG_ARM_UNWIND),y)
 CFLAGS_ABI     +=-funwind-tables
 endif
 
+# Accept old syntax despite ".syntax unified"
+AFLAGS_NOWARN  :=$(call as-option,-Wa$(comma)-mno-warn-deprecated,-Wa$(comma)-W)
+
 ifeq ($(CONFIG_THUMB2_KERNEL),y)
 AFLAGS_AUTOIT  :=$(call as-option,-Wa$(comma)-mimplicit-it=always,-Wa$(comma)-mauto-it)
-AFLAGS_NOWARN  :=$(call as-option,-Wa$(comma)-mno-warn-deprecated,-Wa$(comma)-W)
 CFLAGS_ISA     :=-mthumb $(AFLAGS_AUTOIT) $(AFLAGS_NOWARN)
 AFLAGS_ISA     :=$(CFLAGS_ISA) -Wa$(comma)-mthumb
 # Work around buggy relocation from gas if requested:
@@ -125,7 +127,7 @@ ifeq ($(CONFIG_THUMB2_AVOID_R_ARM_THM_JUMP11),y)
 KBUILD_CFLAGS_MODULE   +=-fno-optimize-sibling-calls
 endif
 else
-CFLAGS_ISA     :=$(call cc-option,-marm,)
+CFLAGS_ISA     :=$(call cc-option,-marm,) $(AFLAGS_NOWARN)
 AFLAGS_ISA     :=$(CFLAGS_ISA)
 endif
 
index a91ae499614cbb5e1c23a646a04082026bec061f..2c3b952be63ebbc536d767798eb21dfba153d25b 100644 (file)
 #ifndef __ASM_UNIFIED_H
 #define __ASM_UNIFIED_H
 
-#if defined(__ASSEMBLY__) && defined(CONFIG_ARM_ASM_UNIFIED)
+#if defined(__ASSEMBLY__)
        .syntax unified
+#else
+__asm__(".syntax unified");
 #endif
 
 #ifdef CONFIG_CPU_V7M
 
 #endif /* CONFIG_THUMB2_KERNEL */
 
-#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 */