Re: mmap info

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

 



srinivas bakki wrote:

    You have to write a linker script to generate symbols that mark
the start and end of your section. The kernel uses this trick for
initializing all the modules, without having to call them individually
by their names.
    An example of how this can be done is explained in the following link

 http://geek.vtnet.ca/doc/initcall/index.html

what next after editing the script ? This section still cannot be
recognised by the running program !!! because the symbol table for
that binary is local to it. its not recognised by the current running
program.
   A simple example :-

int __attribute__((section ("my_code_section")))
dummy()
{
   return 100;
}


extern int __start_my_code_section, __stop_my_code_section;

int
main (void)
{
printf(" my code section start = %x, end = %x, size = %d\n", &__start_my_code_section, &__stop_my_code_section,
               &__stop_my_code_section - &__start_my_code_section);

       printf(" dummy = %d\n", dummy());
       return 0;
}

Here the linker automatically generates __start_my_code_section, __stop_my_code_section variables.


Vikesh






--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux