diff options
author | Philip Guenther <guenther@cvs.openbsd.org> | 2019-10-23 19:55:10 +0000 |
---|---|---|
committer | Philip Guenther <guenther@cvs.openbsd.org> | 2019-10-23 19:55:10 +0000 |
commit | 9cfa71267b5d70d7fb61345493bc9e39baedca58 (patch) | |
tree | 9e658387119560d975858be23e72f43dcc1f8bb7 /libexec/ld.so/alpha | |
parent | 532c17d7310844a0a0fcbf2827dcd69a7045e782 (diff) |
Prefer the size-independent ELF identifiers over the size-specific ones.
Strip superfluous parens from return statements while here.
Done programatically with two perl invocations
idea ok kettenis@ drahn@
ok visa@
Diffstat (limited to 'libexec/ld.so/alpha')
-rw-r--r-- | libexec/ld.so/alpha/archdep.h | 16 | ||||
-rw-r--r-- | libexec/ld.so/alpha/rtld_machine.c | 42 |
2 files changed, 29 insertions, 29 deletions
diff --git a/libexec/ld.so/alpha/archdep.h b/libexec/ld.so/alpha/archdep.h index 02bcc145607..74c7318af73 100644 --- a/libexec/ld.so/alpha/archdep.h +++ b/libexec/ld.so/alpha/archdep.h @@ -1,4 +1,4 @@ -/* $OpenBSD: archdep.h,v 1.22 2018/11/22 21:37:30 guenther Exp $ */ +/* $OpenBSD: archdep.h,v 1.23 2019/10/23 19:55:08 guenther Exp $ */ /* * Copyright (c) 1998 Per Fogelstrom, Opsycon AB @@ -39,18 +39,18 @@ #include "util.h" static inline void -RELOC_DYN(Elf64_Rela *r, const Elf64_Sym *s, Elf64_Addr *p, unsigned long v) +RELOC_DYN(Elf_RelA *r, const Elf_Sym *s, Elf_Addr *p, unsigned long v) { - if (ELF64_R_TYPE(r->r_info) == RELOC_RELATIVE) { + if (ELF_R_TYPE(r->r_info) == RELOC_RELATIVE) { *p += v; - } else if (ELF64_R_TYPE(r->r_info) == RELOC_NONE) { + } else if (ELF_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); + } else if (ELF_R_TYPE(r->r_info) == RELOC_JMP_SLOT) { + Elf_Addr val = v + s->st_value + r->r_addend - + (Elf_Addr)(p); *p = val; __asm volatile("imb" : : : "memory"); - } else if (ELF64_R_TYPE(r->r_info) == RELOC_GLOB_DAT) { + } else if (ELF_R_TYPE(r->r_info) == RELOC_GLOB_DAT) { *p = v + s->st_value + r->r_addend; } else { _dl_exit(6); diff --git a/libexec/ld.so/alpha/rtld_machine.c b/libexec/ld.so/alpha/rtld_machine.c index dabff9f7eb8..0e4c93f6bc7 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.68 2019/10/05 00:08:50 guenther Exp $ */ +/* $OpenBSD: rtld_machine.c,v 1.69 2019/10/23 19:55:08 guenther Exp $ */ /* * Copyright (c) 1999 Dale Rahn @@ -55,18 +55,18 @@ _dl_md_reloc(elf_object_t *object, int rel, int relasz) long numrela; long relrel; int fails = 0; - Elf64_Addr loff; - Elf64_Addr prev_value = 0; + Elf_Addr loff; + Elf_Addr prev_value = 0; const Elf_Sym *prev_sym = NULL; - Elf64_Rela *relas; + Elf_RelA *relas; loff = object->obj_base; - numrela = object->Dyn.info[relasz] / sizeof(Elf64_Rela); + numrela = object->Dyn.info[relasz] / sizeof(Elf_RelA); relrel = rel == DT_RELA ? object->relacount : 0; - relas = (Elf64_Rela *)(object->Dyn.info[rel]); + relas = (Elf_RelA *)(object->Dyn.info[rel]); if (relas == NULL) - return(0); + return 0; if (relrel > numrela) _dl_die("relacount > numrel: %ld > %ld", relrel, numrela); @@ -78,7 +78,7 @@ _dl_md_reloc(elf_object_t *object, int rel, int relasz) for (i = 0; i < relrel; i++, relas++) { Elf_Addr *r_addr; - r_addr = (Elf64_Addr *)(relas->r_offset + loff); + r_addr = (Elf_Addr *)(relas->r_offset + loff); /* Handle unaligned RELATIVE relocs */ if ((((Elf_Addr)r_addr) & 0x7) != 0) { @@ -90,22 +90,22 @@ _dl_md_reloc(elf_object_t *object, int rel, int relasz) *r_addr += loff; } for (; i < numrela; i++, relas++) { - Elf64_Addr *r_addr; + Elf_Addr *r_addr; struct sym_res sr; - const Elf64_Sym *sym; + const Elf_Sym *sym; const char *symn; - r_addr = (Elf64_Addr *)(relas->r_offset + loff); + r_addr = (Elf_Addr *)(relas->r_offset + loff); - if (ELF64_R_SYM(relas->r_info) == 0xffffffff) + if (ELF_R_SYM(relas->r_info) == 0xffffffff) continue; sym = object->dyn.symtab; - sym += ELF64_R_SYM(relas->r_info); + sym += ELF_R_SYM(relas->r_info); symn = object->dyn.strtab + sym->st_name; - switch (ELF64_R_TYPE(relas->r_info)) { + switch (ELF_R_TYPE(relas->r_info)) { case R_TYPE(REFQUAD): sr = _dl_find_symbol(symn, SYM_SEARCH_ALL|SYM_WARNNOTFOUND|SYM_NOTPLT, @@ -160,7 +160,7 @@ _dl_printf("unaligned RELATIVE: %p type: %d %s 0x%lx -> 0x%lx\n", r_addr, default: _dl_die("%s: unsupported relocation '%s' %lld at %p", object->load_name, symn, - ELF64_R_TYPE(relas->r_info), (void *)r_addr); + ELF_R_TYPE(relas->r_info), (void *)r_addr); } continue; resolve_failed: @@ -169,7 +169,7 @@ resolve_failed: } __asm volatile("imb" : : : "memory"); - return (fails); + return fails; } /* @@ -191,7 +191,7 @@ _dl_bind(elf_object_t *object, int reloff) rela = (Elf_RelA *)(object->Dyn.info[DT_JMPREL] + reloff); sym = object->dyn.symtab; - sym += ELF64_R_SYM(rela->r_info); + sym += ELF_R_SYM(rela->r_info); symn = object->dyn.strtab + sym->st_name; sr = _dl_find_symbol(symn, SYM_SEARCH_ALL|SYM_WARNNOTFOUND|SYM_PLT, @@ -202,7 +202,7 @@ _dl_bind(elf_object_t *object, int reloff) buf.newval = sr.obj->obj_base + sr.sym->st_value + rela->r_addend; if (__predict_false(sr.obj->traced) && _dl_trace_plt(sr.obj, symn)) - return (buf.newval); + return buf.newval; buf.param.kb_addr = (Elf_Addr *)(object->obj_base + rela->r_offset); buf.param.kb_size = sizeof(Elf_Addr); @@ -219,7 +219,7 @@ _dl_bind(elf_object_t *object, int reloff) "r" (arg3) : "$19", "$20", "memory"); } - return (buf.newval); + return buf.newval; } void _dl_bind_start(void) __dso_hidden; /* XXX */ @@ -234,7 +234,7 @@ _dl_md_reloc_got(elf_object_t *object, int lazy) Elf_Addr *pltgot; if (object->Dyn.info[DT_PLTREL] != DT_RELA) - return (0); + return 0; pltgot = (Elf_Addr *)object->Dyn.info[DT_PLTGOT]; @@ -263,5 +263,5 @@ _dl_md_reloc_got(elf_object_t *object, int lazy) pltgot[1] = (Elf_Addr)object; } - return (fails); + return fails; } |