我们如何在Apple平台的AArch64程序集中的一行上编写多个语句? [英] How do we write multiple statements on one line in AArch64 assembly for Apple platforms?
问题描述
我正在将一些Arm64汇编语言移植到M1.
I'm porting a bit of Arm64 assembly language to an M1.
其中一些是通过C预处理生成的,其中单个 #define
宏会生成多个用分号分隔的语句.
Some of it is generated by C preprocessing, in which a single #define
macro generates multiple statements separated by semicolon.
不幸的是,在M1上,汇编器将分号视为注释字符.
Unfortunately, on the M1, the assembler treats the semicolon as a comment character.
例如:
#define DEFUN(NAME) \
.globl _ ## NAME ; \
.palign 2 ; \
_ ## NAME:
使 .globl
指令之后的所有内容均被视为注释.
causes everything after the .globl
directive to be treated as a comment.
MacOS as
手册页不提供任何线索;它没有语法方面的内容.
The MacOS as
man page provides no clue; it has no coverage of syntax.
是否存在用于分隔语句的替代字符?我尝试使用 @
和!
,但均被拒绝.
Is there an alernative character for separating statements? I tried using @
and !
, but both are rejected.
回答此问题是在这里没有用.
推荐答案
对于面向Apple平台的aarch64程序集,您可以使用 %%
作为分隔符.不确定是否/在哪里记录了它,但是它是在LLVM源中设置的 libunwind 和 compiler-rt ,因此它可能不会一时兴起.
For aarch64 assembly targeting Apple platforms, you can use %%
as separator character. Not sure if/where it's documented, but it's set in the LLVM source here. And even if it might not be documented explicitly anywhere, it is used in a number of places, e.g. in libunwind and compiler-rt, so it probably won't change in a whim.
这篇关于我们如何在Apple平台的AArch64程序集中的一行上编写多个语句?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!