I just started down the Assembly road, and one of the first “Hello, World!” tutorials I found http://asm.sourceforge.net/intro/hello.html, gives a nice way of psudo-dynamicly getting the length of the string to enter into the system call.
section .data
msg db 'Hello, World!",0xa
len equ $ - msg
This works great in nasm, and everything assembles, links, and runs with out question.
The problem comes when I try to find a way to do the same thing in gas.
I understand that the $ in this case is a token that evaluates to the current assembly position http://www.csie.ntu.edu.tw/~comp03/nasm/nasmdoc3.html#section-3.5
Can this expression ($ – msg) be expressed in gas, or is this nasm exclusive syntactic sugar?
For x86, you can use “
.” in the same way. e.g.(Note: this is not necessarily true for other platforms.
gassupports many platforms, and various aspects of syntax vary between them!)