This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Trouble eliminating padding or alignments


On Fri, 2010-07-16 at 20:56 +0930, Alan Modra wrote:
> On Fri, Jul 16, 2010 at 11:45:37AM +0100, Alex Buell wrote:
> > On Fri, 2010-07-16 at 16:08 +0930, Alan Modra wrote:
> > > On Thu, Jul 15, 2010 at 04:27:14PM +0100, Alex Buell wrote:
> > > > How can I eliminate these *fill* bytes?
> > > 
> > > By not aligning the following section.
> > 
> > I'm using elf32 object files generated by NASM.
> 
> I don't know much about NASM, but there probably is an assembly
> directive to specify the alignment of .text.

I had forgotten about NASM's ALIGN directive, thanks for reminding me
about that one. I've now got the binary down to 520 bytes. But looking
at the linkage map, ld is still padding things out:

text           0x0000000000000000      0x208
 *(.text.unlikely .text.*_unlikely)
 *(.text .stub .text.* .gnu.linkonce.t.*)
 .text          0x0000000000000000      0x12e stage1/boot.o
                0x0000000000000003                BPB
 *fill*         0x000000000000012e        0x2 90909090
 .text          0x0000000000000130       0x69 libcommon.a(floppy16.o)
                0x0000000000000130                datasector
                0x0000000000000132                cluster
                0x0000000000000137                CHStoLBA
                0x0000000000000147                LBAtoCHS
                0x0000000000000161                SectorsRead
 *fill*         0x0000000000000199        0x7 90909090
 .text          0x00000000000001a0       0x68 libcommon.a(msdosfs.o)
                0x00000000000001a0                load_root
                0x00000000000001c8                find_file
                0x00000000000001f1                load_fat12
                0x0000000000000207                load_file

> > How can I get ld not to align sections?
> 
> See the ld info doc.  SUBALIGN.

I've not had much experience with linker scripts. Are there any suitable
primers I can access to read up on the effects of SUBALIGN? I'm only
using .text sections. 

-- 
http://www.munted.org.uk

One very high maintenance cat living here.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]