Pseudo op "ldr Rx, =#imm" doesn't work for hi regs
Not sure if I'm missing something so I haven't filed a bug report. This code appears to compile incorrectly.
int main (int argc, char **argv) {
asm volatile ("ldr r6, =#8\n\t"
return 0;
}
Compiled with: arm-none-eabi-gcc -march=armv7-m -mthumb -nostartfiles -nostdlib test.c
Generates this assembly:
0x60 <main+12> movs r6, #8
0x62 <main+14> cmp r0, #8
0x64 <main+16> cmp r1, #8
The movs also appears to be a bug as it updates the flags when it shouldn't. It seems this has already been reported and fixed in bug #1682620. For hi regs >7 it appears to fail to recognize this and generates a 16-bit instruction rather than the 32-bit variant. Register bitfield appears to overflow into bit 11 and generate a cmp instruction.
(gdb) x/3xh 0x60
0x60 <main+12>: 0x2608 0x2808 0x2908
Compiling with the following version: arm-none-eabi-gcc (15:4.9.
Maybe this has already been fixed? Let me know where to find a newer version to test, any help is appreciated.
Thanks,
Elliot
Question information
- Language:
- English Edit question
- Status:
- Solved
- Assignee:
- No assignee Edit question
- Solved by:
- Elliot Buller
- Solved:
- Last query:
- Last reply: