diff options
author | Joakim Tjernlund <joakim.tjernlund@transmode.se> | 2005-03-15 07:40:40 +0000 |
---|---|---|
committer | Joakim Tjernlund <joakim.tjernlund@transmode.se> | 2005-03-15 07:40:40 +0000 |
commit | 9e4aaecaedec718490e7c343b0da99c6668a896c (patch) | |
tree | bf5a75dcbdabacd25283407449cdfe3aefb9429f | |
parent | a29e1adf934a56d02eaf4b79e278fa9896d1235f (diff) |
Fix MIPS initial GOT relocation.
-rw-r--r-- | ldso/ldso/mips/dl-startup.h | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/ldso/ldso/mips/dl-startup.h b/ldso/ldso/mips/dl-startup.h index 0a19f7534..a4e8f13f4 100644 --- a/ldso/ldso/mips/dl-startup.h +++ b/ldso/ldso/mips/dl-startup.h @@ -51,33 +51,34 @@ asm("" \ #define PERFORM_BOOTSTRAP_GOT(got, tpnt) \ do { \ Elf32_Sym *sym; \ - Elf32_Addr i; \ - Elf32_Addr *mipsgot = (void *) got; \ + Elf32_Addr i; \ + register ElfW(Addr) gp __asm__ ("$28"); \ + Elf32_Addr *mipsgot = elf_mips_got_from_gpreg (gp); \ \ /* Add load address displacement to all local GOT entries */ \ i = 2; \ while (i < tpnt->dynamic_info[DT_MIPS_LOCAL_GOTNO_IDX]) \ - mipsgot[i++] += load_addr; \ + mipsgot[i++] += tpnt->loadaddr; \ \ /* Handle global GOT entries */ \ mipsgot += tpnt->dynamic_info[DT_MIPS_LOCAL_GOTNO_IDX]; \ sym = (Elf32_Sym *) (tpnt->dynamic_info[DT_SYMTAB] + \ - load_addr) + tpnt->dynamic_info[DT_MIPS_GOTSYM_IDX]; \ + tpnt->loadaddr) + tpnt->dynamic_info[DT_MIPS_GOTSYM_IDX]; \ i = tpnt->dynamic_info[DT_MIPS_SYMTABNO_IDX] - tpnt->dynamic_info[DT_MIPS_GOTSYM_IDX];\ \ while (i--) { \ if (sym->st_shndx == SHN_UNDEF || \ sym->st_shndx == SHN_COMMON) \ - *mipsgot = load_addr + sym->st_value; \ + *mipsgot = tpnt->loadaddr + sym->st_value; \ else if (ELF32_ST_TYPE(sym->st_info) == STT_FUNC && \ *mipsgot != sym->st_value) \ - *mipsgot += load_addr; \ + *mipsgot += tpnt->loadaddr; \ else if (ELF32_ST_TYPE(sym->st_info) == STT_SECTION) { \ if (sym->st_other == 0) \ - *mipsgot += load_addr; \ + *mipsgot += tpnt->loadaddr; \ } \ else \ - *mipsgot = load_addr + sym->st_value; \ + *mipsgot = tpnt->loadaddr + sym->st_value; \ \ mipsgot++; \ sym++; \ |