diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2007-11-27 16:42:20 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2007-11-27 16:42:20 +0000 |
commit | 33f3250176ebfd4d01c91b64a2db9a4281295ffc (patch) | |
tree | e9178cca85e50cc6aedcab0259fcf0ed91339151 /libexec/ld.so/i386/rtld_machine.c | |
parent | 71abb69ad5b56f2815e077a3ef725973b5a7e280 (diff) |
Make _dl_md_reloc_got() report errors, and take them into account.
Fixes PR #5579.
Diffstat (limited to 'libexec/ld.so/i386/rtld_machine.c')
-rw-r--r-- | libexec/ld.so/i386/rtld_machine.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/libexec/ld.so/i386/rtld_machine.c b/libexec/ld.so/i386/rtld_machine.c index 2bd698d10ba..34b0588b751 100644 --- a/libexec/ld.so/i386/rtld_machine.c +++ b/libexec/ld.so/i386/rtld_machine.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rtld_machine.c,v 1.21 2007/05/05 15:21:21 drahn Exp $ */ +/* $OpenBSD: rtld_machine.c,v 1.22 2007/11/27 16:42:19 miod Exp $ */ /* * Copyright (c) 2002 Dale Rahn @@ -171,7 +171,7 @@ _dl_md_reloc(elf_object_t *object, int rel, int relsz) { long i; long numrel; - long fails = 0; + int fails = 0; Elf_Addr loff; Elf_Rel *rels; struct load_list *llist; @@ -383,10 +383,11 @@ _dl_bind(elf_object_t *object, int index) return((Elf_Addr)ooff + this->st_value); } -void +int _dl_md_reloc_got(elf_object_t *object, int lazy) { extern void _dl_bind_start(void); /* XXX */ + int fails = 0; Elf_Addr *pltgot = (Elf_Addr *)object->Dyn.info[DT_PLTGOT]; int i, num; Elf_Rel *rel; @@ -395,13 +396,13 @@ _dl_md_reloc_got(elf_object_t *object, int lazy) const Elf_Sym *this; if (pltgot == NULL) - return; /* it is possible to have no PLT/GOT relocations */ + return (0); /* it is possible to have no PLT/GOT relocations */ pltgot[1] = (Elf_Addr)object; pltgot[2] = (Elf_Addr)&_dl_bind_start; if (object->Dyn.info[DT_PLTREL] != DT_REL) - return; + return (0); object->got_addr = NULL; object->got_size = 0; @@ -426,7 +427,7 @@ _dl_md_reloc_got(elf_object_t *object, int lazy) } 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]); @@ -453,4 +454,6 @@ _dl_md_reloc_got(elf_object_t *object, int lazy) if (object->got_size != 0) _dl_mprotect((void*)object->got_start, object->got_size, PROT_READ); + + return (fails); } |