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: Padding between .text and .data


On 2/14/06, DJ Delorie <dj@redhat.com> wrote:
> >   /* Adjust the address for the data segment.  We want to adjust up to
> >      the same address within the page on the next page up.  */
> >   . = ALIGN(256) + (. & (256 - 1));
>
> It puts *up to* 256 bytes.  It aligns the data to start on the next
> "page" so that data and code are always in separate pages and the
> memory management unit can deal with them separately (read-only,
> shared, page in, etc).  Might also help keep the icache and dcache
> sane.

It looks as though this inserts either exactly zero bytes if the
section happens to already be aligned, or exactly 256 bytes if the
section is unaligned, with this latter case being far more likely. If
the .text and .data sections must be in different pages for the MMU's
sake, I understand the ALIGN(256) requirement. What's the reason for
the additional (. & (256 - 1)) bytes placed at the beginning of the
next page?

Cheers,
Shaun


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