diff options
Diffstat (limited to 'gnu/usr.bin/ld/rtld/rtld.c')
-rw-r--r-- | gnu/usr.bin/ld/rtld/rtld.c | 118 |
1 files changed, 33 insertions, 85 deletions
diff --git a/gnu/usr.bin/ld/rtld/rtld.c b/gnu/usr.bin/ld/rtld/rtld.c index f3082588842..296cf4e8e58 100644 --- a/gnu/usr.bin/ld/rtld/rtld.c +++ b/gnu/usr.bin/ld/rtld/rtld.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rtld.c,v 1.26 2002/07/17 20:33:29 marc Exp $ */ +/* $OpenBSD: rtld.c,v 1.27 2002/07/19 19:28:12 marc Exp $ */ /* $NetBSD: rtld.c,v 1.43 1996/01/14 00:35:17 pk Exp $ */ /* * Copyright (c) 1993 Paul Kranenburg @@ -217,10 +217,7 @@ strcmp (const char *s1, const char *s2) * and dp (our __DYNAMIC). */ int -rtld(version, crtp, dp) - int version; - struct crt_ldso *crtp; - struct _dynamic *dp; +rtld(int version, struct crt_ldso *crtp, struct _dynamic *dp) { int n; int nreloc; /* # of ld.so relocations */ @@ -248,7 +245,7 @@ rtld(version, crtp, dp) for (reloc = (struct relocation_info *)(LD_REL(dp) + crtp->crt_ba); nreloc; nreloc--, reloc++) { long addr = reloc->r_address + crtp->crt_ba; - md_relocate_simple(reloc, crtp->crt_ba, addr); + md_relocate_simple(reloc, crtp->crt_ba, (char*)addr); } if (version >= CRT_VERSION_BSD_4) @@ -351,8 +348,7 @@ rtld(version, crtp, dp) static int -load_subs(smp) - struct so_map *smp; +load_subs(struct so_map *smp) { for (; smp; smp = smp->som_next) { @@ -391,8 +387,7 @@ load_subs(smp) } void -ld_trace(smp) - struct so_map *smp; +ld_trace(struct so_map *smp) { char *fmt1, *fmt2, *fmt, *main_local; int c; @@ -480,13 +475,8 @@ ld_trace(smp) * result of the presence of link object LOP in the link map PARENT. */ static struct so_map * -alloc_link_map(path, sodp, parent, addr, size, dp) - char *path; - struct sod *sodp; - struct so_map *parent; - caddr_t addr; - size_t size; - struct _dynamic *dp; +alloc_link_map(char *path, struct sod *sodp, struct so_map *parent, + caddr_t addr, size_t size, struct _dynamic *dp) { struct so_map *smp; struct somap_private *smpp; @@ -523,8 +513,7 @@ alloc_link_map(path, sodp, parent, addr, size, dp) * after it's been unmapped. */ static void -free_link_map(smp) - struct so_map *smp; +free_link_map(struct so_map *smp) { if ((LM_PRIVATE(smp)->spd_flags & RTLD_DL) != 0) { @@ -545,9 +534,7 @@ free_link_map(smp) * in link map SMP. */ static struct so_map * -map_object(sodp, smp) - struct sod *sodp; - struct so_map *smp; +map_object(struct sod *sodp, struct so_map *smp) { char *name; struct _dynamic *dp; @@ -659,8 +646,7 @@ again: * Unmap a mapped object. */ static void -unmap_object(smp) - struct so_map *smp; +unmap_object(struct so_map *smp) { struct so_map *p, **pp; @@ -686,8 +672,7 @@ unmap_object(smp) } void -init_maps(head) - struct so_map *head; +init_maps(struct so_map *head) { struct so_map *smp; @@ -716,10 +701,7 @@ init_maps(head) } static inline void -check_text_reloc(r, smp, addr) - struct relocation_info *r; - struct so_map *smp; - caddr_t addr; +check_text_reloc(struct relocation_info *r, struct so_map *smp, caddr_t addr) { char *sym; @@ -749,8 +731,7 @@ check_text_reloc(r, smp, addr) } static void -reloc_map(smp) - struct so_map *smp; +reloc_map(struct so_map *smp) { struct _dynamic *dp = smp->som_dynamic; struct relocation_info *r = LM_REL(smp); @@ -841,8 +822,7 @@ reloc_map(smp) } static void -reloc_copy(smp) - struct so_map *smp; +reloc_copy(struct so_map *smp) { struct rt_symbol *rtsp; @@ -855,9 +835,7 @@ reloc_copy(smp) } static void -call_map(smp, sym) - struct so_map *smp; - char *sym; +call_map(struct so_map *smp, char *sym) { struct so_map *src_map = smp; struct nzlist *np; @@ -878,8 +856,7 @@ static struct rt_symbol *rt_symtab[RTC_TABSIZE]; * Compute hash value for run-time symbol table */ static inline int -hash_string(key) - const char *key; +hash_string(const char *key) { const char *cp; int k; @@ -897,8 +874,7 @@ hash_string(key) */ static inline struct rt_symbol * -lookup_rts(key) - const char *key; +lookup_rts(const char *key) { int hashval; struct rt_symbol *rtsp; @@ -917,13 +893,8 @@ lookup_rts(key) } static struct rt_symbol * -enter_rts(name, value, type, srcaddr, size, smp) - const char *name; - long value; - int type; - caddr_t srcaddr; - long size; - struct so_map *smp; +enter_rts(const char *name, long value, int type, caddr_t srcaddr, long size, + struct so_map *smp) { int hashval; struct rt_symbol *rtsp, **rpp; @@ -963,10 +934,7 @@ enter_rts(name, value, type, srcaddr, size, smp) * have a proper type (used by binder()). */ static struct nzlist * -lookup(name, src_map, strong) - const char *name; - struct so_map **src_map; /* IN/OUT */ - int strong; +lookup(const char *name, struct so_map **src_map, int strong) { long common_size = 0; struct so_map *smp, *weak_smp; @@ -1111,8 +1079,7 @@ xprintf("Allocating common: %s size %d at %#x\n", name, common_size, rtsp->rt_sp * procedure calls to shared objects. */ long -binder(jsp) - jmpslot_t *jsp; +binder(jmpslot_t *jsp) { struct so_map *smp, *src_map = NULL; long addr; @@ -1167,7 +1134,7 @@ static char *hint_search_path = ""; #define HINTS_VALID (hheader != NULL && hheader != (struct hints_header *)-1) static void -maphints() +maphints(void) { caddr_t addr; @@ -1220,7 +1187,7 @@ maphints() } static void -unmaphints() +unmaphints(void) { if (HINTS_VALID) { @@ -1231,9 +1198,7 @@ unmaphints() } int -hinthash(cp, vmajor, vminor) - char *cp; - int vmajor, vminor; +hinthash(char *cp, int vmajor, int vminor) { int k = 0; @@ -1251,10 +1216,7 @@ hinthash(cp, vmajor, vminor) #undef minor static char * -findhint(name, major, minor, prefered_path) - char *name; - int major, minor; - char *prefered_path; +findhint(char *name, int major, int minor, char *prefered_path) { struct hints_bucket *bp; @@ -1296,11 +1258,7 @@ findhint(name, major, minor, prefered_path) } static char * -rtfindlib(name, major, minor, usehints, ipath) - char *name; - int major, minor; - int *usehints; - char *ipath; +rtfindlib(char *name, int major, int minor, int *usehints, char *ipath) { char *cp; int realminor; @@ -1367,8 +1325,7 @@ lose: } void -preload(paths) - char *paths; +preload(char *paths) { struct so_map *nsmp; struct sod *sodp; @@ -1423,9 +1380,7 @@ static int dlerrno; * Populate sod struct for dlopen's call to map_object */ void -build_sod(name, sodp) - const char *name; - struct sod *sodp; +build_sod(const char *name, struct sod *sodp) { unsigned int tuplet; int major, minor; @@ -1497,9 +1452,7 @@ backout: } static void * -__dlopen(name, mode) - const char *name; - int mode; +__dlopen(const char *name, int mode) { struct sod *sodp; struct so_map *smp; @@ -1550,8 +1503,7 @@ xprintf("%s: %s\n", name, strerror(errno)); } static int -__dlclose(fd) - void *fd; +__dlclose(void *fd) { struct so_map *smp = (struct so_map *)fd; @@ -1576,9 +1528,7 @@ xprintf("dlclose(%s): refcount = %d\n", smp->som_path, LM_PRIVATE(smp)->spd_refc } static void * -__dlsym(fd, sym) - void *fd; - const char *sym; +__dlsym(void *fd, const char *sym) { struct so_map *smp = (struct so_map *)fd, *src_map = NULL; struct nzlist *np; @@ -1605,9 +1555,7 @@ __dlsym(fd, sym) } static int -__dlctl(fd, cmd, arg) - void *fd, *arg; - int cmd; +__dlctl(void *fd, int cmd, void *arg) { switch (cmd) { case DL_GETERRNO: @@ -1622,7 +1570,7 @@ __dlctl(fd, cmd, arg) } static void -__dlexit() +__dlexit(void) { struct so_map *smp; |