summaryrefslogtreecommitdiff
path: root/libexec/ld.so/sh
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2007-11-27 16:42:20 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2007-11-27 16:42:20 +0000
commit33f3250176ebfd4d01c91b64a2db9a4281295ffc (patch)
treee9178cca85e50cc6aedcab0259fcf0ed91339151 /libexec/ld.so/sh
parent71abb69ad5b56f2815e077a3ef725973b5a7e280 (diff)
Make _dl_md_reloc_got() report errors, and take them into account.
Fixes PR #5579.
Diffstat (limited to 'libexec/ld.so/sh')
-rw-r--r--libexec/ld.so/sh/rtld_machine.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/libexec/ld.so/sh/rtld_machine.c b/libexec/ld.so/sh/rtld_machine.c
index 9af19cfd91c..41fa8e7d951 100644
--- a/libexec/ld.so/sh/rtld_machine.c
+++ b/libexec/ld.so/sh/rtld_machine.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rtld_machine.c,v 1.8 2007/05/05 15:21:21 drahn Exp $ */
+/* $OpenBSD: rtld_machine.c,v 1.9 2007/11/27 16:42:19 miod Exp $ */
/*
* Copyright (c) 2004 Dale Rahn
@@ -599,7 +599,7 @@ _dl_md_reloc(elf_object_t *object, int rel, int relasz)
{
long i;
long numrela;
- long fails = 0;
+ int fails = 0;
Elf_Addr loff;
Elf_RelA *rels;
struct load_list *llist;
@@ -763,9 +763,10 @@ resolve_failed:
* This is done by calling _dl_md_reloc on DT_JUMPREL for DL_BIND_NOW,
* otherwise the lazy binding plt initialization is performed.
*/
-void
+int
_dl_md_reloc_got(elf_object_t *object, int lazy)
{
+ int fails = 0;
Elf_Addr *pltgot = (Elf_Addr *)object->Dyn.info[DT_PLTGOT];
Elf_Addr ooff;
const Elf_Sym *this;
@@ -776,7 +777,7 @@ _dl_md_reloc_got(elf_object_t *object, int lazy)
lazy = 0;
if (object->Dyn.info[DT_PLTREL] != DT_RELA)
- return;
+ return (0);
object->got_addr = NULL;
object->got_size = 0;
@@ -804,7 +805,7 @@ _dl_md_reloc_got(elf_object_t *object, int lazy)
object->plt_start = NULL;
if (!lazy) {
- _dl_md_reloc(object, DT_JMPREL, DT_PLTRELSZ);
+ fails = _dl_md_reloc(object, DT_JMPREL, DT_PLTRELSZ);
} else {
rel = (Elf_Rel *)(object->Dyn.info[DT_JMPREL]);
num = (object->Dyn.info[DT_PLTRELSZ]);
@@ -824,6 +825,8 @@ _dl_md_reloc_got(elf_object_t *object, int lazy)
if (object->plt_size != 0)
_dl_mprotect((void*)object->plt_start, object->plt_size,
PROT_READ|PROT_EXEC);
+
+ return (fails);
}
Elf_Addr