根据http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0056d/Cihcciij.html
,如果我的ARM汇编代码需要访问名为的C全局变量globvar,我应该使用import和load类似的说明:
AREA globals,CODE,READONLY
EXPORT asmsubroutine
IMPORT globvar
asmsubroutine
LDR r1, =globvar ; read address of globvar into
; r1 from literal pool
LDR r0, [r1]
ADD r0, r0, #2
STR r0, [r1]
MOV pc, lr
END
Run Code Online (Sandbox Code Playgroud)
,但是当我在代码中使用它时,出现"bad instructionimport globvar'"` 错误。我使用的是armv7-android-gcc编译器。我也在这个论坛中寻找类似的问题,但没有得到有用的结果,那么有人可以帮我解决这个问题吗?非常感谢。