assembly - 如何运行 linaro 汇编程序以获取 thumb2 (T32) 指令

标签 assembly arm thumb linaro

我有一个带有一个 thumb2 (T32) 指令的简单汇编文件 (temp.S)。例如:
或 R4,R7,R8
我想用 linaro 汇编器组装它,但我找不到合适的标志来做到这一点。

如果我尝试:

arm-linux-gnueabihf-as -o temp.o temp.S  

然后我得到指令的 A32 版本的汇编

但是,如果我尝试:
arm-linux-gnueabihf-as -o temp.o -mthumb temp.S  

我收到错误消息
>  temp.S: Assembler messages:  
>  temp.S:1: Error: lo register required -- `orr R4,R7,R8  

就好像它在期待 T16 指令一样。

任何有关 T32 指令正确标志的帮助将不胜感激。

顺便说一下,我的汇编版本是:
GNU 汇编器(crosstool-NG linaro-1.13.1-4.8-2014.01 - Linaro GCC 2013.11)2.24.0.20131220

最佳答案

引自 Ubuntu wiki :

For historical reasons as does support a -mthumb command-line option, but it doesn't do what you want: this enables the older Thumb-1, which has it's own, incompatible syntax. To produce Thumb-2 code you still need to turn on unified assembler syntax, which can only be done using the .syntax unified directive in the assembler source. To keep everything in one place and avoid confusion, it's better to control the assembler output mode with directives rather than attempting to control it on the command line.



TL;DR,把它放在你的汇编文件中:
.syntax unified /* use unified assembler syntax */
.code 16        /* assemble in Thumb-2  (.thumb" can also be used) */

关于assembly - 如何运行 linaro 汇编程序以获取 thumb2 (T32) 指令,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24992876/

相关文章:

assembly - ARM 拇指中的表分支字节(TBB)的简单示例

c - 未定义表达式的汇编程序调试

assembly - 在 Windows 7 命令提示符下运行汇编程序

c - 使用中断处理程序作为事件监听器有什么问题

linux-kernel - 无法解压缩时如何找到ARM Linux入口点?

c++ - `if` 语句在取模之前和分配操作之前是多余的吗?

c - 在 C 中组合 ASM block 时出现问题

assembly - 使用 xor reg, reg 是否比 mov reg, 0 有优势?

delphi - 如何在地址计算中使用标签

c - 通过中断保护读取值