gas: .align padding

Andrew Morton morton@nortelnetworks.com
Fri Oct 15 06:42:00 GMT 1999


Alan Modra wrote:
> 
> On Fri, 15 Oct 1999, Andrew Morton wrote:
> 
> > Good morning.  A few things:
> Good evening!
> 
> > When padding .aligns gas seems to put random gunk into the object file
> > instead of nops or nulls. Can this be fixed?
> >
> > bix:~> cat t.s
> >         nop
> >         .align 8
> >         nop
> >
> > bix:~> objdump --disassemble t.o
> >
> > t.o:     file format elf32-i386
> >
> > Disassembly of section .text:
> >
> > 00000000 <.text>:
> >    0:   90                      nop
> >    1:   8d b4 26 00 00 00 00    leal   0x0(%esi,1),%esi
> >    8:   90                      nop
> 
> That's not random gunk!  That's a 7 byte nop.

Oh I see.  Thanks.

Care to quench my curiosity as to why this was done??

> 
> Use ".align 8,0x90" if you want single byte nops.

Not an option, I'm afraid.  This is gcc output.

I'm exploring the possibility of writing a full disassembler; that is,
one whose output can be reassembled.  The idea being that this can be
used to add instrumentation to existing object files.  Disassemble,
massage, reassemble.  I'm currently at the "is this remotely possible"
stage.

I was concerned that the "random gunk" would cause problems, but
deliberate gunk is just fine.

- Andrew.


More information about the Binutils mailing list