From: <ai...@us...> - 2004-02-25 06:46:13
|
Update of /cvsroot/linux-vax/glibc/sysdeps/vax In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5963 Modified Files: dl-machine.h Log Message: two functions done, god knows how many to go :-) Index: dl-machine.h =================================================================== RCS file: /cvsroot/linux-vax/glibc/sysdeps/vax/dl-machine.h,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- dl-machine.h 23 Feb 2004 11:16:32 -0000 1.8 +++ dl-machine.h 25 Feb 2004 06:31:24 -0000 1.9 @@ -56,35 +56,27 @@ may make GCC trip over itself doing register allocation. Yes, I'm paranoid. Why do you ask? */ Elf32_Addr *got; - + __asm__("\tmoval _GLOBAL_OFFSET_TABLE_, %0\n\t":"=r"(got)); return *got; + } -/* Return the run-time load address of the shared object. We do it like - m68k and i386, by taking an arbitrary local symbol, forcing a GOT entry - for it, and peeking into the GOT table, which is set to the link-time - file-relative symbol value (regardless of whether the target is REL or - RELA). We subtract this link-time file-relative value from the "local" - value we calculate from GOT position and GOT offset. FIXME: Perhaps - there's some other symbol we could use, that we don't *have* to force a - GOT entry for. */ +/* Return the run-time load address of the shared object. */ static inline Elf32_Addr elf_machine_load_address (void) { - extern void __dl_start asm("_dl_start"); - Elf32_Addr got_addr = (Elf32_Addr) &__dl_start; + unsigned long addr, link_addr; + unsigned long *got; + + /* subtract got dynamic from real dynamic to get load_address */ + __asm__("\tmoval _GLOBAL_OFFSET_TABLE_, %0\n\t":"=r"(got)); + link_addr = *got; - // __asm__("moval _dl_start, %0\n\t" : "=r" (pcrel_addr)); - return got_addr-2; -#if 0 - Elf32_Addr gotaddr_diff; - __asm__ ("sub.d [$r0+_dl_start:GOT16],$r0,%0\n\t" - "add.d _dl_start:GOTOFF,%0" : "=r" (gotaddr_diff)); - return gotaddr_diff; -#endif - return 0; + __asm__("\tmoval _DYNAMIC, %0\n\t":"=r"(addr)); + + return addr-link_addr; } /* Set up the loaded object described by L so its unrelocated PLT |