diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2006-05-12 23:20:54 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2006-05-12 23:20:54 +0000 |
commit | 2b0781cc11cefa28d450d3cc30901ec7ae040340 (patch) | |
tree | 14fe29ed6d31d9dee0f3dea9036cf51de00b6a26 /libexec/ld.so/ldconfig/prebind_struct.h | |
parent | 9588320eaa6af8d8d2023d04ebfea3ea7858acb6 (diff) |
move the prebind code into ldconfig as the -P option.
next we will want to enhance the verbose mode, fix error handling,
and change the prebind delete code to use the same directory handling
code
ok drahn
Diffstat (limited to 'libexec/ld.so/ldconfig/prebind_struct.h')
-rw-r--r-- | libexec/ld.so/ldconfig/prebind_struct.h | 89 |
1 files changed, 89 insertions, 0 deletions
diff --git a/libexec/ld.so/ldconfig/prebind_struct.h b/libexec/ld.so/ldconfig/prebind_struct.h new file mode 100644 index 00000000000..42a64bb868d --- /dev/null +++ b/libexec/ld.so/ldconfig/prebind_struct.h @@ -0,0 +1,89 @@ +/* $OpenBSD: prebind_struct.h,v 1.1 2006/05/12 23:20:53 deraadt Exp $ */ +/* + * Copyright (c) 2006 Dale Rahn <drahn@dalerahn.com> + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +struct symcache_noflag { + const elf_object_t *obj; + const Elf_Sym *sym; +}; + +struct objlist { + TAILQ_ENTRY(objlist) list; + TAILQ_ENTRY(objlist) inst_list; + struct elf_object *load_prog; + struct elf_object *object; +}; + +struct proglist { + TAILQ_ENTRY(proglist) list; + TAILQ_HEAD(, objlist) curbin_list; + struct fixup **fixup; + int *fixupcnt; + int *fixupcntalloc; + int nobj; + u_int32_t **libmap; + u_int32_t *libmapcnt; + char *interp; +}; +extern struct proglist *curbin; +extern struct elf_object *load_object; + + +typedef TAILQ_HEAD(, proglist) prog_list_ty; +typedef TAILQ_HEAD(, objlist) obj_list_ty; + +extern obj_list_ty library_list; +extern prog_list_ty prog_list; + +/* debug */ +void elf_print_curbin_list(struct proglist *bin); +void elf_print_prog_list (prog_list_ty *prog_list); + + +void elf_add_object_curbin_list(struct elf_object *object); + +void elf_copy_syms(struct symcache_noflag *tcache, + struct symcache_noflag *scache, struct elf_object *obj, + struct elf_object *prog, int nsyms); +int elf_prep_lib_prebind(struct elf_object *object); +int elf_prep_bin_prebind(struct proglist *pl); +void elf_calc_fixups(struct proglist *pl, struct objlist *ol, int libidx); +int elf_write_lib(struct elf_object *object, struct nameidx *nameidx, + char *nametab, int nametablen, int numlibs, + int nfixup, struct fixup **fixup, int *fixupcnt, + u_int32_t **libmap, int *libmapcnt, + struct symcachetab *symcachetab, int symcache_cnt, + struct symcachetab *pltsymcachetab, int pltsymcache_cnt); + +void dump_symcachetab(struct symcachetab *symcachetab, int symcache_cnt, struct elf_object *object, int id); +void dump_info(struct elf_object *object); +void elf_clear_prog_load(int fd, struct elf_object *object); +void elf_fixup_prog_load(int fd, struct prebind_footer *footer, + struct elf_object *object); +void elf_dump_footer(struct prebind_footer *footer); + +extern int verbose; +extern int merge; + +extern int64_t prebind_blocks; +extern struct elf_object *load_object; +struct elf_object *elf_lookup_object(const char *name); +struct elf_object *load_file(const char *filename, int objtype); + +void elf_load_existing_prebind(struct elf_object *object, int fd); + +void *xmalloc(size_t); +void *xcalloc(size_t,size_t); |