How do we write multiple statements on one line in AArch64 assembly for Apple platforms?

Viewed 104

I'm porting a bit of Arm64 assembly language to an M1.

Some of it is generated by C preprocessing, in which a single #define macro generates multiple statements separated by semicolon.

Unfortunately, on the M1, the assembler treats the semicolon as a comment character.

For instance:

#define DEFUN(NAME)  \
  .globl _ ## NAME ; \
  .palign 2 ;        \
  _ ## NAME:

causes everything after the .globl directive to be treated as a comment.

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.

Answers to this question are of no use here.

1 Answers

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.

Related