我有一个带有一个 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/