[uClibc]Re: Understanding the dynamic linking process for MIPS...

Erik Andersen andersen at codepoet.org
Fri Mar 15 13:46:52 UTC 2002


On Thu Mar 14, 2002 at 02:53:54PM -0600, Steven J. Hill wrote:
> I have been pulling my hair out trying to get the MIPS dynamic
> linker going. Hopefully some people can clarify a few things for
> me and make sure I am on the right track.

I'll try...

> The main file for the uClibc dynamic linker is 'ldso/ldso/ldso.c'
> which corresponds with the file 'elf/rtld.c' in glibc. Also, the
> function DL_BOOT which is the entry point of the uClibc dynamic
> linker, corresponds with the entry point '_dl_start'. Furthermore,
> the file function '_dl_get_ready_to_run' in uClibc is almost
> equivalent with the function '_dl_start_final' in glibc. Hopefully
> my correlations are correct.

To be honest, I've not spent a lot of time in that part of the 
glibc code so I really can't say for sure.

> relocate the linker code in glibc. In the case of uClibc, it
> would appear that once the GOT is found in 'DL_BOOT', that the
> relocation is done in an architecture indepedent way inside the
> 'DL_BOOT' function. Am I correct?

Yup.  I even added an arch indepedent routine to locate the GOT
using the ELF header...  Does this not work for you? 

> Second, the macro function 'INIT_GOT' for uClibc should contain
> code to initialize a GOT for an application being started up. This
> is never used when bootstrapping the dynamic linker itself, right?

Right.

> In the glibc code, 'sysdeps/mips/dl-machine.h' there is a function
> 'elf_machine_got_rel'. This code should be cut and pasted into the
> INIT_GOT function if I understand things correctly.

Well, a simple cut and paste won't do it.  A quick look at
the glibc code, and I think the elf_machine_runtime_setup()
stuff that does the lazy bit may be closer to what you need.

 -Erik

--
Erik B. Andersen             http://codepoet-consulting.com/
--This message was written using 73% post-consumer electrons--



More information about the uClibc mailing list