From 58b2e457824dc93916233627b98614409e5f258d Mon Sep 17 00:00:00 2001 From: Aidan MacDonald Date: Thu, 23 Mar 2023 18:16:15 +0000 Subject: Fix unified syntax in ARM inline assembly GCC 4.9 always emits assembly with divided syntax. Setting unified syntax in inline assembly causes the assembler to complain about GCC's generated code, because the directive extends past the scope of the inline asm. Fix this by setting divided mode at the end of the inline assembly block. The assembler directives are hidden behind macros because later versions of GCC won't need this workaround: they can be told to use the unified syntax with -masm-syntax-unified. Change-Id: Ic09e729e5bbb6fd44d08dac348daf6f55c75d7d8 --- firmware/export/config.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'firmware/export/config.h') diff --git a/firmware/export/config.h b/firmware/export/config.h index 19ee03b4c7..49cd6d610c 100644 --- a/firmware/export/config.h +++ b/firmware/export/config.h @@ -1005,6 +1005,16 @@ Lyre prototype 1 */ #define ROCKBOX_STRICT_ALIGN 1 #endif +/* + * 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 + */ +#define BEGIN_ARM_ASM_SYNTAX_UNIFIED ".syntax unified\n" +#define END_ARM_ASM_SYNTAX_UNIFIED ".syntax divided\n" + #if defined(CPU_ARM) && defined(__ASSEMBLER__) .syntax unified /* ARMv4T doesn't switch the T bit when popping pc directly, we must use BX */ -- cgit v1.2.3