summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArtur Grabowski <art@cvs.openbsd.org>2001-09-26 14:57:57 +0000
committerArtur Grabowski <art@cvs.openbsd.org>2001-09-26 14:57:57 +0000
commita29b7a5b23d6f02ea052429901fa40e0b33092d8 (patch)
tree687b9a1a74adf43809cfd6f0f7cd4afcffb40032
parentcda9abc0fa6ea85da6b5b8e66e4b4b7a483c026e (diff)
Some juggling to simplify the code and some missing code.
-rw-r--r--libexec/ld.so/sparc64/rtld_machine.c29
1 files changed, 15 insertions, 14 deletions
diff --git a/libexec/ld.so/sparc64/rtld_machine.c b/libexec/ld.so/sparc64/rtld_machine.c
index 3e7743fa4e5..00413f7aa2b 100644
--- a/libexec/ld.so/sparc64/rtld_machine.c
+++ b/libexec/ld.so/sparc64/rtld_machine.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rtld_machine.c,v 1.6 2001/09/26 10:45:02 art Exp $ */
+/* $OpenBSD: rtld_machine.c,v 1.7 2001/09/26 14:57:56 art Exp $ */
/*
* Copyright (c) 1999 Dale Rahn
@@ -223,7 +223,7 @@ _dl_md_reloc(elf_object_t *object, int rel, int relasz)
long i;
long numrela;
long fails = 0;
- Elf_Addr loff, mask;
+ Elf_Addr loff;
Elf_RelA *relas;
load_list_t *llist;
@@ -248,27 +248,26 @@ _dl_md_reloc(elf_object_t *object, int rel, int relasz)
}
for (i = 0; i < numrela; i++, relas++) {
- Elf_Addr *where, value, ooff;
- long type;
+ Elf_Addr *where, value, ooff, mask;
+ Elf_Word type;
const Elf_Sym *sym, *this;
const char *symn;
- where = (Elf64_Addr *)(relas->r_offset + loff);
-
type = ELF_R_TYPE(relas->r_info);
- value = relas->r_addend;
if (type == R_TYPE(NONE))
continue;
- if (type == R_TYPE(RELATIVE)) {
- *where = (Elf_Addr)(loff + value);
- continue;
- }
-
if (type == R_TYPE(JMP_SLOT) && rel != DT_JMPREL)
continue;
+ where = (Elf_Addr *)(relas->r_offset + loff);
+
+ if (RELOC_USE_ADDEND(type))
+ value = relas->r_addend;
+ else
+ value = 0;
+
if (RELOC_RESOLVE_SYMBOL(type)) {
sym = object->dyn.symtab;
sym += ELF_R_SYM(relas->r_info);
@@ -288,8 +287,6 @@ resolve_failed:
}
if (type == R_TYPE(JMP_SLOT)) {
- if (relas->r_addend)
- value -= relas->r_addend;
_dl_reloc_plt((Elf_Word *)where, value, relas);
continue;
}
@@ -320,6 +317,10 @@ resolve_failed:
value += loff;
}
+ mask = RELOC_VALUE_BITMASK(type);
+ value >>= RELOC_VALUE_RIGHTSHIFT(type);
+ value &= mask;
+
if (RELOC_UNALIGNED(type)) {
/* Handle unaligned relocations. */
Elf_Addr tmp = 0;