3

In NASM (Intel), I can write this:

mov rax, `Hello!\n`

And it's equivalent to this:

mov rax, 0xa216f6c6c6548

Does GAS (AT&T) support any equivalent shorthand for that, or am I stuck writing this?

movabsq $0xa216f6c6c6548, %rax
Peter Cordes
  • 328,167
  • 45
  • 605
  • 847
  • 2
    GAS does support single-character character literals like `mov $'a', %eax`. But not multi-character, and you get broken error messages, like GAS's parser gets mixed up. `mov eax, "wxyz"` in GAS `.intel_syntax` is a symbol reference, same as `mov eax, wxyz`, so that's confusing and weird. – Peter Cordes Jun 03 '20 at 04:11

1 Answers1

4

Unfortunately GAS doesn't have such a feature. Given that GAS was really designed for assembly language output by compilers, my best guess is this feature was probably never seen as something that added much value. Had GAS originally been designed for humans to generate assembly code then such a feature likely would have been added.

Michael Petch
  • 46,082
  • 8
  • 107
  • 198