[cfe-dev] Aarch64 ASM quirk

Peter Smith via cfe-dev cfe-dev at lists.llvm.org
Mon Nov 11 09:41:40 PST 2019

I don't think that there is an alternative separator for the Windows
target as both the CommentString and SeparatorString are ";". I don't
have a strong opinion over changing the comment character for AArch64
Windows target. Probably best addressed by the people that use/develop
on it. It is true that armasm(64) uses ";" as its comment character,
but as Martin says many of the directives and other bits of syntax are
different so at least some form of scripted conversion is likely to be
needed anyway.


On Fri, 8 Nov 2019 at 20:31, Joel Winarske <joel.winarske at gmail.com> wrote:
> Ah yes, a comment...
> Is there a seperator character that works?
> On Fri, Nov 8, 2019, 5:43 AM Martin Storsjö <martin at martin.st> wrote:
>> 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
>> comments.
>> // Martin

More information about the cfe-dev mailing list