Apply fixes from Charles:

- Fix how _rtld_relocate_nonplt_self deals with REL32 relocations.

- Change the assert so that it is correct for binutils 2.14 and 2.15.

There are still problems with the libraries generated with binutils 2.15,
but at least ld.elf_so doesn't crash.
This commit is contained in:
skrll 2004-12-15 10:26:29 +00:00
parent 8e7f054fdb
commit 38fb01be3a

View File

@ -1,4 +1,4 @@
/* $NetBSD: mips_reloc.c,v 1.45 2003/11/19 19:41:57 simonb Exp $ */
/* $NetBSD: mips_reloc.c,v 1.46 2004/12/15 10:26:29 skrll Exp $ */
/*
* Copyright 1997 Michael L. Hitch <mhitch@montana.edu>
@ -137,13 +137,11 @@ _rtld_relocate_nonplt_self(Elf_Dyn *dynp, Elf_Addr relocbase)
case R_TYPE(REL32):
assert(ELF_R_SYM(rel->r_info) < gotsym);
sym = symtab + ELF_R_SYM(rel->r_info);
assert(sym->st_info ==
ELF_ST_INFO(STB_LOCAL, STT_SECTION));
assert(ELF_ST_BIND(sym->st_info) == STB_LOCAL);
if (__predict_true(RELOC_ALIGNED_P(where)))
*where += (Elf_Addr)(sym->st_value + relocbase);
*where += relocbase;
else
store_ptr(where, load_ptr(where) +
(Elf_Addr)(sym->st_value + relocbase));
store_ptr(where, load_ptr(where) + relocbase);
break;
default: