Alexey Pelykh

.ltorg and relative address issues

Discussion created by Alexey Pelykh on Apr 1, 2013

Here's part of source file:




    ldr        r3,=0x7FFFFFF

    ldr        r3,=0x8000001

    ldr        r3,=0x8000000

    ldr        r5,=0x8000000

    ldr        r5,=0x8000001


Compiled version looks like:

0x00002e34:    ldr r3,[pc,#0x250]

0x00002e38:    ldr r3,[pc,#0x250]

0x00002e3c:    ldr r3,0x00003514 (0x3514)
0x00002e40:    ldr r5,0x0000351C (0x351c)

0x00002e44:    ldr r5,[pc,#0x244]

As you can see, mwasmarm produces incorrect instructions. This issue is connected with ltorg for sure, since if to move these instuctions around, this issue fixes by itself. Probably this is issue in mwasmarm itself, since in this situation seems that it behaves itself too smart. Has anyone experienced similar issue?