From babf820180368f00742ec65b2050a82380d7c542 Mon Sep 17 00:00:00 2001 From: Rich Felker Date: Sun, 5 Aug 2012 12:50:26 -0400 Subject: mips dynamic linker support not heavily tested, but the basics are working. the basic concept is that the dynamic linker entry point code invokes a pure-PIC (no global accesses) C function in reloc.h to perform the early GOT relocations needed to make the dynamic linker itself functional, then invokes __dynlink like on other archs. since mips uses some ugly arch-specific hacks to optimize relocating the GOT (rather than just using the normal DT_REL[A] tables like on other archs), the dynamic linker has been modified slightly to support calling arch-specific relocation code in reloc.h. most of the actual mips-specific behavior was developed by reading the output of readelf on libc.so and simple executable files. i could not find good reference information on which relocation types need to be supported or their semantics, so it's possible that some legitimate usage cases will not work yet. --- src/ldso/dynlink.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/ldso/dynlink.c') diff --git a/src/ldso/dynlink.c b/src/ldso/dynlink.c index 08f9118d..8f32f98f 100644 --- a/src/ldso/dynlink.c +++ b/src/ldso/dynlink.c @@ -487,6 +487,9 @@ static void reloc_all(struct dso *p) for (; p; p=p->next) { if (p->relocated) continue; decode_vec(p->dynv, dyn, DYN_CNT); +#ifdef NEED_ARCH_RELOCS + do_arch_relocs(p, head); +#endif do_relocs(p, (void *)(p->base+dyn[DT_JMPREL]), dyn[DT_PLTRELSZ], 2+(dyn[DT_PLTREL]==DT_RELA)); do_relocs(p, (void *)(p->base+dyn[DT_REL]), dyn[DT_RELSZ], 2); -- cgit v1.2.1