[cfe-dev] Aarch64 ASM quirk

Martin Storsjö via cfe-dev cfe-dev at lists.llvm.org
Fri Nov 8 05:43:28 PST 2019

On Fri, 8 Nov 2019, Peter Smith via cfe-dev wrote:

> Hello Joel,
> The root cause is that the AArch64 target is using ';' as a comment
> character, whereas in GNU as (and many other llvm MC backends),  the
> ';' is used as a statement separator. In your example only the text up
> to ';' is being parsed.
> Looking at AArch64MCAsmInfo.cpp
>  SeparatorString = "%%";
>  CommentString = ";";
> I think that this is likely to have been derived from Darwin as I
> can't get the "%%" to work as a statement separator for
> aarch64-linux-gnu targets.

I don't know about the separator string, but if you look in 
AArch64MCAsmInfoELF (and AArch64MCAsmInfoGNUCOFF), the comment string is 
set to "//" instead.

I suggested changing this for the GNUCOFF (aka MinGW) target, as mingw-w64 
contains a number of assembler files that uses this pattern of piling up a 
few directives on one line.

As there's very little predecent for GNU style .s assembler for 
aarch64-windows-msvc targets (as the official tool from microsoft, 
armasm64, uses a totally different syntax), I'm guess it would be fine to 
change the comment string to "//" there as well, as there apparently is a 
demand for it?

With a target that doesn't treat ";" as a comment char, your assembler 
example errors out due to issues with the section and type directives 
though, now that they actually are interpreted and not stripped out as 

// Martin

More information about the cfe-dev mailing list