LLVM-GCC汇编:LDR语法 [英] llvm-gcc assembler: LDR syntax
本文介绍了LLVM-GCC汇编:LDR语法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这code编译GCC的就好,但使用LLVM(LLVM-GCC)的时候,它说恒恩pression预期的
的与 LDR
问题的语法是:我如何指定我的数组的地方?我不想硬code以字节为单位的位移: LDR R7,[PC,#some_shift]
而是要用文字来保持code清洁和安全。
不知道如何使它工作?
.globl FUNC_NAMEFUNC_NAME:
推{R4,R5,R6,R7,R8,R9,SL,FP,IP,LR}// [剥离一些code] 添加R6,R6,SL,LSL#2
子IP,IP,SL
LDR R7,= maskTable //这崩溃
加SL,SL,#4 @为0x4//有些剥离code在这里 MOV R0,#0 @为0x0 //返回0
弹出{R4,R5,R6,R7,R8,R9,SL,FP,IP,PC} .word 00000000。数据
.align伪5
maskTable: .word 00000000,00000000,00000000,00000000
.word 0x0000FFFF,00000000,00000000,00000000
.word为0xFFFFFFFF,00000000,00000000,00000000
解决方案
尝试更改
LDR R7,= maskTable
到
LDR R7,maskTable
和删除
。数据
部分。这似乎是海湾合作委员会℃的错误/丢失能力; 4.6对付。数据
部分
This code compiles just fine on gcc, but when using llvm (llvm-gcc), it says "constant expression expected"
on the line with ldr
The problem is the syntax: How do I specify the place where my array is? I do not want to hard-code the displacement in bytes: ldr r7, [pc, #some_shift]
but to use a literal to keep the code clean and safe.
Any idea how to make it working?
.globl func_name
func_name:
push {r4, r5, r6, r7, r8, r9, sl, fp, ip, lr}
//[Some stripped code]
add r6, r6, sl, lsl #2
sub ip, ip, sl
ldr r7, =maskTable // Here it crashes
add sl, sl, #4 @ 0x4
// Some stripped code here
mov r0, #0 @ 0x0 // return 0
pop {r4, r5, r6, r7, r8, r9, sl, fp, ip, pc}
.word 0x00000000
.data
.align 5
maskTable:
.word 0x00000000, 0x00000000, 0x00000000, 0x00000000
.word 0x0000FFFF, 0x00000000, 0x00000000, 0x00000000
.word 0xFFFFFFFF, 0x00000000, 0x00000000, 0x00000000
解决方案
Try changing
ldr r7, =maskTable
to
ldr r7, maskTable
and remove
.data
section. It seems to be a bug/missing capability of gcc < 4.6 to deal with .data
section
这篇关于LLVM-GCC汇编:LDR语法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文