diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2002-05-24 04:17:02 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2002-05-24 04:17:02 +0000 |
commit | 02ba7b17f1114bc55b4a50e004451dc9942b9fc0 (patch) | |
tree | 549afb30dbb96e63d1876bada2785100ad266fc4 /libexec/ld.so | |
parent | a2c4c67f6bef5f075a102e449c50d7bbefa3e41b (diff) |
more KNF
Diffstat (limited to 'libexec/ld.so')
-rw-r--r-- | libexec/ld.so/alpha/ldasm.S | 4 | ||||
-rw-r--r-- | libexec/ld.so/alpha/rtld_machine.c | 6 | ||||
-rw-r--r-- | libexec/ld.so/dlfcn.c | 12 | ||||
-rw-r--r-- | libexec/ld.so/ldconfig/ldconfig.8 | 4 | ||||
-rw-r--r-- | libexec/ld.so/ldconfig/ldconfig.c | 4 | ||||
-rw-r--r-- | libexec/ld.so/ldconfig/shlib.c | 6 | ||||
-rw-r--r-- | libexec/ld.so/ldd/ldd.1 | 6 | ||||
-rw-r--r-- | libexec/ld.so/library.c | 11 | ||||
-rw-r--r-- | libexec/ld.so/loader.c | 20 | ||||
-rw-r--r-- | libexec/ld.so/mips/rtld_machine.c | 39 | ||||
-rw-r--r-- | libexec/ld.so/mips/syscall.h | 8 | ||||
-rw-r--r-- | libexec/ld.so/powerpc/archdep.h | 14 | ||||
-rw-r--r-- | libexec/ld.so/powerpc/ldasm.S | 4 | ||||
-rw-r--r-- | libexec/ld.so/powerpc/rtld_machine.c | 26 | ||||
-rw-r--r-- | libexec/ld.so/powerpc/syscall.h | 244 | ||||
-rw-r--r-- | libexec/ld.so/resolve.c | 9 | ||||
-rw-r--r-- | libexec/ld.so/resolve.h | 16 | ||||
-rw-r--r-- | libexec/ld.so/sod.c | 4 | ||||
-rw-r--r-- | libexec/ld.so/sparc64/ldasm.S | 8 | ||||
-rw-r--r-- | libexec/ld.so/sparc64/rtld_machine.c | 8 |
20 files changed, 228 insertions, 225 deletions
diff --git a/libexec/ld.so/alpha/ldasm.S b/libexec/ld.so/alpha/ldasm.S index 1d09ca23489..db58dce0ac6 100644 --- a/libexec/ld.so/alpha/ldasm.S +++ b/libexec/ld.so/alpha/ldasm.S @@ -1,4 +1,4 @@ -/* $OpenBSD: ldasm.S,v 1.6 2002/05/24 03:44:37 deraadt Exp $ */ +/* $OpenBSD: ldasm.S,v 1.7 2002/05/24 04:17:00 deraadt Exp $ */ /* * Copyright (c) 2001 Niklas Hallqvist @@ -194,7 +194,7 @@ L100: LDGP(t0) imb /* Pop the stack frame and turn control to the destination. */ - lda sp, 168(sp) + lda sp, 168(sp) jmp zero, (pv) END(_dl_bind_start) diff --git a/libexec/ld.so/alpha/rtld_machine.c b/libexec/ld.so/alpha/rtld_machine.c index 7019f80a6a7..c2479370dc9 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.9 2002/05/24 03:44:37 deraadt Exp $ */ +/* $OpenBSD: rtld_machine.c,v 1.10 2002/05/24 04:17:00 deraadt Exp $ */ /* * Copyright (c) 1999 Dale Rahn @@ -71,7 +71,7 @@ _dl_md_reloc(elf_object_t *object, int rel, int relasz) Elf64_Rela *relas; load_list_t *llist; - loff = object->load_offs; + loff = object->load_offs; numrela = object->Dyn.info[relasz] / sizeof(Elf64_Rela); relas = (Elf64_Rela *)(object->Dyn.info[rel]); @@ -81,7 +81,7 @@ _dl_md_reloc(elf_object_t *object, int rel, int relasz) /* * unprotect some segments if we need it. * XXX - we unprotect waay to much. only the text can have cow - * relocations. + * relocations. */ if ((rel == DT_REL || rel == DT_RELA)) { for (llist = object->load_list; llist != NULL; llist = llist->next) { diff --git a/libexec/ld.so/dlfcn.c b/libexec/ld.so/dlfcn.c index 60c5fcccf54..1dee1bb4a0a 100644 --- a/libexec/ld.so/dlfcn.c +++ b/libexec/ld.so/dlfcn.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dlfcn.c,v 1.15 2002/05/24 03:44:37 deraadt Exp $ */ +/* $OpenBSD: dlfcn.c,v 1.16 2002/05/24 04:17:00 deraadt Exp $ */ /* * Copyright (c) 1998 Per Fogelstrom, Opsycon AB @@ -80,11 +80,11 @@ dlopen(const char *libname, int how) while (dynobj) { elf_object_t *tmpobj = dynobj; - for (dynp = dynobj->load_dyn; dynp->d_tag; dynp++) { + for (dynp = dynobj->load_dyn; dynp->d_tag; dynp++) { const char *libname; elf_object_t *depobj; - if (dynp->d_tag != DT_NEEDED) + if (dynp->d_tag != DT_NEEDED) continue; libname = dynobj->dyn.strtab + dynp->d_un.d_val; @@ -95,9 +95,9 @@ dlopen(const char *libname, int how) tmpobj->dep_next = _dl_malloc(sizeof(elf_object_t)); tmpobj->dep_next->next = depobj; tmpobj = tmpobj->dep_next; - } - dynobj = dynobj->next; - } + } + dynobj = dynobj->next; + } _dl_rtld(object); _dl_call_init(object); diff --git a/libexec/ld.so/ldconfig/ldconfig.8 b/libexec/ld.so/ldconfig/ldconfig.8 index 4236ab1fce0..d3f78137d2a 100644 --- a/libexec/ld.so/ldconfig/ldconfig.8 +++ b/libexec/ld.so/ldconfig/ldconfig.8 @@ -1,4 +1,4 @@ -.\" $OpenBSD: ldconfig.8,v 1.9 2001/11/13 14:06:10 mpech Exp $ +.\" $OpenBSD: ldconfig.8,v 1.10 2002/05/24 04:17:00 deraadt Exp $ .\" .\" Copyright (c) 1993,1995 Paul Kranenburg .\" All rights reserved. @@ -13,7 +13,7 @@ .\" documentation and/or other materials provided with the distribution. .\" 3. All advertising materials mentioning features or use of this software .\" must display the following acknowledgement: -.\" This product includes software developed by Paul Kranenburg. +.\" This product includes software developed by Paul Kranenburg. .\" 3. The name of the author may not be used to endorse or promote products .\" derived from this software without specific prior written permission .\" diff --git a/libexec/ld.so/ldconfig/ldconfig.c b/libexec/ld.so/ldconfig/ldconfig.c index cd0c111e2d9..0e8479f4322 100644 --- a/libexec/ld.so/ldconfig/ldconfig.c +++ b/libexec/ld.so/ldconfig/ldconfig.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ldconfig.c,v 1.9 2002/05/24 03:44:37 deraadt Exp $ */ +/* $OpenBSD: ldconfig.c,v 1.10 2002/05/24 04:17:00 deraadt Exp $ */ /* * Copyright (c) 1993,1995 Paul Kranenburg @@ -14,7 +14,7 @@ * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: - * This product includes software developed by Paul Kranenburg. + * This product includes software developed by Paul Kranenburg. * 4. The name of the author may not be used to endorse or promote products * derived from this software without specific prior written permission * diff --git a/libexec/ld.so/ldconfig/shlib.c b/libexec/ld.so/ldconfig/shlib.c index 12d4ef57414..6206179f065 100644 --- a/libexec/ld.so/ldconfig/shlib.c +++ b/libexec/ld.so/ldconfig/shlib.c @@ -1,4 +1,4 @@ -/* $OpenBSD: shlib.c,v 1.5 2002/05/24 03:44:37 deraadt Exp $ */ +/* $OpenBSD: shlib.c,v 1.6 2002/05/24 04:17:00 deraadt Exp $ */ /* $NetBSD: shlib.c,v 1.13 1998/04/04 01:00:29 fvdl Exp $ */ /* @@ -15,7 +15,7 @@ * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: - * This product includes software developed by Paul Kranenburg. + * This product includes software developed by Paul Kranenburg. * 4. The name of the author may not be used to endorse or promote products * derived from this software without specific prior written permission * @@ -113,7 +113,7 @@ remove_search_dir(name) free(search_dirs[i]); if (i < (n_search_dirs - 1)) bcopy(&search_dirs[i+1], &search_dirs[i], - (n_search_dirs - i - 1) * sizeof search_dirs[0]); + (n_search_dirs - i - 1) * sizeof search_dirs[0]); n_search_dirs--; search_dirs = (char **)xrealloc(search_dirs, n_search_dirs * sizeof search_dirs[0]); diff --git a/libexec/ld.so/ldd/ldd.1 b/libexec/ld.so/ldd/ldd.1 index 5537e90d089..a51995164be 100644 --- a/libexec/ld.so/ldd/ldd.1 +++ b/libexec/ld.so/ldd/ldd.1 @@ -1,4 +1,4 @@ -.\" $OpenBSD: ldd.1,v 1.2 2000/10/30 17:46:04 aaron Exp $ +.\" $OpenBSD: ldd.1,v 1.3 2002/05/24 04:17:00 deraadt Exp $ .\" .\" Copyright (c) 1996 Per Fogelstrom .\" @@ -12,8 +12,8 @@ .\" documentation and/or other materials provided with the distribution. .\" 3. All advertising materials mentioning features or use of this software .\" must display the following acknowledgement: -.\" This product includes software developed under OpenBSD by -.\" Per Fogelstrom. +.\" This product includes software developed under OpenBSD by +.\" Per Fogelstrom. .\" 4. The name of the author may not be used to endorse or promote products .\" derived from this software without specific prior written permission. .\" diff --git a/libexec/ld.so/library.c b/libexec/ld.so/library.c index 5d3195568d5..622ec7005a1 100644 --- a/libexec/ld.so/library.c +++ b/libexec/ld.so/library.c @@ -1,4 +1,4 @@ -/* $OpenBSD: library.c,v 1.11 2002/05/24 03:44:37 deraadt Exp $ */ +/* $OpenBSD: library.c,v 1.12 2002/05/24 04:17:00 deraadt Exp $ */ /* * Copyright (c) 1998 Per Fogelstrom, Opsycon AB @@ -190,7 +190,7 @@ _dl_tryload_shlib(const char *libname, int type) char hbuf[4096]; Elf_Ehdr *ehdr; Elf_Phdr *phdp; - Elf_Dyn *dynp = 0; + Elf_Dyn *dynp = 0; Elf_Addr maxva = 0; Elf_Addr minva = 0x7fffffff; /* XXX Correct for 64bit? */ Elf_Addr libaddr; @@ -269,7 +269,8 @@ _dl_tryload_shlib(const char *libname, int type) if (phdp->p_type == PT_LOAD) { int res; char *start = (char *)(phdp->p_vaddr & ~align) + loff; - int size = (phdp->p_vaddr & align) + phdp->p_filesz; + int size = (phdp->p_vaddr & align) + phdp->p_filesz; + res = _dl_mmap(start, size, PFLAGS(phdp->p_flags), MAP_FIXED|MAP_PRIVATE, libfile, phdp->p_offset & ~align); @@ -294,8 +295,8 @@ _dl_tryload_shlib(const char *libname, int type) _dl_memset(start + size, 0, _dl_pagesz - (size & align)); start = start + ((size + align) & ~align); - size = size - (phdp->p_vaddr & align); - size = phdp->p_memsz - size; + size = size - (phdp->p_vaddr & align); + size = phdp->p_memsz - size; res = _dl_mmap(start, size, PFLAGS(phdp->p_flags), MAP_FIXED|MAP_PRIVATE|MAP_ANON, diff --git a/libexec/ld.so/loader.c b/libexec/ld.so/loader.c index 2dc60778e7f..be1229542b1 100644 --- a/libexec/ld.so/loader.c +++ b/libexec/ld.so/loader.c @@ -1,4 +1,4 @@ -/* $OpenBSD: loader.c,v 1.29 2002/05/24 03:44:37 deraadt Exp $ */ +/* $OpenBSD: loader.c,v 1.30 2002/05/24 04:17:00 deraadt Exp $ */ /* * Copyright (c) 1998 Per Fogelstrom, Opsycon AB @@ -114,7 +114,7 @@ _dl_boot(const char **argv, const char **envp, const long loff, _dl_preload = _dl_getenv("LD_PRELOAD", envp); _dl_bindnow = _dl_getenv("LD_BIND_NOW", envp); _dl_traceld = _dl_getenv("LD_TRACE_LOADED_OBJECTS", envp); - _dl_debug = _dl_getenv("LD_DEBUG", envp); + _dl_debug = _dl_getenv("LD_DEBUG", envp); _dl_progname = argv[0]; if (dl_data[AUX_pagesz] != 0) @@ -205,7 +205,7 @@ _dl_boot(const char **argv, const char **envp, const long loff, * Do not schedule destructors if run from ldd. */ if (_dl_traceld == NULL) { - const Elf_Sym *sym; + const Elf_Sym *sym; Elf_Addr ooff; sym = NULL; @@ -370,16 +370,16 @@ _dl_boot_bind(const long sp, long loff, Elf_Dyn *dynamicp, long *dl_data) } { - int i; + int i; u_int32_t rs; - Elf_Rel *rp; + Elf_Rel *rp; rp = (Elf_Rel *)(dynld.Dyn.info[DT_REL]); rs = dynld.dyn.relsz; for (i = 0; i < rs; i += sizeof (Elf_Rel)) { Elf_Addr *ra; - const Elf_Sym *sp; + const Elf_Sym *sp; sp = dynld.dyn.symtab; sp += ELF_R_SYM(rp->r_info); @@ -405,9 +405,9 @@ _dl_boot_bind(const long sp, long loff, Elf_Dyn *dynamicp, long *dl_data) } for (n = 0; n < 2; n++) { - int i; + int i; unsigned long rs; - Elf_RelA *rp; + Elf_RelA *rp; switch (n) { case 0: @@ -424,7 +424,7 @@ _dl_boot_bind(const long sp, long loff, Elf_Dyn *dynamicp, long *dl_data) } for (i = 0; i < rs; i += sizeof (Elf_RelA)) { Elf_Addr *ra; - const Elf_Sym *sp; + const Elf_Sym *sp; sp = dynld.dyn.symtab; sp += ELF_R_SYM(rp->r_info); @@ -472,7 +472,7 @@ void _dl_call_init(elf_object_t *object) { Elf_Addr ooff; - const Elf_Sym *sym; + const Elf_Sym *sym; if (object->next) _dl_call_init(object->next); diff --git a/libexec/ld.so/mips/rtld_machine.c b/libexec/ld.so/mips/rtld_machine.c index 8e57fe3f4b2..d07a2c007f3 100644 --- a/libexec/ld.so/mips/rtld_machine.c +++ b/libexec/ld.so/mips/rtld_machine.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rtld_machine.c,v 1.2 2002/05/24 03:44:38 deraadt Exp $ */ +/* $OpenBSD: rtld_machine.c,v 1.3 2002/05/24 04:17:00 deraadt Exp $ */ /* * Copyright (c) 1998 Per Fogelstrom, Opsycon AB @@ -41,7 +41,6 @@ #include "syscall.h" #include "archdep.h" - int _dl_md_reloc(elf_object_t *object, int rel, int relsz) { @@ -51,13 +50,12 @@ _dl_md_reloc(elf_object_t *object, int rel, int relsz) Elf32_Addr loff; Elf32_Rel *relocs; - loff = object->load_offs; + loff = object->load_offs; numrel = object->Dyn.info[relsz] / sizeof(Elf32_Rel); relocs = (Elf32_Rel *)(object->Dyn.info[rel]); - if ((object->status & STAT_RELOC_DONE) || !relocs) { + if ((object->status & STAT_RELOC_DONE) || !relocs) return(0); - } for (i = 0; i < numrel; i++, relocs++) { Elf32_Addr r_addr = relocs->r_offset + loff; @@ -75,7 +73,7 @@ _dl_md_reloc(elf_object_t *object, int rel, int relsz) if (ELF32_R_SYM(relocs->r_info) && !(ELF32_ST_BIND(sym->st_info) == STB_LOCAL && - ELF32_ST_TYPE (sym->st_info) == STT_NOTYPE)) { + ELF32_ST_TYPE (sym->st_info) == STT_NOTYPE)) { ooff = _dl_find_symbol(symn, _dl_objects, &this, 0, 1); if (!this && ELF32_ST_BIND(sym->st_info) == STB_GLOBAL) { _dl_printf("%s: can't resolve reference '%s'\n", @@ -91,9 +89,8 @@ _dl_md_reloc(elf_object_t *object, int rel, int relsz) (ELF32_ST_TYPE(sym->st_info) == STT_SECTION || ELF32_ST_TYPE(sym->st_info) == STT_NOTYPE) ) { *(u_int32_t *)r_addr += loff; - } else if (this) { + } else if (this) *(u_int32_t *)r_addr += this->st_value + ooff; - } break; case R_MIPS_NONE: @@ -101,7 +98,7 @@ _dl_md_reloc(elf_object_t *object, int rel, int relsz) default: _dl_printf("%s: unsupported relocation '%s'\n", - _dl_progname, symn); + _dl_progname, symn); _dl_exit(1); } } @@ -133,11 +130,10 @@ _dl_md_reloc_got(elf_object_t *object, int lazy) loff = object->load_offs; strt = object->dyn.strtab; gotp = object->dyn.pltgot; - n = object->Dyn.info[DT_MIPS_LOCAL_GOTNO - DT_LOPROC + DT_NUM]; + n = object->Dyn.info[DT_MIPS_LOCAL_GOTNO - DT_LOPROC + DT_NUM]; - if (object->status & STAT_GOT_DONE) { + if (object->status & STAT_GOT_DONE) return; - } /* * Set up pointers for run time (lazy) resolving. @@ -158,8 +154,8 @@ _dl_md_reloc_got(elf_object_t *object, int lazy) symp = object->dyn.symtab; symp += object->Dyn.info[DT_MIPS_GOTSYM - DT_LOPROC + DT_NUM]; - n = object->Dyn.info[DT_MIPS_SYMTABNO - DT_LOPROC + DT_NUM] - - object->Dyn.info[DT_MIPS_GOTSYM - DT_LOPROC + DT_NUM]; + n = object->Dyn.info[DT_MIPS_SYMTABNO - DT_LOPROC + DT_NUM] - + object->Dyn.info[DT_MIPS_GOTSYM - DT_LOPROC + DT_NUM]; /* * Then do all global references according to the ABI. @@ -167,26 +163,23 @@ _dl_md_reloc_got(elf_object_t *object, int lazy) */ while (n--) { if (symp->st_shndx == SHN_UNDEF && - ELF32_ST_TYPE(symp->st_info) == STT_FUNC) { + ELF32_ST_TYPE(symp->st_info) == STT_FUNC) { _dl_printf("undef: %s = %X\n", strt + symp->st_name, symp->st_value); if (symp->st_value == 0 || !lazy) { this = 0; ooff = _dl_find_symbol(strt + symp->st_name, - _dl_objects, &this, 0, 1); - if (this) { + _dl_objects, &this, 0, 1); + if (this) *gotp = this->st_value + ooff; - } - } else { + } else *gotp = symp->st_value + ooff; - } } else if (symp->st_shndx == SHN_COMMON || symp->st_shndx == SHN_UNDEF) { this = 0; ooff = _dl_find_symbol(strt + symp->st_name, - _dl_objects, &this, 0, 1); - if (this) { + _dl_objects, &this, 0, 1); + if (this) *gotp = this->st_value + ooff; - } } else if (ELF32_ST_TYPE(symp->st_info) == STT_FUNC) { *gotp += loff; } else { /* XXX ??? */ /* Resolve all others immediatly */ diff --git a/libexec/ld.so/mips/syscall.h b/libexec/ld.so/mips/syscall.h index baff785e39c..6af92f5f042 100644 --- a/libexec/ld.so/mips/syscall.h +++ b/libexec/ld.so/mips/syscall.h @@ -1,4 +1,4 @@ -/* $OpenBSD: syscall.h,v 1.3 2002/05/24 03:44:38 deraadt Exp $ */ +/* $OpenBSD: syscall.h,v 1.4 2002/05/24 04:17:00 deraadt Exp $ */ /* * Copyright (c) 1998 Per Fogelstrom, Opsycon AB @@ -59,7 +59,7 @@ _dl_exit (int status) __asm__ volatile ("move $4,%2\n\t" "syscall" : "=r" (__status) - : "0" (SYS_exit), "r" (status) + : "0" (SYS_exit), "r" (status) : "$2", "$3", "$4", "$5", "$6", "$7", "$8", "$9", "$10","$11","$12","$13","$14","$15","$24","$25"); while (1) @@ -73,7 +73,7 @@ _dl_open (const char* addr, unsigned int flags) __asm__ volatile ("move $4,%2\n\t" "move $5,%3\n\t" - "syscall\n\t" + "syscall\n\t" "beq $7,$0,1f\n\t" "li $2,-1\n\t" "1:" @@ -141,7 +141,7 @@ _dl_read (int fd, const char* buf, int len) extern inline int _dl_mmap (void *addr, unsigned int size, unsigned int prot, - unsigned int flags, int fd, unsigned int f_offset) + unsigned int flags, int fd, unsigned int f_offset) { register int malloc_buffer __asm__ ("$2"); diff --git a/libexec/ld.so/powerpc/archdep.h b/libexec/ld.so/powerpc/archdep.h index c813c70a985..15d1da02aed 100644 --- a/libexec/ld.so/powerpc/archdep.h +++ b/libexec/ld.so/powerpc/archdep.h @@ -1,4 +1,4 @@ -/* $OpenBSD: archdep.h,v 1.6 2002/05/24 03:44:38 deraadt Exp $ */ +/* $OpenBSD: archdep.h,v 1.7 2002/05/24 04:17:01 deraadt Exp $ */ /* * Copyright (c) 1998 Per Fogelstrom, Opsycon AB @@ -60,12 +60,12 @@ static inline void _dl_dcbf(Elf32_Addr *addr) { - __asm__ volatile ("dcbst 0, %0\n\t" - "sync\n\t" - "icbi 0, %0\n\t" - "sync\n\t" - "isync" - : : "r" (addr) : "0"); + __asm__ volatile ("dcbst 0, %0\n\t" + "sync\n\t" + "icbi 0, %0\n\t" + "sync\n\t" + "isync" + : : "r" (addr) : "0"); } static inline void diff --git a/libexec/ld.so/powerpc/ldasm.S b/libexec/ld.so/powerpc/ldasm.S index e7e929825bd..e626587e723 100644 --- a/libexec/ld.so/powerpc/ldasm.S +++ b/libexec/ld.so/powerpc/ldasm.S @@ -1,4 +1,4 @@ -/* $OpenBSD: ldasm.S,v 1.3 2002/05/24 03:44:38 deraadt Exp $ */ +/* $OpenBSD: ldasm.S,v 1.4 2002/05/24 04:17:01 deraadt Exp $ */ /* * Copyright (c) 1999 Dale Rahn @@ -110,7 +110,7 @@ ENTRY(_dl_start) /* This cheats and calculates the address of _DYNAMIC * the same way that the GLOBAL_OFFSET_TABLE was calcuated */ - lwz 18, 4(5) + lwz 18, 4(5) rlwinm 18,18,0,8,30 # mask off the offset portion of the instr. add 8, 18, 5 # address of _DYNAMIC (arg6 for _dl_boot) addi 18, 8, 4 # correction. diff --git a/libexec/ld.so/powerpc/rtld_machine.c b/libexec/ld.so/powerpc/rtld_machine.c index 1354b90393a..d661349eca3 100644 --- a/libexec/ld.so/powerpc/rtld_machine.c +++ b/libexec/ld.so/powerpc/rtld_machine.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rtld_machine.c,v 1.6 2002/05/24 03:44:38 deraadt Exp $ */ +/* $OpenBSD: rtld_machine.c,v 1.7 2002/05/24 04:17:01 deraadt Exp $ */ /* * Copyright (c) 1999 Dale Rahn @@ -69,7 +69,7 @@ _dl_md_reloc(elf_object_t *object, int rel, int relasz) Elf32_Addr *first_rela; - loff = object->load_offs; + loff = object->load_offs; numrela = object->Dyn.info[relasz] / sizeof(Elf32_Rela); relas = (Elf32_Rela *)(object->Dyn.info[rel]); @@ -108,7 +108,7 @@ _dl_printf("object relocation size %x, numrela %x\n", val = ((Elf32_Addr)plttable >> 16) + (((Elf32_Addr)plttable & 0x00008000) >> 15); pltcall[0] = 0x3d6b0000 | val; /* addis r11,r11,.PLTtable@ha*/ - val = (Elf32_Addr)plttable & 0x0000ffff; + val = (Elf32_Addr)plttable & 0x0000ffff; pltcall[1] = 0x816b0000 | val; /* lwz r11,plttable@l(r11) */ pltcall[2] = 0x7d6903a6; /* mtctr r12 */ pltcall[3] = 0x4e800420; /* bctr */ @@ -161,7 +161,7 @@ _dl_printf("object relocation size %x, numrela %x\n", case RELOC_32: if (ELF32_ST_BIND(sym->st_info) == STB_LOCAL && (ELF32_ST_TYPE(sym->st_info) == STT_SECTION || - ELF32_ST_TYPE(sym->st_info) == STT_NOTYPE) ) { + ELF32_ST_TYPE(sym->st_info) == STT_NOTYPE) ) { *r_addr = ooff + relas->r_addend; } else { *r_addr = ooff + this->st_value + @@ -172,7 +172,7 @@ _dl_printf("object relocation size %x, numrela %x\n", case RELOC_RELATIVE: if (ELF32_ST_BIND(sym->st_info) == STB_LOCAL && (ELF32_ST_TYPE(sym->st_info) == STT_SECTION || - ELF32_ST_TYPE(sym->st_info) == STT_NOTYPE) ) { + ELF32_ST_TYPE(sym->st_info) == STT_NOTYPE) ) { *r_addr = loff + relas->r_addend; #ifdef DL_PRINTF_DEBUG @@ -186,7 +186,7 @@ _dl_printf("rel1 r_addr %x val %x loff %x ooff %x addend %x\n", r_addr, } break; case RELOC_JMP_SLOT: - { + { Elf32_Addr val = ooff + this->st_value + relas->r_addend - (Elf32_Addr)r_addr; if (!(((val & 0xfe000000) == 0x00000000) || @@ -210,7 +210,7 @@ _dl_printf(" ooff %x, sym val %x, addend %x" (Elf32_Addr)&r_addr[2]; r_addr[1] = 0x396b0000 | val; val &= ~0xfc000000; - val |= 0x48000000; + val |= 0x48000000; r_addr[2] = val; } else { #ifdef DL_PRINTF_DEBUG @@ -222,7 +222,7 @@ _dl_printf(" index %d, pltcall %x r_addr %x\n", val = (Elf32_Addr)pltcall - (Elf32_Addr)&r_addr[1]; val &= ~0xfc000000; - val |= 0x48000000; + val |= 0x48000000; r_addr[1] = val; } @@ -239,11 +239,11 @@ _dl_printf(" symn [%s] val 0x%x\n", symn, val); * branch directy to the dest */ val &= ~0xfc000000; - val |= 0x48000000; + val |= 0x48000000; *r_addr = val; _dl_dcbf(r_addr); } - } + } break; case RELOC_GLOB_DAT: @@ -261,7 +261,7 @@ _dl_printf(" symn [%s] val 0x%x\n", symn, val); _dl_exit(20); } val &= ~0xfc000003; - val |= (*r_addr & 0xfc000003); + val |= (*r_addr & 0xfc000003); *r_addr = val; _dl_dcbf(r_addr); @@ -317,7 +317,7 @@ _dl_dcbf(r_addr); _dl_exit(20); } val &= ~0xffff0003; - val |= (*r_addr & 0xffff0003); + val |= (*r_addr & 0xffff0003); *r_addr = val; #ifdef DL_PRINTF_DEBUG _dl_printf("rel 14 %x val %x\n", r_addr, val); @@ -355,7 +355,7 @@ _dl_dcbf(r_addr); if (cpysrc == NULL) { _dl_printf("symbol not found [%s] \n", symn); } else { - size = sym->st_size; + size = sym->st_size; if (sym->st_size != cpysrc->st_size) { _dl_printf("symbols size differ [%s] \n", symn); diff --git a/libexec/ld.so/powerpc/syscall.h b/libexec/ld.so/powerpc/syscall.h index 6cdf53e20b5..55916a5eddf 100644 --- a/libexec/ld.so/powerpc/syscall.h +++ b/libexec/ld.so/powerpc/syscall.h @@ -1,4 +1,4 @@ -/* $OpenBSD: syscall.h,v 1.6 2002/05/24 03:44:38 deraadt Exp $ */ +/* $OpenBSD: syscall.h,v 1.7 2002/05/24 04:17:01 deraadt Exp $ */ /* * Copyright (c) 1998 Per Fogelstrom, Opsycon AB @@ -43,8 +43,8 @@ #ifndef _dl_MAX_ERRNO #define _dl_MAX_ERRNO 4096 #endif -#define _dl_check_error(__res) \ - ((int) __res < 0 && (int) __res >= -_dl_MAX_ERRNO) +#define _dl_check_error(__res) \ + ((int) __res < 0 && (int) __res >= -_dl_MAX_ERRNO) /* * Inlined system call functions that can be used before @@ -54,87 +54,93 @@ static inline int _dl_exit (int status) { - register int __status __asm__ ("3"); - __asm__ volatile ("mr 0,%1\n\t" - "mr 3,%2\n\t" - "sc" - : "=r" (__status) - : "r" (SYS_exit), "r" (status) : "0", "3"); - while (1) - ; + register int __status __asm__ ("3"); + + __asm__ volatile ("mr 0,%1\n\t" + "mr 3,%2\n\t" + "sc" + : "=r" (__status) + : "r" (SYS_exit), "r" (status) : "0", "3"); + + while (1) + ; } static inline int _dl_open (const char* addr, unsigned int flags) { - register int status __asm__ ("3"); - __asm__ volatile ("mr 0,%1\n\t" - "mr 3,%2\n\t" - "mr 4,%3\n\t" - "sc\n\t" - "cmpwi 0, 0\n\t" - "beq 1f\n\t" - "li 3,-1\n\t" - "1:" - : "=r" (status) - : "r" (SYS_open), "r" (addr), "r" (flags) - : "0", "3", "4" ); - return status; + register int status __asm__ ("3"); + + __asm__ volatile ("mr 0,%1\n\t" + "mr 3,%2\n\t" + "mr 4,%3\n\t" + "sc\n\t" + "cmpwi 0, 0\n\t" + "beq 1f\n\t" + "li 3,-1\n\t" + "1:" + : "=r" (status) + : "r" (SYS_open), "r" (addr), "r" (flags) + : "0", "3", "4" ); + return status; } static inline int _dl_close (int fd) { - register int status __asm__ ("3"); - __asm__ volatile ("mr 0,%1\n\t" - "mr 3,%2\n\t" - "sc\n\t" - "cmpwi 0, 0\n\t" - "beq 1f\n\t" - "li 3,-1\n\t" - "1:" - : "=r" (status) - : "r" (SYS_close), "r" (fd) - : "0", "3"); - return status; + register int status __asm__ ("3"); + + __asm__ volatile ("mr 0,%1\n\t" + "mr 3,%2\n\t" + "sc\n\t" + "cmpwi 0, 0\n\t" + "beq 1f\n\t" + "li 3,-1\n\t" + "1:" + : "=r" (status) + : "r" (SYS_close), "r" (fd) + : "0", "3"); + return status; } static inline int _dl_write (int fd, const char* buf, int len) { - register int status __asm__ ("3"); - __asm__ volatile ("mr 0,%1\n\t" - "mr 3,%2\n\t" - "mr 4,%3\n\t" - "mr 5,%4\n\t" - "sc\n\t" - "cmpwi 0, 0\n\t" - "beq 1f\n\t" - "li 3,-1\n\t" - "1:" - : "=r" (status) - : "r" (SYS_write), "r" (fd), "r" (buf), "r" (len) - : "0", "3", "4", "5" ); - return status; + register int status __asm__ ("3"); + + __asm__ volatile ("mr 0,%1\n\t" + "mr 3,%2\n\t" + "mr 4,%3\n\t" + "mr 5,%4\n\t" + "sc\n\t" + "cmpwi 0, 0\n\t" + "beq 1f\n\t" + "li 3,-1\n\t" + "1:" + : "=r" (status) + : "r" (SYS_write), "r" (fd), "r" (buf), "r" (len) + : "0", "3", "4", "5" ); + return status; } static inline int _dl_read (int fd, const char* buf, int len) { - register int status __asm__ ("3"); - __asm__ volatile ("mr 0,%1\n\t" - "mr 3,%2\n\t" - "mr 4,%3\n\t" - "mr 5,%4\n\t" - "sc\n\t" - "cmpwi 0, 0\n\t" - "beq 1f\n\t" - "li 3,-1\n\t" - "1:" - : "=r" (status) - : "r" (SYS_read), "r" (fd), "r" (buf), "r" (len) - : "0", "3", "4", "5"); - return status; + register int status __asm__ ("3"); + + __asm__ volatile ("mr 0,%1\n\t" + "mr 3,%2\n\t" + "mr 4,%3\n\t" + "mr 5,%4\n\t" + "sc\n\t" + "cmpwi 0, 0\n\t" + "beq 1f\n\t" + "li 3,-1\n\t" + "1:" + : "=r" (status) + : "r" (SYS_read), "r" (fd), "r" (buf), "r" (len) + : "0", "3", "4", "5"); + return status; } #define STRINGIFY(x) #x @@ -153,66 +159,69 @@ __asm__(".align 2\n\t" static int _dl_mmap (void *addr, unsigned int len, unsigned int prot, - unsigned int flags, int fd, off_t offset) + unsigned int flags, int fd, off_t offset) { return((int)_dl__syscall((quad_t)SYS_mmap, addr, len, prot, - flags, fd, 0, offset)); + flags, fd, 0, offset)); } static inline int _dl_munmap (const void* addr, unsigned int len) { - register int status __asm__ ("3"); - __asm__ volatile ("mr 0,%1\n\t" - "mr 3,%2\n\t" - "mr 4,%3\n\t" - "sc\n\t" - "cmpwi 0, 0\n\t" - "beq 1f\n\t" - "li 3,-1\n\t" - "1:" - : "=r" (status) - : "r" (SYS_munmap), "r" (addr), "r" (len) - : "0", "3", "4"); - return status; + register int status __asm__ ("3"); + + __asm__ volatile ("mr 0,%1\n\t" + "mr 3,%2\n\t" + "mr 4,%3\n\t" + "sc\n\t" + "cmpwi 0, 0\n\t" + "beq 1f\n\t" + "li 3,-1\n\t" + "1:" + : "=r" (status) + : "r" (SYS_munmap), "r" (addr), "r" (len) + : "0", "3", "4"); + return status; } static inline int _dl_mprotect (const void *addr, int size, int prot) { - register int status __asm__ ("3"); - __asm__ volatile ("mr 0,%1\n\t" - "mr 3,%2\n\t" - "mr 4,%3\n\t" - "mr 5,%4\n\t" - "sc\n\t" - "cmpwi 0, 0\n\t" - "beq 1f\n\t" - "li 3,-1\n\t" - "1:" - : "=r" (status) - : "r" (SYS_mprotect), "r" (addr), "r" (size), "r" (prot) - : "0", "3", "4", "5"); - return status; + register int status __asm__ ("3"); + + __asm__ volatile ("mr 0,%1\n\t" + "mr 3,%2\n\t" + "mr 4,%3\n\t" + "mr 5,%4\n\t" + "sc\n\t" + "cmpwi 0, 0\n\t" + "beq 1f\n\t" + "li 3,-1\n\t" + "1:" + : "=r" (status) + : "r" (SYS_mprotect), "r" (addr), "r" (size), "r" (prot) + : "0", "3", "4", "5"); + return status; } #ifdef USE_CACHE static inline int _dl_stat (const char *addr, struct stat *sb) { - register int status __asm__ ("3"); - __asm__ volatile ("mr 0,%1\n\t" - "mr 3,%2\n\t" - "mr 4,%3\n\t" - "sc\n\t" - "cmpwi 0, 0\n\t" - "beq 1f\n\t" - "li 3,-1\n\t" - "1:" - : "=r" (status) - : "r" (SYS_stat), "r" (addr), "r" (sb) - : "0", "3", "4"); - return status; + register int status __asm__ ("3"); + + __asm__ volatile ("mr 0,%1\n\t" + "mr 3,%2\n\t" + "mr 4,%3\n\t" + "sc\n\t" + "cmpwi 0, 0\n\t" + "beq 1f\n\t" + "li 3,-1\n\t" + "1:" + : "=r" (status) + : "r" (SYS_stat), "r" (addr), "r" (sb) + : "0", "3", "4"); + return status; } #endif @@ -220,17 +229,18 @@ _dl_stat (const char *addr, struct stat *sb) static inline int _dl_issetugid() { - register int status __asm__ ("3"); - __asm__ volatile ("mr 0,%1\n\t" - "sc\n\t" - "cmpwi 0, 0\n\t" - "beq 1f\n\t" - "li 3,-1\n\t" - "1:" - : "=r" (status) - : "r" (SYS_issetugid) - : "0", "3"); - return status; + register int status __asm__ ("3"); + + __asm__ volatile ("mr 0,%1\n\t" + "sc\n\t" + "cmpwi 0, 0\n\t" + "beq 1f\n\t" + "li 3,-1\n\t" + "1:" + : "=r" (status) + : "r" (SYS_issetugid) + : "0", "3"); + return status; } #include <elf_abi.h> #endif /*__DL_SYSCALL_H__*/ diff --git a/libexec/ld.so/resolve.c b/libexec/ld.so/resolve.c index b608495aa59..0a2b8e5a5c9 100644 --- a/libexec/ld.so/resolve.c +++ b/libexec/ld.so/resolve.c @@ -1,4 +1,4 @@ -/* $OpenBSD: resolve.c,v 1.8 2002/05/24 03:44:37 deraadt Exp $ */ +/* $OpenBSD: resolve.c,v 1.9 2002/05/24 04:17:00 deraadt Exp $ */ /* * Copyright (c) 1998 Per Fogelstrom, Opsycon AB @@ -120,9 +120,9 @@ d_un.d_val; Elf_Word *hashtab = (Elf_Word *)object->Dyn.info[DT_HASH]; object->nbuckets = hashtab[0]; - object->nchains = hashtab[1]; + object->nchains = hashtab[1]; object->buckets = hashtab + 2; - object->chains = object->buckets + object->nbuckets; + object->chains = object->buckets + object->nbuckets; } if (dl_data) { @@ -228,8 +228,7 @@ _dl_find_symbol(const char *name, elf_object_t *startlook, } } if (warnnotfound) { - if (!weak_sym && - *ref && + if (!weak_sym && *ref && ELF_ST_BIND((*ref)->st_info) != STB_WEAK) { _dl_printf("%s: undefined symbol '%s'\n", _dl_progname, name); diff --git a/libexec/ld.so/resolve.h b/libexec/ld.so/resolve.h index bad0cc391af..e31bf4f3c98 100644 --- a/libexec/ld.so/resolve.h +++ b/libexec/ld.so/resolve.h @@ -1,4 +1,4 @@ -/* $OpenBSD: resolve.h,v 1.9 2002/05/24 03:44:37 deraadt Exp $ */ +/* $OpenBSD: resolve.h,v 1.10 2002/05/24 04:17:00 deraadt Exp $ */ /* * Copyright (c) 1998 Per Fogelstrom, Opsycon AB @@ -39,9 +39,9 @@ typedef struct load_list { struct load_list *next; - char *start; - size_t size; - int prot; + char *start; + size_t size; + int prot; } load_list_t; /* @@ -52,8 +52,8 @@ typedef struct load_list { typedef struct elf_object { Elf_Addr load_addr; /* Real load address */ Elf_Addr load_offs; /* Load offset from link address */ - char *load_name; /* Pointer to object name */ - Elf_Dyn *load_dyn; /* Pointer to object dynamic data */ + char *load_name; /* Pointer to object name */ + Elf_Dyn *load_dyn; /* Pointer to object dynamic data */ struct elf_object *next; struct elf_object *prev; /* End struct link_map compatible */ @@ -124,11 +124,11 @@ extern void _dl_rt_resolve(void); extern elf_object_t *_dl_add_object(const char *objname, Elf_Dyn *dynp, const u_long *, const int objtype, const long laddr, const long loff); -extern void _dl_remove_object(elf_object_t *object); +extern void _dl_remove_object(elf_object_t *object); extern elf_object_t *_dl_lookup_object(const char *objname); extern elf_object_t *_dl_load_shlib(const char *, elf_object_t *, int); -extern void _dl_unload_shlib(elf_object_t *object); +extern void _dl_unload_shlib(elf_object_t *object); extern int _dl_md_reloc(elf_object_t *object, int rel, int relsz); extern void _dl_md_reloc_got(elf_object_t *object, int lazy); diff --git a/libexec/ld.so/sod.c b/libexec/ld.so/sod.c index 8bd1ab81b00..2f54a2fb531 100644 --- a/libexec/ld.so/sod.c +++ b/libexec/ld.so/sod.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sod.c,v 1.9 2002/05/24 03:44:37 deraadt Exp $ */ +/* $OpenBSD: sod.c,v 1.10 2002/05/24 04:17:00 deraadt Exp $ */ /* * Copyright (c) 1993 Paul Kranenburg @@ -14,7 +14,7 @@ * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: - * This product includes software developed by Paul Kranenburg. + * This product includes software developed by Paul Kranenburg. * 4. The name of the author may not be used to endorse or promote products * derived from this software without specific prior written permission * diff --git a/libexec/ld.so/sparc64/ldasm.S b/libexec/ld.so/sparc64/ldasm.S index 201b4074a9c..bcff6965088 100644 --- a/libexec/ld.so/sparc64/ldasm.S +++ b/libexec/ld.so/sparc64/ldasm.S @@ -1,4 +1,4 @@ -/* $OpenBSD: ldasm.S,v 1.10 2002/05/24 03:44:38 deraadt Exp $ */ +/* $OpenBSD: ldasm.S,v 1.11 2002/05/24 04:17:01 deraadt Exp $ */ /* $NetBSD: rtld_start.S,v 1.5 2001/08/14 22:17:48 eeh Exp $ */ /* @@ -50,8 +50,8 @@ * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: - * This product includes software developed by the NetBSD - * Foundation, Inc. and its contributors. + * This product includes software developed by the NetBSD + * Foundation, Inc. and its contributors. * 4. Neither the name of The NetBSD Foundation nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. @@ -164,7 +164,7 @@ _dl_start: _dl_bind_start_0: # (x, y) #if 0 call _dl_bind_start_0_stub - ldx [%o1 + (10*4)], %l7 + ldx [%o1 + (10*4)], %l7 mov %o0, %o1 call _dl_bind diff --git a/libexec/ld.so/sparc64/rtld_machine.c b/libexec/ld.so/sparc64/rtld_machine.c index 328566fbd7f..ca188004ef9 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.12 2002/05/24 03:44:38 deraadt Exp $ */ +/* $OpenBSD: rtld_machine.c,v 1.13 2002/05/24 04:17:01 deraadt Exp $ */ /* * Copyright (c) 1999 Dale Rahn @@ -50,8 +50,8 @@ * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: - * This product includes software developed by the NetBSD - * Foundation, Inc. and its contributors. + * This product includes software developed by the NetBSD + * Foundation, Inc. and its contributors. * 4. Neither the name of The NetBSD Foundation nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. @@ -225,7 +225,7 @@ _dl_md_reloc(elf_object_t *object, int rel, int relasz) Elf_RelA *relas; load_list_t *llist; - loff = object->load_offs; + loff = object->load_offs; numrela = object->Dyn.info[relasz] / sizeof(Elf64_Rela); relas = (Elf64_Rela *)(object->Dyn.info[rel]); |