relocatable modules' symbols

Prabhu nath gprabhunath at gmail.com
Fri Mar 1 05:56:23 EST 2013


In principle, the linker will associate the kernel code/data  to the Kernel
virtual address space i.e. between 0xC000_0000 to 0xFFFF_FFFF and
the same linker will associate the Application's code/data to the user
virtual address space i.e. between 0x0000_0000 to 0xBFFF_FFFF.

Linker itself cannot distinguish between the kernel code/data and user
code/data but it is the linker script that will guide the linker to
associate the code/data to the respective addresses.

What you are seeing is the linker script provided to the linker with -T
option when building the kernel.

To build the user application the linker uses its default linker script
which you get it by executing
$ ld --verbose.

To compare between the two just juxtapose the readelf output of both kernel
executable (vmlinux) and any user application executable (a.out)

$ readelf -a vmlinux
$ readelf -a a.out

Just inspect the section header and program header of both the outputs you
will get the difference.

Regards,
Prabhu



On Fri, Mar 1, 2013 at 11:07 AM, Arun KS <getarunks at gmail.com> wrote:

> Hi Horseriver,
>
> On Sun, Feb 24, 2013 at 7:26 AM, horseriver <horserivers at gmail.com> wrote:
> > On Sun, Feb 24, 2013 at 04:00:37PM +0700, Mulyadi Santosa wrote:
> >> On Sat, Feb 23, 2013 at 6:45 AM, horseriver <horserivers at gmail.com>
> wrote:
> >> > hi:
> >> >
> >> >   I have built vmlinux at the top dir of kernel source ,then I use
> objdump to look into
> >> >   its section information.I find the statup_32 which is the start
> routine of kernel ,
> >> >   locats at 0xc0100000. I know the 0x100000 is the defined address
> for locating
> >> >   protect-mode code .But which I can not understand is the 0xc prefix
> .where does it come from?
> >>
> >> If my guess is right, that's because kernel mode code start at
> >> 0xc000000 a.k.a a bit above 3 GiB on x86 32 bit machine
> >
> >   I have find this answer .
> >   It is defined in lds script file .
> >
> > here is the code :
> >   SECTIONS
> >   {
> >   . = 0xC0000000 + 0x100000;
> >   /* read-only */
> >   _text = .;            /* Text and read-only data */
> >
> >
> >   why use 0xC0000000 as its start ? why not  just  use 0x100000 only ?
> >   if use 0xC0000000,every linked symbole will be prefixed by 0xc , what
> is the purpose ?
>
> Usually, user kernel space split is 3G:1G.
> ie 1G for kernel space. And this starts from 0xC000_0000 till 0xFFFF_FFFF
>
> All the address below 0xC000_0000(ie 3G from 0x0 to 0xBFFF_FFFF) is
> used for user space.
>
> Thanks,
> Arun
> >
> > thanks!
> >
> >
> >
> > --
> >> regards,
> >>
> >> Mulyadi Santosa
> >> Freelance Linux trainer and consultant
> >>
> >> blog: the-hydra.blogspot.com
> >> training: mulyaditraining.blogspot.com
> >
> > _______________________________________________
> > Kernelnewbies mailing list
> > Kernelnewbies at kernelnewbies.org
> > http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies at kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20130301/05a15318/attachment.html 


More information about the Kernelnewbies mailing list