Re: Query on linker scripts

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



Hi Vaibhav Jain,

On Mon, Mar 26, 2012 at 4:01 AM, Vaibhav Jain <vjoss197@xxxxxxxxx> wrote:
> Thanks a lot for the explanation and the link!! I have just one more
> question about
> linker scripts. I am not clear about alignment of sections. Is it necessary
> to align sections?
> Can the alignment be different from 4096?
> In the script that I provided the text and data sections are aligned while
> the bss section is not. Is there
> a reason for it ?

The reason for using page alignments is so that the kernel can enforce
different access types to the various sections. This is tyically done
using the MMU, which would require page alignment.

So, for example, the text section would allow executable code, and
should be read-only. The .rodata section should not allow executable
code and be read-only, and the .data section should not allow
executable code, and should allow writes.

By having the sections page aligned, it allows the kernel to enforce
these using the MMU.

-- 
Dave Hylands
Shuswap, BC, Canada
http://www.davehylands.com

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


[Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Photo]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Networking]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]

Add to Google Powered by Linux