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: Question about section alignment


hi, Nick.
Thank you very much for your reply.

2008/2/22, Nick Clifton <nickc@redhat.com>:
> Hi Robert,
>
>
>  > I found that in binutils-2.17.50
>
>
> (Just a quick aside - we have now released version 2.18 and development
>  on 2.19 continues apace...)
>
>
>
>  >      /* On a native system other than VxWorks, sections must be aligned
>  >         to 16 byte boundaries.  When configured for an embedded ELF
>  >         target, we don't bother.  */
>
>
> > I don't kow why these sections  must be set to 16 byte boundaries,
>
>
> I asked the MIPS maintainers about this - the consensus was that 16
>  bytes was chosen for future compatibility with MIPS variants that might
>  need that alignment for 128-bit data types (eg long doubles).  There are
>  no such variants yet, but they may appear one day.
>

It seems that irix mips has already used 128-bit data types ( long
doubles), and I found some comments in tc-mips.c as bellows:
     /* We don't need to align ELF sections to the full alignment.
	 However, Irix 5 may prefer that we align them at least to a 16
	 byte boundary.  We don't bother to align the sections if we
	 are targeted for an embedded system.  */

I don't know why it prefer a 16 byte boundary **at least**, but not by
the largest data alignment of the file.

>  If you find that reducing the alignment restriction to 4 bytes works for
>  you (and produces some kind of space saving) then by all means carry on
>  doing that, but the official MIPS port is going to keep the 16 byte
>  alignment requirement just in case it is needed in the future.

yes, I recompiled the binutils to align to 4 bytes, and it can work on
my board, and can shrink the .data section just a little.

Cheers,

robert song


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