diff options
author | Dale Rahn <drahn@cvs.openbsd.org> | 2002-03-15 14:52:40 +0000 |
---|---|---|
committer | Dale Rahn <drahn@cvs.openbsd.org> | 2002-03-15 14:52:40 +0000 |
commit | 8ac4d27abf792757bbc8e71d8497b8631145bd6a (patch) | |
tree | 5596b0265797ed2878b7ea9955505deb376ef1e7 /libexec/ld.so/sparc64/rtld_machine.c | |
parent | 97569307e000e086fd6cf20aeaa2dfa10dc5c67d (diff) |
Add support for binutils 2.11. Work around change in PLT generation new ld
generates. From NetBSD. ok art@
Diffstat (limited to 'libexec/ld.so/sparc64/rtld_machine.c')
-rw-r--r-- | libexec/ld.so/sparc64/rtld_machine.c | 29 |
1 files changed, 26 insertions, 3 deletions
diff --git a/libexec/ld.so/sparc64/rtld_machine.c b/libexec/ld.so/sparc64/rtld_machine.c index 07641725708..3bbe447f264 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.10 2002/02/21 23:17:53 drahn Exp $ */ +/* $OpenBSD: rtld_machine.c,v 1.11 2002/03/15 14:52:39 drahn Exp $ */ /* * Copyright (c) 1999 Dale Rahn @@ -612,7 +612,7 @@ _dl_reloc_plt(Elf_Word *where, Elf_Addr value, Elf_RelA *rela) * Resolve a symbol at run-time. */ void * -_dl_bind(elf_object_t *object, Elf_Word reloff) +_dl_bind(elf_object_t *object, int index) { Elf_RelA *rela; Elf_Word *addr; @@ -620,7 +620,30 @@ _dl_bind(elf_object_t *object, Elf_Word reloff) const Elf_Sym *sym, *this; const char *symn; - rela = (Elf_RelA *)(object->Dyn.info[DT_JMPREL] + reloff); + rela = (Elf_RelA *)(object->Dyn.info[DT_JMPREL]); + if (ELF_R_TYPE(rela->r_info) == R_TYPE(JMP_SLOT)) { + /* + * XXXX + * + * The first four PLT entries are reserved. There + * is some disagreement whether they should have + * associated relocation entries. Both the SPARC + * 32-bit and 64-bit ELF specifications say that + * they should have relocation entries, but the + * 32-bit SPARC binutils do not generate them, + * and now the 64-bit SPARC binutils have stopped + * generating them too. + * + * So, to provide binary compatibility, we will + * check the first entry, if it is reserved it + * should not be of the type JMP_SLOT. If it + * is JMP_SLOT, then the 4 reserved entries were + * not generated and our index is 4 entries too far. + */ + index -= 4; + } + + rela += index; sym = object->dyn.symtab; sym += ELF64_R_SYM(rela->r_info); |