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


> In the linker script, armelf.xc, -- and likely other elf targets --
> this line places 256 bytes of padding between the output .text and
> .data sections.
> 
>   /* 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));
> 
> Why is this padding necessary?

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.

Older linkers padded to 512 byte boundaries to optimize disk access,
since disk sectors are usually 512 bytes.


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