I'd like to get a better idea which assemblers are actually working on M1/M2 MacOs machines, such as MacBook Pros.
True ?
That seems OK, but it seems not entirely complete – for instance, you can have macros with named parameters instead of just using $0, ... $n in 'as'. Not mentioned in the guide.
Are there any good pointers to porting from gas to the apple assembler ? Known problems and solutions ?
E.g., in 'gas', I believe I can redefine symbols with .set, but not with 'as'. I'm really a very inexperienced assembler amateur, so some canonical resources would be great. As I see it today, assembly programming on M1 Mac's is more dark arts than a science.
Thanks for any enlightenment.
I wanted to document what I found so far:
The documentation likely to be mostly accurate seems to be https://developer.arm.com/documentation/100067/0611/armclang-Integrated-Assembler.
There's also https://developer.arm.com/documentation/100068/0612/migrating-from-armasm-to-the-armclang-integrated-assembler/symbol-definition-directives and https://developer.arm.com/documentation/100068/0612/migrating-from-armasm-to-the-armclang-integrated-assembler/overview-of-differences-between-armasm-and-gnu-syntax-assembly-code?lang=en
Most likely, Apple is using the clang assembler more or less directly. It is similar to the gnu assembler, but not identical. For instance, jonesforth uses a feature where you can .set a symbol over and over to non-absolute values like labels to build a linked list of commands - that works in GNU assembler, not in llvm (at least the apple assembler). Also, the apple assembler does not allow multiple statements in one line separated by ';', which is a huge pain in the neck when porting large assembly files making extensive use of this.
I believe that the llvm project has source code in github, specifically assembler parsing here: https://github.com/llvm/llvm-project/blob/92920c4fe3e29640e45153f3048105970b5b1e42/llvm/lib/MC/MCParser/AsmParser.cpp
I realize this is fairly incomplete, but I will update the answer should I ever get a useful response on the apple dev forums or directly from Apple support.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With