iPhone assembly, compilation error with LDR parameters

后端 未结 2 1989
清酒与你
清酒与你 2020-12-10 23:23

I\'m trying to compile some assembly code (as part of Theora library) using XCode 4.2 and Apple LLVM compiller 3.0 (no thumb), but there are some errors in ldr(ne) instructi

相关标签:
2条回答
  • 2020-12-10 23:45
    .text 
    .set DEC_OPB, 0xC944 
    ldrne r2,r2num 
    ldr r6,r6num 
    ldr r5,r5num 
    ...
    
    r2num: .word 258014
    r6num: .word 0x00800080
    r5num: .word DEC_OPB
    

    when you do the ldr r2,=0x1234, the assembler looks for a place nearby to place that number and then uses a pc relative address to load it. If the assembler cannot find a place you get an error, I dont know if that is what the complaint was about. doesnt sound like the right error. The two solutions are the above where you explicitly place the values and not rely on the assembler, or you put a .pool or other similar directive in a branch shadow or some other place that you wont execute through to encourage the assembler to use it to place these kinds of constants.

    b somewhere
    .pool
    

    I suspect from the error message something else may be going. post a reply or edit or question if that is the case.

    0 讨论(0)
  • 2020-12-10 23:59

    The iOS assembler does not support the =258014 pseudo-immediate form. You will need to either replace these with loads from a constant pool, or split them into mov + movt.

    You should also file a bug report to request that support be added.

    0 讨论(0)
提交回复
热议问题