From 7f07b8deffa7eaea0cbab9e84503b7644a6b6f8e Mon Sep 17 00:00:00 2001 From: Bernhard Reutner-Fischer Date: Mon, 22 Dec 2008 09:58:25 +0000 Subject: - non-pic support for MIPS (Catherine Moore, clm at codesourcery com) --- ldso/ldso/mips/dl-sysdep.h | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'ldso/ldso/mips/dl-sysdep.h') diff --git a/ldso/ldso/mips/dl-sysdep.h b/ldso/ldso/mips/dl-sysdep.h index 728779250..8f303fba1 100644 --- a/ldso/ldso/mips/dl-sysdep.h +++ b/ldso/ldso/mips/dl-sysdep.h @@ -93,10 +93,11 @@ typedef struct #include -#define ARCH_NUM 3 +#define ARCH_NUM 4 #define DT_MIPS_GOTSYM_IDX (DT_NUM + OS_NUM) #define DT_MIPS_LOCAL_GOTNO_IDX (DT_NUM + OS_NUM +1) #define DT_MIPS_SYMTABNO_IDX (DT_NUM + OS_NUM +2) +#define DT_MIPS_PLTGOT_IDX (DT_NUM + OS_NUM +3) #define ARCH_DYNAMIC_INFO(dpnt, dynamic, debug_addr) \ do { \ @@ -106,6 +107,8 @@ else if (dpnt->d_tag == DT_MIPS_LOCAL_GOTNO) \ dynamic[DT_MIPS_LOCAL_GOTNO_IDX] = dpnt->d_un.d_val; \ else if (dpnt->d_tag == DT_MIPS_SYMTABNO) \ dynamic[DT_MIPS_SYMTABNO_IDX] = dpnt->d_un.d_val; \ +else if (dpnt->d_tag == DT_MIPS_PLTGOT) \ + dynamic[DT_MIPS_PLTGOT_IDX] = dpnt->d_un.d_val; \ else if (dpnt->d_tag == DT_MIPS_RLD_MAP) \ *(ElfW(Addr) *)(dpnt->d_un.d_ptr) = (ElfW(Addr)) debug_addr; \ } while (0) @@ -114,6 +117,7 @@ else if (dpnt->d_tag == DT_MIPS_RLD_MAP) \ #define INIT_GOT(GOT_BASE,MODULE) \ do { \ unsigned long idx; \ + unsigned long *pltgot; \ \ /* Check if this is the dynamic linker itself */ \ if (MODULE->libtype == program_interpreter) \ @@ -123,6 +127,12 @@ do { \ GOT_BASE[0] = (unsigned long) _dl_runtime_resolve; \ GOT_BASE[1] = (unsigned long) MODULE; \ \ + pltgot = MODULE->dynamic_info[DT_MIPS_PLTGOT_IDX]; \ + if (pltgot) { \ + pltgot[0] = (unsigned long) _dl_runtime_pltresolve; \ + pltgot[1] = (unsigned long) MODULE; \ + } \ + \ /* Add load address displacement to all local GOT entries */ \ idx = 2; \ while (idx < MODULE->dynamic_info[DT_MIPS_LOCAL_GOTNO_IDX]) \ @@ -151,9 +161,9 @@ void _dl_perform_mips_global_got_relocations(struct elf_resolve *tpnt, int lazy) #define OFFS_ALIGN (0x10000000000UL-0x1000) #endif /* O32 || N32 */ -#define elf_machine_type_class(type) ELF_RTYPE_CLASS_PLT -/* MIPS does not have COPY relocs */ -#define DL_NO_COPY_RELOCS +#define elf_machine_type_class(type) \ + ((((type) == R_MIPS_JUMP_SLOT) * ELF_RTYPE_CLASS_PLT) \ + | (((type) == R_MIPS_COPY) * ELF_RTYPE_CLASS_COPY)) #define OFFSET_GP_GOT 0x7ff0 -- cgit v1.2.3