Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/libexec/ld.elf_so/arch/mips Fix C&P bug. Deal with more MIPS...
details: https://anonhg.NetBSD.org/src/rev/62b510ecd668
branches: trunk
changeset: 354539:62b510ecd668
user: joerg <joerg%NetBSD.org@localhost>
date: Tue Jun 20 13:24:03 2017 +0000
description:
Fix C&P bug. Deal with more MIPS hacks overriding def.
diffstat:
libexec/ld.elf_so/arch/mips/mips_reloc.c | 24 +++++++++++++-----------
1 files changed, 13 insertions(+), 11 deletions(-)
diffs (83 lines):
diff -r 73d278a1010a -r 62b510ecd668 libexec/ld.elf_so/arch/mips/mips_reloc.c
--- a/libexec/ld.elf_so/arch/mips/mips_reloc.c Tue Jun 20 13:21:45 2017 +0000
+++ b/libexec/ld.elf_so/arch/mips/mips_reloc.c Tue Jun 20 13:24:03 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: mips_reloc.c,v 1.66 2017/06/19 11:57:01 joerg Exp $ */
+/* $NetBSD: mips_reloc.c,v 1.67 2017/06/20 13:24:03 joerg Exp $ */
/*
* Copyright 1997 Michael L. Hitch <mhitch%montana.edu@localhost>
@@ -30,7 +30,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: mips_reloc.c,v 1.66 2017/06/19 11:57:01 joerg Exp $");
+__RCSID("$NetBSD: mips_reloc.c,v 1.67 2017/06/20 13:24:03 joerg Exp $");
#endif /* not lint */
#include <sys/types.h>
@@ -228,8 +228,8 @@
{
const Elf_Rel *rel;
Elf_Addr *got = obj->pltgot;
- const Elf_Sym *sym, *def;
- const Obj_Entry *defobj;
+ const Elf_Sym *sym, *def = NULL;
+ const Obj_Entry *defobj = NULL;
unsigned long last_symnum = ULONG_MAX;
Elf_Word i;
#ifdef SUPPORT_OLD_BROKEN_LD
@@ -329,7 +329,7 @@
case R_TYPE(TLS_DTPREL32):
case R_TYPE(TLS_TPREL32):
#endif
- symnum = ELF_R_SYM(rela->r_info);
+ symnum = ELF_R_SYM(rel->r_info);
if (last_symnum != symnum) {
last_symnum = symnum;
def = _rtld_find_symdef(symnum, obj, &defobj,
@@ -348,6 +348,7 @@
case R_TYPE(REL32): {
/* 32-bit PC-relative reference */
+ const Elf_Sym *def2;
const size_t rlen =
ELF_R_NXTTYPE_64_P(r_type)
? sizeof(Elf_Sxword)
@@ -355,13 +356,14 @@
Elf_Sxword old = load_ptr(where, rlen);
Elf_Sxword val = old;
- def = obj->symtab + r_symndx;
+ def2 = obj->symtab + ELF_R_SYM(rel->r_info);
- if (r_symndx >= obj->gotsym) {
- val += got[obj->local_gotno + r_symndx - obj->gotsym];
+ if (ELF_R_SYM(rel->r_info) >= obj->gotsym) {
+ val += got[obj->local_gotno +
+ ELF_R_SYM(rel->r_info) - obj->gotsym];
rdbg(("REL32/G(%p) %p --> %p (%s) in %s",
where, (void *)old, (void *)val,
- obj->strtab + def->st_name,
+ obj->strtab + def2->st_name,
obj->path));
} else {
/*
@@ -380,7 +382,7 @@
* --rkb, Oct 6, 2001
*/
- if (def->st_info ==
+ if (def2->st_info ==
ELF_ST_INFO(STB_LOCAL, STT_SECTION)
#ifdef SUPPORT_OLD_BROKEN_LD
&& !broken
@@ -392,7 +394,7 @@
rdbg(("REL32/L(%p) %p -> %p (%s) in %s",
where, (void *)old, (void *)val,
- obj->strtab + def->st_name, obj->path));
+ obj->strtab + def2->st_name, obj->path));
}
store_ptr(where, val, rlen);
break;
Home |
Main Index |
Thread Index |
Old Index