gas fill section with NOPs

Programming, for all ages and all languages.
Post Reply
sebihepp
Member
Member
Posts: 184
Joined: Tue Aug 26, 2008 11:24 am
GitHub: https://github.com/sebihepp

gas fill section with NOPs

Post 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
User avatar
xenos
Member
Member
Posts: 1118
Joined: Thu Aug 11, 2005 11:00 pm
Libera.chat IRC: xenos1984
Location: Tartu, Estonia
Contact:

Re: gas fill section with NOPs

Post 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
Programmers' Hardware Database // GitHub user: xenos1984; OS project: NOS
sebihepp
Member
Member
Posts: 184
Joined: Tue Aug 26, 2008 11:24 am
GitHub: https://github.com/sebihepp

Re: gas fill section with NOPs

Post 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... :(
User avatar
xenos
Member
Member
Posts: 1118
Joined: Thu Aug 11, 2005 11:00 pm
Libera.chat IRC: xenos1984
Location: Tartu, Estonia
Contact:

Re: gas fill section with NOPs

Post by xenos »

Hm... In that case you could try .org 510, 0x90 instead: http://sourceware.org/binutils/docs-2.21/as/Org.html
Programmers' Hardware Database // GitHub user: xenos1984; OS project: NOS
Post Reply