diff options
-rw-r--r-- | libexec/ld.so/sparc64/ldasm.S | 16 | ||||
-rw-r--r-- | libexec/ld.so/sparc64/rtld_machine.c | 29 |
2 files changed, 28 insertions, 17 deletions
diff --git a/libexec/ld.so/sparc64/ldasm.S b/libexec/ld.so/sparc64/ldasm.S index 53f1713080f..7871a31966b 100644 --- a/libexec/ld.so/sparc64/ldasm.S +++ b/libexec/ld.so/sparc64/ldasm.S @@ -1,4 +1,4 @@ -/* $OpenBSD: ldasm.S,v 1.7 2001/09/25 06:57:03 art Exp $ */ +/* $OpenBSD: ldasm.S,v 1.8 2002/03/15 14:52:39 drahn Exp $ */ /* $NetBSD: rtld_start.S,v 1.5 2001/08/14 22:17:48 eeh Exp $ */ /* @@ -165,11 +165,7 @@ _dl_bind_start_0: # (x, y) #if 0 call _dl_bind_start_0_stub ldx [%o1 + (10*4)], %l7 - mov %o0, %l5 - - sllx %l5, 1, %l6 /* Each element is an Elf_Rela which */ - add %l6, %l5, %l5 /* is 3 longwords or 24 bytes. */ - sllx %l5, 3, %o1 /* So multiply by 24. */ + mov %o0, %o1 call _dl_bind mov %l7, %o0 @@ -195,10 +191,6 @@ _dl_bind_start_0: # (x, y) add %l3, %l4, %l5 /* %l5 = (i/5120)*160 + (i%5120)/24; */ add %l5, %l6, %l5 - sllx %l5, 1, %l6 /* Each element is an Elf_Rela which */ - add %l6, %l5, %l5 /* is 3 longwords or 24 bytes. */ - sllx %l5, 3, %l5 /* So multiply by 24. */ - call _dl_bind /* Call _dl_bind(obj, offset) */ mov %l5, %o1 @@ -213,10 +205,6 @@ _dl_bind_start_0: # (x, y) _dl_bind_start_1: # (x, y) srax %o0, 15, %o2 /* %o0 is the index to our PLT slot */ - sllx %o2, 1, %o3 /* Each element is an Elf_Rela which */ - add %o3, %o2, %o2 /* is 3 longwords or 24 bytes. */ - sllx %o2, 3, %o2 /* So multiply by 24. */ - ldx [%o1 + 8], %o0 /* The object pointer is at [%o1 + 8] */ call _dl_bind /* Call _dl_bind(obj, offset) */ 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); |