混合ARM和Thumb指令 [英] Mixing ARM and THUMB instructions

查看:307
本文介绍了混合ARM和Thumb指令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在我的组装code混合ARM和Thumb指令。例如,在下面的code我尝试使用这两种模式:

  .thumb @。code 16
.section伪__TEXT,__文本
.globl mySymbol1
mySymbol1:
 ....
.ARM @。code 32
.section伪__TEXT,__文本
.globl mySymbol2
mySymbol2:
...

现在,按我的理解,当我编译这个code到库中,并通过纳米运行它, mysymbol1 应显示为手臂和 mysymbol2 应显示为拇指,即

  0000xxxx(__TEXT,__文本)外部mySymbol1
0000yyyy(__TEXT,__文本)外部[拇指] mySymbol2

但两者都显示为手臂。我缺少的是在这里吗?我的汇编指令是:

 为-arch的ARMv7 -o a.o A.S


解决方案

您需要.thumb_func拇指标签之前他们是拇指的目标,否则GNU工具将会把它作为一个手臂的目标。 (是的,你所需要的.thumb一次.thumb_func你想要作为一个拇指目标来使用每个标签)。许多例子 http://github.com/dwelch67

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

解决方案

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屋!

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