2

With GNU as .intel_syntax, some identifiers apparently become keywords, and writing e.g.

call and

to invoke a function called and results in

Error: invalid use of operator "and"

How do you circumvent this?

Peter Cordes
  • 328,167
  • 45
  • 605
  • 847
Tau
  • 496
  • 4
  • 22

1 Answers1

2

Alright, the answer seems to be:

This is not possible. Use AT&T syntax.

Looking at the GAS sources, config/tc-i386-intel.c lines 136ff are pretty clear about this.

Some GNU developer considered completely disabling some symbol names to be a reasonable way of introducing named operators. Such a small bad design decision cost me and probably many other unfortunate users a whole afternoon. Don't be that guy.

Tau
  • 496
  • 4
  • 22
  • 2
    Perhaps they were thinking that `and` is a C++ keyword so C++ compiler output wouldn't use it as a function name. Of course they were wrong, C doesn't have that as a keyword and there are lots of other relevant languages, not to mention hand-written asm. Anyway, it's easy to craft a C source file that leads to `gcc -masm=intel -c` feeding `as` with assembly it chokes on: https://godbolt.org/z/dj1annYcn Even `call and@PLT` doesn't help, nor does putting it in double-quotes – Peter Cordes Jul 19 '23 at 22:29