diff options
author | Dale Rahn <drahn@cvs.openbsd.org> | 2002-08-23 22:57:04 +0000 |
---|---|---|
committer | Dale Rahn <drahn@cvs.openbsd.org> | 2002-08-23 22:57:04 +0000 |
commit | bfce6caf8080fa2d4f5024cab4059d709567fae4 (patch) | |
tree | 76cf0b5a29cb9439e94d9326ba53457e1dcb7f01 /libexec/ld.so/loader.c | |
parent | 9958388d0a4d2166f3f7b1acfaae96e99f8843b7 (diff) |
Change arguments to _dl_find_symbol() myself, warnnotfound, and inplt into
a single flags field with bits representing each. Use defines to create
the appropriate masks.
Add a new argument sym_size to warn about symbols which have
the incorrect size. This replaces 'ifdef notyet' code which
was in several of the md files with a single version.
sym_size == 0 means do not check, and symbols of type FUNC are
not checked.
Diffstat (limited to 'libexec/ld.so/loader.c')
-rw-r--r-- | libexec/ld.so/loader.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/libexec/ld.so/loader.c b/libexec/ld.so/loader.c index 819c5c18d22..f9d5151f2e5 100644 --- a/libexec/ld.so/loader.c +++ b/libexec/ld.so/loader.c @@ -1,4 +1,4 @@ -/* $OpenBSD: loader.c,v 1.47 2002/08/12 01:05:23 drahn Exp $ */ +/* $OpenBSD: loader.c,v 1.48 2002/08/23 22:57:03 drahn Exp $ */ /* * Copyright (c) 1998 Per Fogelstrom, Opsycon AB @@ -255,7 +255,8 @@ _dl_boot(const char **argv, char **envp, const long loff, long *dl_data) Elf_Addr ooff; sym = NULL; - ooff = _dl_find_symbol("atexit", _dl_objects, &sym, 0, 0, 1); + ooff = _dl_find_symbol("atexit", _dl_objects, &sym, + SYM_SEARCH_ALL|SYM_NOWARNNOTFOUND|SYM_PLT, 0); if (sym == NULL) { _dl_printf("cannot find atexit, destructors will not be run!\n"); } else { @@ -529,14 +530,16 @@ _dl_call_init(elf_object_t *object) * XXX that should be fixed. */ sym = NULL; - ooff = _dl_find_symbol("__CTOR_LIST__", object, &sym, 1, 1, 1); + ooff = _dl_find_symbol("__CTOR_LIST__", object, &sym, + SYM_SEARCH_SELF|SYM_WARNNOTFOUND|SYM_PLT, 0); if (sym != NULL) { int i = *(int *)(sym->st_value + ooff); while (i--) *(int *)(sym->st_value + ooff + 4 + 4 * i) += ooff; } sym = NULL; - ooff = _dl_find_symbol("__DTOR_LIST__", object, &sym, 1, 1, 1); + ooff = _dl_find_symbol("__DTOR_LIST__", object, &sym, + SYM_SEARCH_SELF|SYM_WARNNOTFOUND|SYM_PLT, 0); if (sym != NULL) { int i = *(int *)(sym->st_value + ooff); while (i--) @@ -549,7 +552,8 @@ _dl_call_init(elf_object_t *object) * XXX Instead we rely on a symbol named '.init' and call it if it exists. */ sym = NULL; - ooff = _dl_find_symbol(".init", object, &sym, 1, 1, 1); + ooff = _dl_find_symbol(".init", object, &sym, + SYM_SEARCH_SELF|SYM_WARNNOTFOUND|SYM_PLT, 0); if (sym != NULL) { DL_DEB(("calling .init in '%s'\n",object->load_name)); (*(void(*)(void))(sym->st_value + ooff))(); @@ -577,8 +581,9 @@ _dl_getenv(const char *var, char **env) if (*vp == '\0' && *ep++ == '=') return((char *)ep); } - return(0); + return(NULL); } + static void _dl_unsetenv(const char *var, char **env) { |