https://gcc.gnu.org/bugzilla/show_bug.cgi?id=31782
--- Comment #7 from Harald van Dijk <harald at gigawatt dot nl> --- That's good to know. Trying some more, clang does manage to get even weirder symbol names right, because gas does have a form of quoting already, and clang makes use of it. int x __asm__(")"); int main() { return x; } With clang, this works. ... movl ")", %eax ... .type ")",@object # @")" .comm ")",4,4 ... If it's simpler to implement, then instead of parenthesising, $ could alternatively be treated as a symbol that needs quoting, which is a more general solution that will work for any possible symbol name.