Page 1 of 1

gas fill section with NOPs

Posted: Fri Sep 16, 2011 12:03 pm
by sebihepp
Hello,

I just changed from nasm to the gnu assembler and I wonder how to tell him, that I want to fill up the section until address 0x1FE with NOPs (0x90)? If I use ".align 510, 0x90" he argues there is no power of 2... And in the manual I don't see any possibility to get the current address (by the way: would be useful to know. The '$' dosn't work with the AT&T syntax)

best regards
sebihepp

Re: gas fill section with NOPs

Posted: Fri Sep 16, 2011 2:56 pm
by xenos
The first argument of .align specifies an alignment, which must be a power of two. It does not specify the upper limit address. I guess .space (510 - .), 0x90 should do what you want.

Instead of the "$" symbol, gas uses the "." for the current address: http://sourceware.org/binutils/docs-2.21/as/Dot.html

Re: gas fill section with NOPs

Posted: Fri Sep 16, 2011 2:57 pm
by sebihepp
Many thousand thanks. The dot "." is what I was looking for. :)

But it didn't work, because .space needs an absolute value or expression... :(

Re: gas fill section with NOPs

Posted: Sat Sep 17, 2011 4:32 am
by xenos
Hm... In that case you could try .org 510, 0x90 instead: http://sourceware.org/binutils/docs-2.21/as/Org.html