Mixing ARM and THUMB instructions

落花浮王杯 提交于 2019-12-19 09:24:21

问题


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:
...

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

回答1:


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



来源:https://stackoverflow.com/questions/11526062/mixing-arm-and-thumb-instructions

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!