diff options
author | Mark Kettenis <kettenis@cvs.openbsd.org> | 2014-12-27 13:13:26 +0000 |
---|---|---|
committer | Mark Kettenis <kettenis@cvs.openbsd.org> | 2014-12-27 13:13:26 +0000 |
commit | 465987ac2e18695dd7d9673cc4c9f39e529ad052 (patch) | |
tree | 94979dc70bf39e9d08bd484090bd97e0bb9a0a98 /libexec | |
parent | 21c90662df847a474839774f7da564b23480cb0b (diff) |
Make ld.so process only R_ALPHA_RELATIVE relocations during early GOT
relocation in _reloc_alpha_got(), and teach RELOC_RELA() to skip R_ALPHA_NONE
relocations (which are just nops used to fill out the relocation table).
Handling R_ALPHA_NONE relocations will be necessary for static PIE support
and it is not inconceivable that ld.so will end up with such relocations
at some point.
ok kurt@
Diffstat (limited to 'libexec')
-rw-r--r-- | libexec/ld.so/alpha/archdep.h | 4 | ||||
-rw-r--r-- | libexec/ld.so/alpha/rtld_machine.c | 5 |
2 files changed, 6 insertions, 3 deletions
diff --git a/libexec/ld.so/alpha/archdep.h b/libexec/ld.so/alpha/archdep.h index 44e7f595bf7..930efed3929 100644 --- a/libexec/ld.so/alpha/archdep.h +++ b/libexec/ld.so/alpha/archdep.h @@ -1,4 +1,4 @@ -/* $OpenBSD: archdep.h,v 1.15 2014/11/03 17:50:56 guenther Exp $ */ +/* $OpenBSD: archdep.h,v 1.16 2014/12/27 13:13:25 kettenis Exp $ */ /* * Copyright (c) 1998 Per Fogelstrom, Opsycon AB @@ -54,6 +54,8 @@ RELOC_RELA(Elf64_Rela *r, const Elf64_Sym *s, Elf64_Addr *p, unsigned long v, { if (ELF64_R_TYPE(r->r_info) == RELOC_RELATIVE) { /* handled by _reloc_alpha_got */ + } else if (ELF64_R_TYPE(r->r_info) == RELOC_NONE) { + /* nothing to do */ } else if (ELF64_R_TYPE(r->r_info) == RELOC_JMP_SLOT) { Elf64_Addr val = v + s->st_value + r->r_addend - (Elf64_Addr)(p); diff --git a/libexec/ld.so/alpha/rtld_machine.c b/libexec/ld.so/alpha/rtld_machine.c index 221c9c014e1..ce41b65fd1c 100644 --- a/libexec/ld.so/alpha/rtld_machine.c +++ b/libexec/ld.so/alpha/rtld_machine.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rtld_machine.c,v 1.51 2014/04/16 10:52:58 guenther Exp $ */ +/* $OpenBSD: rtld_machine.c,v 1.52 2014/12/27 13:13:25 kettenis Exp $ */ /* * Copyright (c) 1999 Dale Rahn @@ -375,8 +375,9 @@ _reloc_alpha_got(Elf_Dyn *dynp, Elf_Addr relocbase) } relalim = (const Elf_RelA *)((caddr_t)rela + relasz); for (; rela < relalim; rela++) { + if (ELF64_R_TYPE(rela->r_info) != RELOC_RELATIVE) + continue; where = (Elf_Addr *)(relocbase + rela->r_offset); - /* XXX For some reason I see a few GLOB_DAT relocs here. */ *where += (Elf_Addr)relocbase; } } |