1
0
Fork 0
forked from len0rd/rockbox

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
This commit is contained in:
Aidan MacDonald 2023-03-23 18:16:15 +00:00
parent 86429dbf1e
commit 58b2e45782
7 changed files with 28 additions and 9 deletions

View file

@ -218,7 +218,7 @@ void fiq_handler(void)
* r0-r3 and r12 is a working register.
*/
asm volatile (
".syntax unified \n"
BEGIN_ARM_ASM_SYNTAX_UNIFIED
"sub lr, lr, #4 \n"
"stmfd sp!, { r0-r3, lr } \n" /* stack scratch regs and lr */
"mov r14, #0 \n" /* Was the callback called? */
@ -274,6 +274,7 @@ void fiq_handler(void)
"bhi .fill_fifo \n" /* not stop and enough? refill */
"ldmfd sp!, { r0-r3, pc }^ \n" /* exit */
".ltorg \n"
END_ARM_ASM_SYNTAX_UNIFIED
: : "i"(PCM_DMAST_OK), "i"(PCM_DMAST_STARTED)
);
}

View file

@ -327,7 +327,7 @@ void fiq_playback(void)
*/
asm volatile (
/* No external calls */
".syntax unified \n"
BEGIN_ARM_ASM_SYNTAX_UNIFIED
"sub lr, lr, #4 \n" /* Prepare return address */
"stmfd sp!, { lr } \n" /* stack lr so we can use it */
"ldr r12, =0xcf001040 \n" /* Some magic from iPodLinux ... */
@ -395,6 +395,7 @@ void fiq_playback(void)
"bne 3b \n" /* no? -> go return */
"b 2b \n" /* yes -> get even more */
".ltorg \n"
END_ARM_ASM_SYNTAX_UNIFIED
: /* These must only be integers! No regs */
: "i"(PCM_DMAST_OK), "i"(PCM_DMAST_STARTED));
}