What’s the real meaning of $$ in nasm

$$ is the address of the beginning of the current section. It is a relocatable value (not “scalar” – a word you will find in an error message, but not in the Manual). It is an offset, so doesn’t care what’s in a segment register.

About the only thing it’s useful for is $ - $$, the length of the section so far. $ - $$ is a “scalar” (as is any difference between labels) and can be used in expressions which would otherwise cause Nasm to whine about “not a scalar value”.

The section names “known” to Nasm depend on the output format – “-f obj” doesn’t know any at all. .text, .data, and .bss are pretty universal – some output formats know others. Best place to find ’em is in the “output format” chapters in the Manual. http://www.nasm.us if you didn’t get the Manual with your download. These names are case sensitive, and the leading ‘.’ is required.

I have the feeling that there’s a “question” in here that I’m missing. What are you actually trying to do?

Leave a Comment