From 8c86fb6da0b9c068ee4b4220dee11171e322f67f Mon Sep 17 00:00:00 2001 From: Solomon Peachy Date: Wed, 24 May 2023 09:37:20 -0400 Subject: arm: Use -masm-syntax-unified when compiling with gcc8 or newer Annoyingly, this makes all of the '.S' files we compile get treated as divided syntax, so we need to make the syntax in them explicit. Change-Id: I56a3916b7b24c84a1214a5d6bc4ed4d651f002cf --- firmware/asm/arm/lcd-as-memframe.S | 2 ++ firmware/asm/arm/memcpy.S | 2 ++ firmware/asm/arm/memmove.S | 2 ++ firmware/asm/arm/memset.S | 2 ++ firmware/asm/arm/memset16.S | 2 ++ firmware/export/config.h | 12 ++++++++++-- firmware/target/arm/ata-as-arm.S | 1 + 7 files changed, 21 insertions(+), 2 deletions(-) (limited to 'firmware') diff --git a/firmware/asm/arm/lcd-as-memframe.S b/firmware/asm/arm/lcd-as-memframe.S index d42b2a920d..f69f6e5080 100644 --- a/firmware/asm/arm/lcd-as-memframe.S +++ b/firmware/asm/arm/lcd-as-memframe.S @@ -24,6 +24,8 @@ #include "config.h" #include "cpu.h" + .syntax unified + /**************************************************************************** * void lcd_copy_buffer_rect(fb_data *dst, fb_data *src, int width, * int height); diff --git a/firmware/asm/arm/memcpy.S b/firmware/asm/arm/memcpy.S index 86fc6b7930..1fbb6660e9 100644 --- a/firmware/asm/arm/memcpy.S +++ b/firmware/asm/arm/memcpy.S @@ -35,6 +35,8 @@ #define push lsr #endif + .syntax unified + /* Prototype: void *memcpy(void *dest, const void *src, size_t n); */ /* Prototype: void *mempcpy(void *dest, const void *src, size_t n); */ diff --git a/firmware/asm/arm/memmove.S b/firmware/asm/arm/memmove.S index e5c9b42928..cf22a74622 100644 --- a/firmware/asm/arm/memmove.S +++ b/firmware/asm/arm/memmove.S @@ -35,6 +35,8 @@ #define push lsr #endif + .syntax unified + .text /* diff --git a/firmware/asm/arm/memset.S b/firmware/asm/arm/memset.S index d727f2a5ec..ef5cdb5819 100644 --- a/firmware/asm/arm/memset.S +++ b/firmware/asm/arm/memset.S @@ -20,6 +20,8 @@ ****************************************************************************/ #include "config.h" + .syntax unified + .section .icode,"ax",%progbits .align 2 diff --git a/firmware/asm/arm/memset16.S b/firmware/asm/arm/memset16.S index 226eac39e1..851b9207a2 100644 --- a/firmware/asm/arm/memset16.S +++ b/firmware/asm/arm/memset16.S @@ -20,6 +20,8 @@ ****************************************************************************/ #include "config.h" + .syntax unified + .section .icode,"ax",%progbits .align 2 diff --git a/firmware/export/config.h b/firmware/export/config.h index 80d59ea836..9812db9161 100644 --- a/firmware/export/config.h +++ b/firmware/export/config.h @@ -1018,14 +1018,19 @@ Lyre prototype 1 */ * These macros are for switching on unified syntax in inline assembly. * Older versions of GCC emit assembly in divided syntax with no option * to enable unified syntax. - * - * FIXME: This needs to be looked at after the toolchain bump */ +#if (__GNUC__ < 8) #define BEGIN_ARM_ASM_SYNTAX_UNIFIED ".syntax unified\n" #define END_ARM_ASM_SYNTAX_UNIFIED ".syntax divided\n" +#else +#define BEGIN_ARM_ASM_SYNTAX_UNIFIED +#define END_ARM_ASM_SYNTAX_UNIFIED +#endif #if defined(CPU_ARM) && defined(__ASSEMBLER__) +#if (__GNUC__ < 8) .syntax unified +#endif /* ARMv4T doesn't switch the T bit when popping pc directly, we must use BX */ .macro ldmpc cond="", order="ia", regs #if ARM_ARCH == 4 && defined(USE_THUMB) @@ -1043,6 +1048,9 @@ Lyre prototype 1 */ ldr\cond pc, [sp], #4 #endif .endm +#if (__GNUC__ < 8) +.syntax divided +#endif #endif #if defined(CPU_COLDFIRE) && defined(__ASSEMBLER__) diff --git a/firmware/target/arm/ata-as-arm.S b/firmware/target/arm/ata-as-arm.S index 16c2928bf1..cec4a7e235 100644 --- a/firmware/target/arm/ata-as-arm.S +++ b/firmware/target/arm/ata-as-arm.S @@ -21,6 +21,7 @@ #include "config.h" + .syntax unified #if CONFIG_CPU == PP5002 /* Causes ATA retries on iPod G3 probably related to improper controller -- cgit v1.2.3