I have a code like this:
.bss
woof: .long 0
.text
bleh:
...some op codes here.
now I would like to move the address of woof into eax. What's the intel syntax code here for doing that? The same goes with moving bleh's address into, say, ebx.
Your help is much appreciated!
The bss section can't have any actual objects in it. Some assemblers may still allow you to switch to the .bss section, but all you can do there is say something like:
x: . = . + 4
.In most assemblers these days and specifically in gnu for intel, there is no longer a
.bss
directive, so you temporarily switch to bss and create the bss symbol in one shot with something like:.comm sym,size,alignment
. This is why you are presumably getting an error ".bss directive not recognized" or something like that.And then you can get the address with either:
or
Update: aha, intel syntax, not intel architecture. OK:
All the
lea
forms should generate the same code.