What does the bracket in `movl (%eax), %eax` mean?
%eax is register EAX; (%eax) is the memory location whose address is contained in the register EAX; 8(%eax) is the memory location whose address is the value of EAX plus 8.
%eax is register EAX; (%eax) is the memory location whose address is contained in the register EAX; 8(%eax) is the memory location whose address is the value of EAX plus 8.
I believe that you want to load the address of your string into %rsi; your code attempts to load a quadword from that address rather than the address itself. You want: lea msg(%rip), %rsi if I’m not mistaken. I don’t have a linux box to test on, however.
By compiler: GCC: -Wa,-mbranches-within-32B-boundaries clang (10+): -mbranches-within-32B-boundaries compiler option directly, not -Wa. MSVC: /QIntel-jcc-erratum See Intel JCC Erratum – what is the effect of prefixes used for mitigation? ICC: TODO, look for docs. The GNU toolchain does mitigation in the assembler, with as -mbranches-within-32B-boundaries, which enables (GAS manual: x86 options): -malign-branch-boundary=32 (care about 32-byte boundaries). … Read more
Excerpt from info as (GNU Binutils 2.21.90), or online in the GAS manual: https://sourceware.org/binutils/docs/as/Dot.html 5.4 The Special Dot Symbol The special symbol . refers to the current address that as is assembling into. Thus, the expression melvin: .long . defines melvin to contain its own address. Assigning a value to . is treated the same … Read more
To disable these, use the gcc option -fno-asynchronous-unwind-tables -fno-dwarf2-cfi-asm may be needed also.
What directives should I use in GAS? I’ve found the ‘.org’ directive but GAS doesn’t seem to have a ‘.bits’ directive. The assembler defaults to 64–bit for me, you can use –32 or –64 to chose on the command line. Have a look at the manual for as to see how you can change the … Read more