混合使用 ARM 和 THUMB 指令 [英] Mixing ARM and THUMB instructions
问题描述
我试图在我的汇编代码中混合使用 ARM 和 THUMB 指令.例如,在下面的代码中,我尝试使用两种模式:
I am trying to mix ARM and THUMB instructions in my assembly code. For example, in the following code I try to use both modes:
.thumb @ .code 16
.section __TEXT,__text
.globl mySymbol1
mySymbol1:
....
.arm @ .code 32
.section __TEXT,__text
.globl mySymbol2
mySymbol2:
...
现在,根据我的理解,当我将此代码编译成库并通过 nm 运行时,mysymbol1
应显示为 arm,mysymbol2
应显示为拇指,即,
Now, as per my understanding when I compile this code into a library and run it through nm, mysymbol1
should show up as arm and mysymbol2
should show up as thumb, i.e,
0000xxxx (__TEXT,__text) external mySymbol1
0000yyyy (__TEXT,__text) external [Thumb] mySymbol2
但两者都显示为手臂.我在这里错过了什么?我的汇编命令是:
But both are showing up as arm. What am I missing here? My assembler command is:
as -arch armv7 -o a.o a.s
推荐答案
您需要在拇指标签之前使用 .thumb_func 才能将它们作为拇指目标,否则 gnu 工具会将其视为 arm 目标.(是的,对于要用作拇指目标的每个标签,您都需要 .thumb 一次和 .thumb_func).许多例子http://github.com/dwelch67
you need .thumb_func before the thumb labels for them to be thumb targets otherwise the gnu tools will treat it as an arm target. (yes you need the .thumb once AND .thumb_func for EVERY label you want to use as a thumb target). Many examples http://github.com/dwelch67
这篇关于混合使用 ARM 和 THUMB 指令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!