What is needed to support uclinux shared libraries on MMU-lessARM?

Bernardo Innocenti bernie@develer.com
Tue Jun 15 12:00:00 GMT 2004


Bernardo Innocenti wrote:

>> At first I think these source codes trick the linker to create an 
>> entrance
>> for each library, but function main() in main.c is enough to do this.
>> so I'm lost too, I will try to get the answer in uClinux-dev maill list.
> 
> 
> The comment says that lib_main must be used because C code
> does the usual trick with A5.  The kernel doesn't do anything
> special for libraries: the entry point is set to the start
> of the text segment.  So I still wonder how lib_main gets
> executed.
> 
> Perhaps the program startup code calls lib_main for each
> library?

Nope.  The startup code for regular programs is here:

  uclinux/uClibc/libc/sysdeps/linux/m68k/crt0.S


It also expects the pointer to the data segment in
%d5 and the comment says it's passed by the kernel.

There's nothing about lib_main here, so I'm still
wondering *who* is calling it.

Please, put me in Cc when you ask on uClinux-dev,
I'm curious.

---cut---
        .text

        nop
        nop
 _start: /* put here so that references to _start work with elf-PIC */

        movea.l %d5, %a5        /* uClinux passes in data segment here */
 /*
  *      argc, argv and envp are on the stack,  just call to main
  */
        lea __uClibc_main-.-8, %a0      /* call uClibc main */
        jsr %pc@(%a0)
---cut--

-- 
  // Bernardo Innocenti - Develer S.r.l., R&D dept.
\X/  http://www.develer.com/



More information about the Gcc mailing list