All of lore.kernel.org
 help / color / mirror / Atom feed
From: dhylands@gmail.com (Dave Hylands)
To: kernelnewbies@lists.kernelnewbies.org
Subject: Query on linker scripts
Date: Mon, 26 Mar 2012 08:14:05 -0700	[thread overview]
Message-ID: <CABi1daErCC1iTTQgc42Nw_8x_hMasv9VFW6tNNmHVfFn3yhzOA@mail.gmail.com> (raw)
In-Reply-To: <CAKuUYSyiE2TfLwxu60z95rZDvk_bLWW5PAEcFZnCAEmPqdfF4g@mail.gmail.com>

Hi Vaibhav Jain,

On Mon, Mar 26, 2012 at 4:01 AM, Vaibhav Jain <vjoss197@gmail.com> 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

  parent reply	other threads:[~2012-03-26 15:14 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-24 18:45 Query on linker scripts Pranay Kumar Srivastava
     [not found] ` <CAKuUYSwPiuGTa+8r6O+-GMLu9e6dXOXNfDHu4UBx2yvrHcQyvw@mail.gmail.com>
2012-03-26  6:41   ` Pranay Kumar Srivastava
2012-03-26 11:01     ` Vaibhav Jain
2012-03-26 11:54       ` Pranay Kumar Srivastava
2012-03-27  1:38         ` Vaibhav Jain
2012-03-27 11:00           ` Pranay Kumar Srivastava
2012-03-26 15:14       ` Dave Hylands [this message]
  -- strict thread matches above, loose matches on Subject: below --
2012-03-24  4:43 Vaibhav Jain
2012-03-24 15:26 ` Carlo Caione

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CABi1daErCC1iTTQgc42Nw_8x_hMasv9VFW6tNNmHVfFn3yhzOA@mail.gmail.com \
    --to=dhylands@gmail.com \
    --cc=kernelnewbies@lists.kernelnewbies.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.