I have a weird situation and I'm not sure if it's a bug of GNU assembler or I am doing something wrong. I will eventually switch to nasm I think, but I am using some macros that are written for the GNU assembler.
For example, I have a label with some variable like this :
msg1:
.asciz "hello world"
var1:
.long 0
Now I expected mov eax, var1 to mov pointer to var1 to eax, while mov eax, [var1] should mov the content of that variable to eax, but both give me the same code, giving me the content of that variable. I know I can use LDA, but it shouldn't be necessary. If I want to push a pointer to some string, I have to do something like
lea eax, msg1
push eax
Another problem. I define a constant with .set, like this:
.set const1 0x1000
mov eax, const1 gives me content of the memory at 0x1000 instead of the immediate value. What can I do to fix this ?