aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/mips
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/mips')
-rw-r--r--sysdeps/mips/bits/dlfcn.h42
-rw-r--r--sysdeps/mips/bsd-_setjmp.S13
-rw-r--r--sysdeps/mips/bsd-setjmp.S13
-rw-r--r--sysdeps/mips/dl-machine.h496
-rw-r--r--sysdeps/mips/elf/start.S55
-rw-r--r--sysdeps/mips/fpu_control.h90
-rw-r--r--sysdeps/mips/mips64/rtld-parms3
-rw-r--r--sysdeps/mips/mipsel/rtld-parms3
-rw-r--r--sysdeps/mips/rtld-ldscript.in106
-rw-r--r--sysdeps/mips/setjmp.S22
10 files changed, 545 insertions, 298 deletions
diff --git a/sysdeps/mips/bits/dlfcn.h b/sysdeps/mips/bits/dlfcn.h
new file mode 100644
index 0000000000..636da5662d
--- /dev/null
+++ b/sysdeps/mips/bits/dlfcn.h
@@ -0,0 +1,42 @@
+/* System dependand definitions for run-time dynamic loading.
+ Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#ifndef _BITS_DLFCN_H
+#define _BITS_DLFCN_H 1
+
+/* The MODE argument to `dlopen' contains one of the following: */
+#define RTLD_LAZY 0x001 /* Lazy function call binding. */
+#define RTLD_NOW 0x002 /* Immediate function call binding. */
+#define RTLD_BINDING_MASK 0x3 /* Mask of binding time value. */
+
+/* If the following bit is set in the MODE argument to `dlopen',
+ the symbols of the loaded object and its dependencies are made
+ visible as if the object were linked directly into the program. */
+#define RTLD_GLOBAL 0x004
+
+__BEGIN_DECLS
+
+/* Some SGI specific calls that aren't implemented yet. */
+extern void *sgidladd __P ((const char *, int));
+extern void *sgidlopen_version __P ((const char *, int, const char *, int));
+extern char *sgigetdsoversion __P ((const char *));
+
+__END_DECLS
+
+#endif /* bits/dlfcn.h */
diff --git a/sysdeps/mips/bsd-_setjmp.S b/sysdeps/mips/bsd-_setjmp.S
index f519f19359..819a7018c4 100644
--- a/sysdeps/mips/bsd-_setjmp.S
+++ b/sysdeps/mips/bsd-_setjmp.S
@@ -23,14 +23,19 @@
#include <sysdep.h>
+/* XXX Must this be __PIC__ ? --drepper */
#ifdef PIC
.option pic2
#endif
ENTRY (_setjmp)
+ .set noreorder
#ifdef PIC
.cpload t9
+ la t9, C_SYMBOL_NAME (__sigsetjmp)
+ jr t9
+#else
+ j C_SYMBOL_NAME (__sigsetjmp)
#endif
- la t9, C_SYMBOL_NAME (__sigsetjmp)
- nop
- jr t9
- li a1, 0 /* Pass a second argument of zero. */
+ move a1,zero /* Pass a second argument of zero. */
+ .set reorder
+ .end _setjmp
diff --git a/sysdeps/mips/bsd-setjmp.S b/sysdeps/mips/bsd-setjmp.S
index 9a22700718..f220404c2c 100644
--- a/sysdeps/mips/bsd-setjmp.S
+++ b/sysdeps/mips/bsd-setjmp.S
@@ -23,14 +23,19 @@
#include <sysdep.h>
+/* XXX Must this be __PIC__ ? --drepper */
#ifdef PIC
.option pic2
#endif
ENTRY (setjmp)
+ .set noreorder
#ifdef PIC
.cpload t9
+ la t9, C_SYMBOL_NAME (__sigsetjmp)
+ jr t9
+#else
+ j C_SYMBOL_NAME (__sigsetjmp)
#endif
- la t9, C_SYMBOL_NAME (__sigsetjmp)
- nop
- jr t9
- li a1, 1 /* Pass a second argument of one. */
+ li a1, 1 /* Pass a second argument of one. */
+ .set reorder
+ .end setjmp
diff --git a/sysdeps/mips/dl-machine.h b/sysdeps/mips/dl-machine.h
index ff7d371025..cc7198b60e 100644
--- a/sysdeps/mips/dl-machine.h
+++ b/sysdeps/mips/dl-machine.h
@@ -24,6 +24,34 @@
#define ELF_MACHINE_NAME "MIPS"
#include <assert.h>
+#include <entry.h>
+
+#ifndef ENTRY_POINT
+#error ENTRY_POINT needs to be defined for MIPS.
+#endif
+
+#ifndef _RTLD_PROLOGUE
+#ifdef __STDC__
+#define _RTLD_PROLOGUE(entry) "\n\t.globl " #entry \
+ "\n\t.ent " #entry \
+ "\n\t" #entry ":\n\t"
+#else
+#define _RTLD_PROLOGUE(entry) "\n\t.globl entry\n\t.ent entry\n\t entry:\n\t"
+#endif
+#endif
+
+#ifndef _RTLD_EPILOGUE
+#ifdef __STDC__
+#define _RTLD_EPILOGUE(entry) "\t.end " #entry "\n"
+#else
+#define _RTLD_EPILOGUE(entry) "\t.end entry\n"
+#endif
+#endif
+
+/* I have no idea what I am doing. */
+#define ELF_MACHINE_RELOC_NOPLT -1
+#define elf_machine_lookup_noplt_p(type) (1)
+#define elf_machine_lookup_noexec_p(type) (0)
/* Translate a processor specific dynamic tag to the index
in l_info array. */
@@ -34,6 +62,18 @@
#define ELF_MACHINE_ALIGN_MASK 0xffff
#endif
+/*
+ * MIPS libraries are usually linked to a non-zero base address. We
+ * subtrace the base address from the address where we map the object
+ * to. This results in more efficient address space usage.
+ */
+#if 0
+#define MAP_BASE_ADDR(l) ((l)->l_info[DT_MIPS(BASE_ADDRESS)] ? \
+ (l)->l_info[DT_MIPS(BASE_ADDRESS)]->d_un.d_ptr : 0)
+#else
+#define MAP_BASE_ADDR(l) 0x5ffe0000
+#endif
+
/* If there is a DT_MIPS_RLD_MAP entry in the dynamic section, fill it in
with the run-time address of the r_debug structure */
#define ELF_MACHINE_DEBUG_SETUP(l,r) \
@@ -43,7 +83,7 @@ do { if ((l)->l_info[DT_MIPS (RLD_MAP)]) \
} while (0)
/* Return nonzero iff E_MACHINE is compatible with the running host. */
-static inline int
+static inline int __attribute__ ((unused))
elf_machine_matches_host (ElfW(Half) e_machine)
{
switch (e_machine)
@@ -56,6 +96,16 @@ elf_machine_matches_host (ElfW(Half) e_machine)
}
}
+/* Return the link-time address of _DYNAMIC. Conveniently, this is the
++ first element of the GOT. This must be inlined in a function which
++ uses global data. */
++static inline ElfW(Addr)
++elf_machine_dynamic (void)
++{
++ register ElfW(Addr) gp asm ("$28");
++ return * (ElfW(Addr) *) (gp - 0x7ff0);
++}
++
static inline ElfW(Addr) *
elf_mips_got_from_gpreg (ElfW(Addr) gpreg)
{
@@ -75,6 +125,16 @@ elf_machine_got (void)
}
+/* Return the link-time address of _DYNAMIC. Conveniently, this is the
+ first element of the GOT. This must be inlined in a function which
+ uses global data. */
+static inline ElfW(Addr)
+elf_machine_dynamic (void)
+{
+ register ElfW(Addr) gp asm ("$28");
+ return * (ElfW(Addr) *) (gp - 0x7ff0);
+}
+
/* Return the run-time load address of the shared object. */
static inline ElfW(Addr)
elf_machine_load_address (void)
@@ -87,7 +147,9 @@ elf_machine_load_address (void)
" nop\n"
"here: dsubu %0, $31, %0\n"
" .set reorder\n"
- : "=r" (addr));
+ : "=r" (addr)
+ : /* No inputs */
+ : "$31");
#else
asm (" .set noreorder\n"
" la %0, here\n"
@@ -95,7 +157,9 @@ elf_machine_load_address (void)
" nop\n"
"here: subu %0, $31, %0\n"
" .set reorder\n"
- : "=r" (addr));
+ : "=r" (addr)
+ : /* No inputs */
+ : "$31");
#endif
return addr;
}
@@ -105,7 +169,7 @@ elf_machine_load_address (void)
/* Relocate GOT. */
static inline void
-elf_machine_got_rel (struct link_map *map)
+elf_machine_got_rel (struct link_map *map, int lazy)
{
ElfW(Addr) *got;
ElfW(Sym) *sym;
@@ -119,7 +183,7 @@ elf_machine_got_rel (struct link_map *map)
const ElfW(Sym) *ref = sym; \
ElfW(Addr) sym_loadaddr; \
sym_loadaddr = _dl_lookup_symbol (strtab + sym->st_name, &ref, scope, \
- map->l_name, DL_LOOKUP_NOPLT); \
+ map->l_name, ELF_MACHINE_RELOC_NOPLT);\
(ref)? sym_loadaddr + ref->st_value: 0; \
})
@@ -151,7 +215,7 @@ elf_machine_got_rel (struct link_map *map)
{
if (ELFW(ST_TYPE) (sym->st_info) == STT_FUNC)
{
- if (sym->st_value /* && maybe_stub (sym->st_value) */)
+ if (sym->st_value && lazy)
*got = sym->st_value + map->l_addr;
else
*got = RESOLVE_GOTSYM (sym);
@@ -163,7 +227,7 @@ elf_machine_got_rel (struct link_map *map)
*got = RESOLVE_GOTSYM (sym);
else if (ELFW(ST_TYPE) (sym->st_info) == STT_FUNC
&& *got != sym->st_value
- /* && maybe_stub (*got) */)
+ && lazy)
*got += map->l_addr;
else if (ELFW(ST_TYPE) (sym->st_info) == STT_SECTION)
{
@@ -193,6 +257,11 @@ elf_machine_runtime_setup (struct link_map *l, int lazy)
extern void _dl_runtime_resolve (ElfW(Word));
extern int _dl_mips_gnu_objects;
+#ifdef RTLD_BOOTSTRAP
+ {
+ return lazy;
+ }
+#endif
if (lazy)
{
/* The GOT entries for functions have not yet been filled in.
@@ -216,7 +285,7 @@ elf_machine_runtime_setup (struct link_map *l, int lazy)
}
/* Relocate global offset table. */
- elf_machine_got_rel (l);
+ elf_machine_got_rel (l, lazy);
return lazy;
}
@@ -282,6 +351,7 @@ elf_machine_runtime_link_map (ElfW(Addr) gpreg, ElfW(Addr) stub_pc)
}
_dl_signal_error (0, NULL, "cannot find runtime link map");
+ return NULL;
}
/* Mips has no PLT but define elf_machine_relplt to be elf_machine_rel. */
@@ -295,211 +365,220 @@ elf_machine_runtime_link_map (ElfW(Addr) gpreg, ElfW(Addr) stub_pc)
to usual c arguments. */
#ifdef __mips64
-#define ELF_MACHINE_RUNTIME_TRAMPOLINE \
-/* The flag _dl_mips_gnu_objects is set if all dynamic objects are \
- generated by the gnu linker. */\
-int _dl_mips_gnu_objects = 1;\
-\
+#define ELF_MACHINE_RUNTIME_TRAMPOLINE \
+/* The flag _dl_mips_gnu_objects is set if all dynamic objects are \
+ generated by the gnu linker. */ \
+int _dl_mips_gnu_objects = 1; \
+ \
/* This is called from assembly stubs below which the compiler can't see. */ \
-static ElfW(Addr) \
-__dl_runtime_resolve (ElfW(Word), ElfW(Word), ElfW(Addr), ElfW(Addr)) \
- __attribute__ ((unused)); \
-\
-static ElfW(Addr) \
-__dl_runtime_resolve (ElfW(Word) sym_index,\
- ElfW(Word) return_address,\
- ElfW(Addr) old_gpreg,\
- ElfW(Addr) stub_pc)\
-{\
- struct link_map *l = elf_machine_runtime_link_map (old_gpreg, stub_pc);\
- const ElfW(Sym) *const symtab\
- = (const ElfW(Sym) *) (l->l_addr + l->l_info[DT_SYMTAB]->d_un.d_ptr);\
- const char *strtab\
- = (void *) (l->l_addr + l->l_info[DT_STRTAB]->d_un.d_ptr);\
- const ElfW(Addr) *got\
- = (const ElfW(Addr) *) (l->l_addr + l->l_info[DT_PLTGOT]->d_un.d_ptr);\
- const ElfW(Word) local_gotno\
- = (const ElfW(Word)) l->l_info[DT_MIPS (LOCAL_GOTNO)]->d_un.d_val;\
- const ElfW(Word) gotsym\
- = (const ElfW(Word)) l->l_info[DT_MIPS (GOTSYM)]->d_un.d_val;\
- const ElfW(Sym) *definer;\
- ElfW(Addr) loadbase;\
- ElfW(Addr) funcaddr;\
- struct link_map **scope;\
-\
- /* Look up the symbol's run-time value. */\
- scope = _dl_object_relocation_scope (l);\
- definer = &symtab[sym_index];\
-\
- loadbase = _dl_lookup_symbol (strtab + definer->st_name, &definer,\
- scope, l->l_name, DL_LOOKUP_NOPLT);\
-\
- *_dl_global_scope_end = NULL;\
-\
- /* Apply the relocation with that value. */\
- funcaddr = loadbase + definer->st_value;\
- *(got + local_gotno + sym_index - gotsym) = funcaddr;\
-\
- return funcaddr;\
-}\
-\
-asm ("\n\
- .text\n\
- .align 3\n\
- .globl _dl_runtime_resolve\n\
- .type _dl_runtime_resolve,@function\n\
- .ent _dl_runtime_resolve\n\
-_dl_runtime_resolve:\n\
- .set noreorder\n\
- # Save old GP to $3.\n\
- move $3,$28\n\
- # Modify t9 ($25) so as to point .cpload instruction.\n\
- daddu $25,2*8\n\
- # Compute GP.\n\
- .cpload $25\n\
- .set reorder\n\
- # Save slot call pc.\n\
- move $2, $31\n\
- # Save arguments and sp value in stack.\n\
- dsubu $29, 10*8\n\
- .cprestore 8*8\n\
- sd $15, 9*8($29)\n\
- sd $4, 3*8($29)\n\
- sd $5, 4*8($29)\n\
- sd $6, 5*8($29)\n\
- sd $7, 6*8($29)\n\
- sd $16, 7*8($29)\n\
- move $16, $29\n\
- move $4, $24\n\
- move $5, $15\n\
- move $6, $3\n\
- move $7, $2\n\
- jal __dl_runtime_resolve\n\
- move $29, $16\n\
- ld $31, 9*8($29)\n\
- ld $4, 3*8($29)\n\
- ld $5, 4*8($29)\n\
- ld $6, 5*8($29)\n\
- ld $7, 6*8($29)\n\
- ld $16, 7*8($29)\n\
- daddu $29, 10*8\n\
- move $25, $2\n\
- jr $25\n\
- .end _dl_runtime_resolve\n\
+static ElfW(Addr) \
+__dl_runtime_resolve (ElfW(Word), ElfW(Word), ElfW(Addr), ElfW(Addr)) \
+ __attribute__ ((unused)); \
+ \
+static ElfW(Addr) \
+__dl_runtime_resolve (ElfW(Word) sym_index, \
+ ElfW(Word) return_address, \
+ ElfW(Addr) old_gpreg, \
+ ElfW(Addr) stub_pc) \
+{ \
+ struct link_map *l = elf_machine_runtime_link_map (old_gpreg, stub_pc); \
+ const ElfW(Sym) *const symtab \
+ = (const ElfW(Sym) *) (l->l_addr + l->l_info[DT_SYMTAB]->d_un.d_ptr); \
+ const char *strtab \
+ = (void *) (l->l_addr + l->l_info[DT_STRTAB]->d_un.d_ptr); \
+ const ElfW(Addr) *got \
+ = (const ElfW(Addr) *) (l->l_addr + l->l_info[DT_PLTGOT]->d_un.d_ptr); \
+ const ElfW(Word) local_gotno \
+ = (const ElfW(Word)) l->l_info[DT_MIPS (LOCAL_GOTNO)]->d_un.d_val; \
+ const ElfW(Word) gotsym \
+ = (const ElfW(Word)) l->l_info[DT_MIPS (GOTSYM)]->d_un.d_val; \
+ const ElfW(Sym) *definer; \
+ ElfW(Addr) loadbase; \
+ ElfW(Addr) funcaddr; \
+ struct link_map **scope; \
+ \
+ /* Look up the symbol's run-time value. */ \
+ scope = _dl_object_relocation_scope (l); \
+ definer = &symtab[sym_index]; \
+ \
+ loadbase = _dl_lookup_symbol (strtab + definer->st_name, &definer, \
+ scope, l->l_name, ELF_MACHINE_RELOC_NOPLT); \
+ \
+ *_dl_global_scope_end = NULL; \
+ \
+ /* Apply the relocation with that value. */ \
+ funcaddr = loadbase + definer->st_value; \
+ *(got + local_gotno + sym_index - gotsym) = funcaddr; \
+ \
+ return funcaddr; \
+} \
+ \
+asm ("\n \
+ .text\n \
+ .align 3\n \
+ .globl _dl_runtime_resolve\n \
+ .type _dl_runtime_resolve,@function\n \
+ .ent _dl_runtime_resolve\n \
+_dl_runtime_resolve:\n \
+ .set noreorder\n \
+ # Save old GP to $3.\n \
+ move $3,$28\n \
+ # Modify t9 ($25) so as to point .cpload instruction.\n \
+ daddu $25,2*8\n \
+ # Compute GP.\n \
+ .cpload $25\n \
+ .set reorder\n \
+ # Save slot call pc.\n \
+ move $2, $31\n \
+ # Save arguments and sp value in stack.\n \
+ dsubu $29, 10*8\n \
+ .cprestore 8*8\n \
+ sd $15, 9*8($29)\n \
+ sd $4, 3*8($29)\n \
+ sd $5, 4*8($29)\n \
+ sd $6, 5*8($29)\n \
+ sd $7, 6*8($29)\n \
+ sd $16, 7*8($29)\n \
+ move $16, $29\n \
+ move $4, $24\n \
+ move $5, $15\n \
+ move $6, $3\n \
+ move $7, $2\n \
+ jal __dl_runtime_resolve\n \
+ move $29, $16\n \
+ ld $31, 9*8($29)\n \
+ ld $4, 3*8($29)\n \
+ ld $5, 4*8($29)\n \
+ ld $6, 5*8($29)\n \
+ ld $7, 6*8($29)\n \
+ ld $16, 7*8($29)\n \
+ daddu $29, 10*8\n \
+ move $25, $2\n \
+ jr $25\n \
+ .end _dl_runtime_resolve\n \
");
#else
-#define ELF_MACHINE_RUNTIME_TRAMPOLINE \
-/* The flag _dl_mips_gnu_objects is set if all dynamic objects are \
- generated by the gnu linker. */\
-int _dl_mips_gnu_objects = 1;\
-\
+#define ELF_MACHINE_RUNTIME_TRAMPOLINE \
+/* The flag _dl_mips_gnu_objects is set if all dynamic objects are \
+ generated by the gnu linker. */ \
+int _dl_mips_gnu_objects = 1; \
+ \
/* This is called from assembly stubs below which the compiler can't see. */ \
-static ElfW(Addr) \
-__dl_runtime_resolve (ElfW(Word), ElfW(Word), ElfW(Addr), ElfW(Addr)) \
- __attribute__ ((unused)); \
-\
-static ElfW(Addr) \
-__dl_runtime_resolve (ElfW(Word) sym_index,\
- ElfW(Word) return_address,\
- ElfW(Addr) old_gpreg,\
- ElfW(Addr) stub_pc)\
-{\
- struct link_map *l = elf_machine_runtime_link_map (old_gpreg, stub_pc);\
- const ElfW(Sym) *const symtab\
- = (const ElfW(Sym) *) (l->l_addr + l->l_info[DT_SYMTAB]->d_un.d_ptr);\
- const char *strtab\
- = (void *) (l->l_addr + l->l_info[DT_STRTAB]->d_un.d_ptr);\
- const ElfW(Addr) *got\
- = (const ElfW(Addr) *) (l->l_addr + l->l_info[DT_PLTGOT]->d_un.d_ptr);\
- const ElfW(Word) local_gotno\
- = (const ElfW(Word)) l->l_info[DT_MIPS (LOCAL_GOTNO)]->d_un.d_val;\
- const ElfW(Word) gotsym\
- = (const ElfW(Word)) l->l_info[DT_MIPS (GOTSYM)]->d_un.d_val;\
- const ElfW(Sym) *definer;\
- ElfW(Addr) loadbase;\
- ElfW(Addr) funcaddr;\
- struct link_map **scope;\
-\
- /* Look up the symbol's run-time value. */\
- scope = _dl_object_relocation_scope (l);\
- definer = &symtab[sym_index];\
-\
- loadbase = _dl_lookup_symbol (strtab + definer->st_name, &definer,\
- scope, l->l_name, DL_LOOKUP_NOPLT);\
-\
- *_dl_global_scope_end = NULL;\
-\
- /* Apply the relocation with that value. */\
- funcaddr = loadbase + definer->st_value;\
- *(got + local_gotno + sym_index - gotsym) = funcaddr;\
-\
- return funcaddr;\
-}\
-\
-asm ("\n\
- .text\n\
- .align 2\n\
- .globl _dl_runtime_resolve\n\
- .type _dl_runtime_resolve,@function\n\
- .ent _dl_runtime_resolve\n\
-_dl_runtime_resolve:\n\
- .set noreorder\n\
- # Save old GP to $3.\n\
- move $3,$28\n\
- # Modify t9 ($25) so as to point .cpload instruction.\n\
- addu $25,8\n\
- # Compute GP.\n\
- .cpload $25\n\
- .set reorder\n\
- # Save slot call pc.\n\
- move $2, $31\n\
- # Save arguments and sp value in stack.\n\
- subu $29, 40\n\
- .cprestore 32\n\
- sw $15, 36($29)\n\
- sw $4, 12($29)\n\
- sw $5, 16($29)\n\
- sw $6, 20($29)\n\
- sw $7, 24($29)\n\
- sw $16, 28($29)\n\
- move $16, $29\n\
- move $4, $24\n\
- move $5, $15\n\
- move $6, $3\n\
- move $7, $2\n\
- jal __dl_runtime_resolve\n\
- move $29, $16\n\
- lw $31, 36($29)\n\
- lw $4, 12($29)\n\
- lw $5, 16($29)\n\
- lw $6, 20($29)\n\
- lw $7, 24($29)\n\
- lw $16, 28($29)\n\
- addu $29, 40\n\
- move $25, $2\n\
- jr $25\n\
- .end _dl_runtime_resolve\n\
+static ElfW(Addr) \
+__dl_runtime_resolve (ElfW(Word), ElfW(Word), ElfW(Addr), ElfW(Addr)) \
+ __attribute__ ((unused)); \
+ \
+static ElfW(Addr) \
+__dl_runtime_resolve (ElfW(Word) sym_index, \
+ ElfW(Word) return_address, \
+ ElfW(Addr) old_gpreg, \
+ ElfW(Addr) stub_pc) \
+{ \
+ struct link_map *l = elf_machine_runtime_link_map (old_gpreg, stub_pc); \
+ const ElfW(Sym) *const symtab \
+ = (const ElfW(Sym) *) (l->l_addr + l->l_info[DT_SYMTAB]->d_un.d_ptr); \
+ const char *strtab \
+ = (void *) (l->l_addr + l->l_info[DT_STRTAB]->d_un.d_ptr); \
+ const ElfW(Addr) *got \
+ = (const ElfW(Addr) *) (l->l_addr + l->l_info[DT_PLTGOT]->d_un.d_ptr); \
+ const ElfW(Word) local_gotno \
+ = (const ElfW(Word)) l->l_info[DT_MIPS (LOCAL_GOTNO)]->d_un.d_val; \
+ const ElfW(Word) gotsym \
+ = (const ElfW(Word)) l->l_info[DT_MIPS (GOTSYM)]->d_un.d_val; \
+ const ElfW(Sym) *definer; \
+ ElfW(Addr) loadbase; \
+ ElfW(Addr) funcaddr; \
+ struct link_map **scope; \
+ \
+ /* Look up the symbol's run-time value. */ \
+ scope = _dl_object_relocation_scope (l); \
+ definer = &symtab[sym_index]; \
+ \
+ loadbase = _dl_lookup_symbol (strtab + definer->st_name, &definer, \
+ scope, l->l_name, ELF_MACHINE_RELOC_NOPLT); \
+ \
+ *_dl_global_scope_end = NULL; \
+ \
+ /* Apply the relocation with that value. */ \
+ funcaddr = loadbase + definer->st_value; \
+ *(got + local_gotno + sym_index - gotsym) = funcaddr; \
+ \
+ return funcaddr; \
+} \
+ \
+asm ("\n \
+ .text\n \
+ .align 2\n \
+ .globl _dl_runtime_resolve\n \
+ .type _dl_runtime_resolve,@function\n \
+ .ent _dl_runtime_resolve\n \
+_dl_runtime_resolve:\n \
+ .set noreorder\n \
+ # Save slot call pc.\n \
+ move $3, $31\n \
+ # Modify t9 ($25) so as to point .cpload instruction.\n \
+ addu $25,8\n \
+ # Compute GP.\n \
+ .cpload $25\n \
+ .set reorder\n \
+ # Save slot call pc.\n \
+ move $2, $31\n \
+ # Save arguments and sp value in stack.\n \
+ subu $29, 40\n \
+ .cprestore 32\n \
+ sw $15, 36($29)\n \
+ sw $4, 12($29)\n \
+ sw $5, 16($29)\n \
+ sw $6, 20($29)\n \
+ sw $7, 24($29)\n \
+ sw $16, 28($29)\n \
+ move $16, $29\n \
+ move $4, $24\n \
+ move $5, $15\n \
+ move $6, $3\n \
+ move $7, $2\n \
+ jal __dl_runtime_resolve\n \
+ move $29, $16\n \
+ lw $31, 36($29)\n \
+ lw $4, 12($29)\n \
+ lw $5, 16($29)\n \
+ lw $6, 20($29)\n \
+ lw $7, 24($29)\n \
+ lw $16, 28($29)\n \
+ addu $29, 40\n \
+ move $25, $2\n \
+ jr $25\n \
+ .end _dl_runtime_resolve\n \
");
#endif
/* Mask identifying addresses reserved for the user program,
where the dynamic linker should not map anything. */
-#define ELF_MACHINE_USER_ADDRESS_MASK 0x00000000UL
+#define ELF_MACHINE_USER_ADDRESS