Comment 4 for bug 1379250

Revision history for this message
Thomas Preud'homme (thomas-preudhomme) wrote :

Hi demiurg_spb,

The reason for this error is that inline assembly is considered divided for Thumb-1 instead of unified. This has nothing to do with lto (I can reproduce with your example without -flto). What happens is that the compiler will prefix the inline assembly with .syntax divided and thus the assembler will expect sub instead of subs.

Case #2 is explained by the fact that Thumb-2 will use unified syntax by default for inline assembly. When compiling for Cortex-M3, you are targeting Thumb-2 so the compiler will prefix the inline assembly with .syntax unified.

I'm not sure what you mean by LST and LSS in case #3 but I guess it's some form of disassembly. The reason for this is that this difference of syntax is only relevant to the assembler. sub in divided syntax is the same instruction as subs in unified syntax. It's akin to the difference between x:=1 in one programming language when another uses x=1. Once assembled, it's the same underlying instruction. The disassembler will choose one syntax to display its work which is independent to the one you used for the assembler. In this example the assembler gets fed divided syntax (sub) and the disassembler prefer to display unified syntax (subs).

Hope this helps.

Best regards.