iPhone组装,LDR参数编译错误 [英] iPhone assembly, compilation error with LDR parameters

查看:18
本文介绍了iPhone组装,LDR参数编译错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 XCode 4.2 和 Apple LLVM 编译器 3.0(无拇指)编译一些汇编代码(作为 Theora 库的一部分),但 ldr(ne) 指令中存在一些错误:

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) instructions:

.text
.set DEC_OPB, 0xC944
ldrne   r2, =258014     @ ERROR: Unsupported relocation on symbol L0. ERROR: Undefined local symbol 0 (0f or 0b)
ldr r6, =0x00800080     @ ERROR: Unsupported relocation on symbol L0.
ldr r5, =DEC_OPB        @ ERROR: Unsupported relocation on symbol L0. ERROR: Undefined local symbol 0 (0f or 0b)
ldr r5, DEC_OPB         @ ERROR: Bad immediate value for offset (51024). ERROR: Unsupported relocation on symbol (null)

是否可以用其他一些指令覆盖这些行?或者用常量替换它们?请帮忙,因为这篇文章 llvm-gcc assembler: LDR syntax 没有帮助我来解决这个问题.

Is it possible to override those lines with some other instructions? Or to replace them with constants? Please help, because this post llvm-gcc assembler: LDR syntax didn't help me to solve this problem.

推荐答案

.text 
.set DEC_OPB, 0xC944 
ldrne r2,r2num 
ldr r6,r6num 
ldr r5,r5num 
...

r2num: .word 258014
r6num: .word 0x00800080
r5num: .word DEC_OPB

当你执行 ldr r2,=0x1234 时,汇编器会寻找附近的一个地方来放置那个数字,然后使用一个 pc 相对地址来加载它.如果汇编程序找不到您出错的地方,我不知道这是否是投诉的内容.听起来不像是正确的错误.上面的两种解决方案是显式放置值而不依赖于汇编器,或者将 .pool 或其他类似指令放在分支阴影或其他一些不会执行的地方以鼓励汇编器使用它放置这些类型的常量.

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.

这篇关于iPhone组装,LDR参数编译错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆