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

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

问题描述

我正在尝试在我的汇编代码中混合使用 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 应该显示为 thumb,即,

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 标签前加上 .thumb_func 才能让它们成为 thumb 目标,否则 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屋!

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