diff options
author | Ulrich Drepper <drepper@redhat.com> | 2002-02-03 00:31:37 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2002-02-03 00:31:37 +0000 |
commit | 7969407a01a108298ea506e0c37c1d6b7c9d424c (patch) | |
tree | 3c4f570e330a91ce712a574ee2d7ea1e9476c397 | |
parent | 88794e308552d6051453544f8790986314fd9e1c (diff) | |
download | glibc-7969407a01a108298ea506e0c37c1d6b7c9d424c.tar.gz |
Update.
Change ld.so to not use functions which are exported. One cannot
interpose them anyway. Use INT() to mark uses, INTDEF() to mark
definitions.
* include/libc-symbols.h: Define INT and INTDEF.
* sysdeps/generic/ldsodefs.h: Declare _dl_debug_printf_internal,
_dl_signal_error_internal, _dl_map_object_internal,
_dl_map_object_deps_internal, _dl_lookup_symbol_internal,
_dl_lookup_versioned_symbol_internal,
_dl_relocate_object_internal, _dl_debug_state_internal,
_dl_start_profile_internal, and _dl_unload_cache_internal.
* include/dlfcn.h: Declare _dl_catch_error_internal.
* elf/rtld.c: Use INT for calls to any of the *_internal functions
above. Add INTDEF to function definitions.
* elf/dl-debug.c: Likewise.
* elf/dl-deps.c: Likewise.
* elf/dl-dst.h: Likewise.
* elf/dl-error.c: Likewise.
* elf/dl-fini.c: Likewise.
* elf/dl-init.c: Likewise.
* elf/dl-load.c: Likewise.
* elf/dl-lookup.c: Likewise.
* elf/dl-misc.c: Likewise.
* elf/dl-open.c: Likewise.
* elf/dl-profile.c: Likewise.
* elf/dl-reloc.c: Likewise.
* elf/dl-runtime.c: Likewise.
* elf/dl-version.c: Likewise.
* elf/do-lookup.h: Likewise.
* sysdeps/generic/dl-cache.c: Likewise.
* sysdeps/generic/dl-sysdep.c: Likewise.
* sysdeps/alpha/dl-machine.h (RTLD_START): Call _dl_init_internal
instead of _dl_init.
* sysdeps/arm/dl-machine.h: Likewise.
* sysdeps/cris/dl-machine.h: Likewise.
* sysdeps/hppa/dl-machine.h: Likewise.
* sysdeps/i386/dl-machine.h: Likewise.
* sysdeps/ia64/dl-machine.h: Likewise.
* sysdeps/m68k/dl-machine.h: Likewise.
* sysdeps/mips/dl-machine.h: Likewise.
* sysdeps/mips/mips64/dl-machine.h: Likewise.
* sysdeps/s390/s390-32/dl-machine.h: Likewise.
* sysdeps/s390/s390-64/dl-machine.h: Likewise.
* sysdeps/sh/dl-machine.h: Likewise.
* sysdeps/sparc/sparc32/dl-machine.h: Likewise.
* sysdeps/sparc/sparc64/dl-machine.h: Likewise.
* sysdeps/x86_64/dl-machine.h: Likewise.
* sysdeps/powerpc/dl-start.S (_dl_start_user): Likewise.
* elf/Versions: Don't export _dl_check_all_versions, _dl_sysdep_start,
and _dl_debug_initialize.
39 files changed, 341 insertions, 198 deletions
@@ -1,5 +1,56 @@ 2002-02-02 Ulrich Drepper <drepper@redhat.com> + Change ld.so to not use functions which are exported. One cannot + interpose them anyway. Use INT() to mark uses, INTDEF() to mark + definitions. + * include/libc-symbols.h: Define INT and INTDEF. + * sysdeps/generic/ldsodefs.h: Declare _dl_debug_printf_internal, + _dl_signal_error_internal, _dl_map_object_internal, + _dl_map_object_deps_internal, _dl_lookup_symbol_internal, + _dl_lookup_versioned_symbol_internal, + _dl_relocate_object_internal, _dl_debug_state_internal, + _dl_start_profile_internal, and _dl_unload_cache_internal. + * include/dlfcn.h: Declare _dl_catch_error_internal. + * elf/rtld.c: Use INT for calls to any of the *_internal functions + above. Add INTDEF to function definitions. + * elf/dl-debug.c: Likewise. + * elf/dl-deps.c: Likewise. + * elf/dl-dst.h: Likewise. + * elf/dl-error.c: Likewise. + * elf/dl-fini.c: Likewise. + * elf/dl-init.c: Likewise. + * elf/dl-load.c: Likewise. + * elf/dl-lookup.c: Likewise. + * elf/dl-misc.c: Likewise. + * elf/dl-open.c: Likewise. + * elf/dl-profile.c: Likewise. + * elf/dl-reloc.c: Likewise. + * elf/dl-runtime.c: Likewise. + * elf/dl-version.c: Likewise. + * elf/do-lookup.h: Likewise. + * sysdeps/generic/dl-cache.c: Likewise. + * sysdeps/generic/dl-sysdep.c: Likewise. + * sysdeps/alpha/dl-machine.h (RTLD_START): Call _dl_init_internal + instead of _dl_init. + * sysdeps/arm/dl-machine.h: Likewise. + * sysdeps/cris/dl-machine.h: Likewise. + * sysdeps/hppa/dl-machine.h: Likewise. + * sysdeps/i386/dl-machine.h: Likewise. + * sysdeps/ia64/dl-machine.h: Likewise. + * sysdeps/m68k/dl-machine.h: Likewise. + * sysdeps/mips/dl-machine.h: Likewise. + * sysdeps/mips/mips64/dl-machine.h: Likewise. + * sysdeps/s390/s390-32/dl-machine.h: Likewise. + * sysdeps/s390/s390-64/dl-machine.h: Likewise. + * sysdeps/sh/dl-machine.h: Likewise. + * sysdeps/sparc/sparc32/dl-machine.h: Likewise. + * sysdeps/sparc/sparc64/dl-machine.h: Likewise. + * sysdeps/x86_64/dl-machine.h: Likewise. + * sysdeps/powerpc/dl-start.S (_dl_start_user): Likewise. + + * elf/Versions: Don't export _dl_check_all_versions, _dl_sysdep_start, + and _dl_debug_initialize. + * elf/dl-object.c (_dl_new_object): Avoid using strrchr. We have more information. * elf/rtld.c (dl_main): Avoid strrchr. diff --git a/elf/Versions b/elf/Versions index 4c7806d8e6..091f444eb9 100644 --- a/elf/Versions +++ b/elf/Versions @@ -38,13 +38,13 @@ ld { GLIBC_PRIVATE { # Those are in the dynamic linker, but used by libc.so. __libc_enable_secure; __libc_stack_end; - _dl_argv; _dl_catch_error; _dl_check_all_versions; _dl_check_map_versions; - _dl_debug_initialize; _dl_debug_printf; _dl_debug_state; _dl_dst_count; + _dl_argv; _dl_catch_error; _dl_check_map_versions; + _dl_debug_printf; _dl_debug_state; _dl_dst_count; _dl_dst_substitute; _dl_init; _dl_lookup_symbol; _dl_lookup_symbol_skip; _dl_lookup_versioned_symbol; _dl_lookup_versioned_symbol_skip; _dl_map_object; _dl_map_object_deps; _dl_out_of_memory; _dl_relocate_object; _dl_signal_error; _dl_start_profile; _dl_starting_up; - _dl_sysdep_start; _dl_unload_cache; + _dl_unload_cache; _rtld_global; } } diff --git a/elf/dl-debug.c b/elf/dl-debug.c index 4e8197227e..462a21e8a8 100644 --- a/elf/dl-debug.c +++ b/elf/dl-debug.c @@ -55,3 +55,4 @@ void _dl_debug_state (void) { } +INTDEF (_dl_debug_state) diff --git a/elf/dl-deps.c b/elf/dl-deps.c index 368ad2d557..43a0bd8bf3 100644 --- a/elf/dl-deps.c +++ b/elf/dl-deps.c @@ -59,10 +59,10 @@ openaux (void *a) { struct openaux_args *args = (struct openaux_args *) a; - args->aux = _dl_map_object (args->map, args->name, 0, - (args->map->l_type == lt_executable - ? lt_library : args->map->l_type), - args->trace_mode, 0); + args->aux = INT(_dl_map_object) (args->map, args->name, 0, + (args->map->l_type == lt_executable + ? lt_library : args->map->l_type), + args->trace_mode, 0); } static ptrdiff_t @@ -107,28 +107,28 @@ struct list \ /* DST must not appear in SUID/SGID programs. */ \ if (__libc_enable_secure) \ - _dl_signal_error (0, __str, NULL, \ - N_("DST not allowed in SUID/SGID programs")); \ + INT(_dl_signal_error) (0, __str, NULL, \ + N_("DST not allowed in SUID/SGID programs"));\ \ __newp = (char *) alloca (DL_DST_REQUIRED (l, __str, strlen (__str), \ __cnt)); \ \ - __result = DL_DST_SUBSTITUTE (l, __str, __newp, 0); \ + __result = INT(_dl_dst_substitute) (l, __str, __newp, 0); \ \ if (*__result == '\0') \ { \ /* The replacement for the DST is not known. We can't \ processed. */ \ if (fatal) \ - _dl_signal_error (0, __str, NULL, N_("\ + INT(_dl_signal_error) (0, __str, NULL, N_("\ empty dynamics string token substitution")); \ else \ { \ /* This is for DT_AUXILIARY. */ \ if (__builtin_expect (GL(dl_debug_mask) & DL_DEBUG_LIBS, 0)) \ - _dl_debug_printf ("cannot load auxiliary `%s' because of" \ - "empty dynamic string token " \ - "substitution\n", __str); \ + INT(_dl_debug_printf) (N_("\ +cannot load auxiliary `%s' because of empty dynamic string token " \ + "substitution\n"), __str); \ continue; \ } \ } \ @@ -239,7 +239,8 @@ _dl_map_object_deps (struct link_map *map, /* Store the tag in the argument structure. */ args.name = name; - err = _dl_catch_error (&objname, &errstring, openaux, &args); + err = INT(_dl_catch_error) (&objname, &errstring, openaux, + &args); if (__builtin_expect (errstring != NULL, 0)) { if (err) @@ -290,15 +291,15 @@ _dl_map_object_deps (struct link_map *map, /* Say that we are about to load an auxiliary library. */ if (__builtin_expect (GL(dl_debug_mask) & DL_DEBUG_LIBS, 0)) - _dl_debug_printf ("load auxiliary object=%s" - " requested by file=%s\n", name, - l->l_name[0] - ? l->l_name : _dl_argv[0]); + INT(_dl_debug_printf) ("load auxiliary object=%s" + " requested by file=%s\n", name, + l->l_name[0] + ? l->l_name : _dl_argv[0]); /* We must be prepared that the addressed shared object is not available. */ - err = _dl_catch_error (&objname, &errstring, openaux, - &args); + err = INT(_dl_catch_error) (&objname, &errstring, openaux, + &args); if (__builtin_expect (errstring != NULL, 0)) { /* We are not interested in the error message. */ @@ -317,14 +318,14 @@ _dl_map_object_deps (struct link_map *map, /* Say that we are about to load an auxiliary library. */ if (__builtin_expect (GL(dl_debug_mask) & DL_DEBUG_LIBS, 0)) - _dl_debug_printf ("load filtered object=%s" - " requested by file=%s\n", name, - l->l_name[0] - ? l->l_name : _dl_argv[0]); + INT(_dl_debug_printf) ("load filtered object=%s" + " requested by file=%s\n", name, + l->l_name[0] + ? l->l_name : _dl_argv[0]); /* For filter objects the dependency must be available. */ - err = _dl_catch_error (&objname, &errstring, openaux, - &args); + err = INT(_dl_catch_error) (&objname, &errstring, openaux, + &args); if (__builtin_expect (errstring != NULL, 0)) { if (err) @@ -452,8 +453,8 @@ _dl_map_object_deps (struct link_map *map, l->l_initfini = (struct link_map **) malloc ((nneeded + 1) * sizeof needed[0]); if (l->l_initfini == NULL) - _dl_signal_error (ENOMEM, map->l_name, NULL, - N_("cannot allocate dependency list")); + INT(_dl_signal_error) (ENOMEM, map->l_name, NULL, + N_("cannot allocate dependency list")); l->l_initfini[0] = l; memcpy (&l->l_initfini[1], needed, nneeded * sizeof needed[0]); } @@ -483,8 +484,8 @@ _dl_map_object_deps (struct link_map *map, (struct link_map **) malloc ((2 * nlist + 1) * sizeof (struct link_map *)); if (map->l_initfini == NULL) - _dl_signal_error (ENOMEM, map->l_name, NULL, - N_("cannot allocate symbol search list")); + INT(_dl_signal_error) (ENOMEM, map->l_name, NULL, + N_("cannot allocate symbol search list")); map->l_searchlist.r_list = &map->l_initfini[nlist + 1]; @@ -524,7 +525,7 @@ _dl_map_object_deps (struct link_map *map, /* As current DT_AUXILIARY/DT_FILTER implementation needs to be rewritten, no need to bother with prelinking the old implementation. */ - _dl_signal_error (EINVAL, l->l_name, NULL, N_("\ + INT(_dl_signal_error) (EINVAL, l->l_name, NULL, N_("\ Filters not supported with LD_TRACE_PRELINKING")); } @@ -538,8 +539,8 @@ Filters not supported with LD_TRACE_PRELINKING")); + (cnt * sizeof (struct link_map *))); if (l->l_local_scope[0] == NULL) - _dl_signal_error (ENOMEM, map->l_name, NULL, - N_("cannot allocate symbol search list")); + INT(_dl_signal_error) (ENOMEM, map->l_name, NULL, + N_("cannot allocate symbol search list")); l->l_local_scope[0]->r_nlist = cnt; l->l_local_scope[0]->r_list = (struct link_map **) (l->l_local_scope[0] + 1); @@ -618,6 +619,7 @@ Filters not supported with LD_TRACE_PRELINKING")); map->l_initfini[nlist] = NULL; if (errno_reason) - _dl_signal_error (errno_reason == -1 ? 0 : errno_reason, - objname, NULL, errstring); + INT(_dl_signal_error) (errno_reason == -1 ? 0 : errno_reason, objname, + NULL, errstring); } +INTDEF (_dl_map_object_deps) diff --git a/elf/dl-dst.h b/elf/dl-dst.h index af4a94a3b3..4112e591e0 100644 --- a/elf/dl-dst.h +++ b/elf/dl-dst.h @@ -25,12 +25,13 @@ const char *__sf = strchr (name, '$'); \ \ if (__builtin_expect (__sf != NULL, 0)) \ - __cnt = _dl_dst_count (__sf, is_path); \ + __cnt = INT(_dl_dst_count) (__sf, is_path); \ \ __cnt; }) /* Prototype for used function. */ extern size_t _dl_dst_count (const char *name, int is_path); +extern size_t _dl_dst_count_internal (const char *name, int is_path); /* Guess from the number of DSTs the length of the result string. */ @@ -62,11 +63,8 @@ extern size_t _dl_dst_count (const char *name, int is_path); /* Find origin of the executable. */ extern const char *_dl_get_origin (void); - -/* Perform the DST substitution. */ -#define DL_DST_SUBSTITUTE(l, name, res, is_path) \ - _dl_dst_substitute (l, name, res, is_path) - /* Prototype for used function. */ extern char *_dl_dst_substitute (struct link_map *l, const char *name, char *result, int is_path); +extern char *_dl_dst_substitute_internal (struct link_map *l, const char *name, + char *result, int is_path); diff --git a/elf/dl-error.c b/elf/dl-error.c index 922de5caeb..a297189d77 100644 --- a/elf/dl-error.c +++ b/elf/dl-error.c @@ -110,6 +110,7 @@ _dl_signal_error (int errcode, const char *objname, const char *occation, : "")); } } +INTDEF (_dl_signal_error) void @@ -125,7 +126,7 @@ _dl_signal_cerror (int errcode, const char *objname, const char *occation, (*receiver) (errcode, objname, errstring); } else - _dl_signal_error (errcode, objname, occation, errstring); + INT(_dl_signal_error) (errcode, objname, occation, errstring); } @@ -162,6 +163,8 @@ _dl_catch_error (const char **objname, const char **errstring, *errstring = c.errstring; return errcode == -1 ? 0 : errcode; } +INTDEF (_dl_catch_error) + void internal_function diff --git a/elf/dl-fini.c b/elf/dl-fini.c index e8533a471c..ab6bf9c496 100644 --- a/elf/dl-fini.c +++ b/elf/dl-fini.c @@ -147,8 +147,8 @@ _dl_fini (void) /* When debugging print a message first. */ if (__builtin_expect (GL(dl_debug_mask) & DL_DEBUG_IMPCALLS, 0)) - _dl_debug_printf ("\ncalling fini: %s\n\n", - l->l_name[0] ? l->l_name : _dl_argv[0]); + INT(_dl_debug_printf) ("\ncalling fini: %s\n\n", + l->l_name[0] ? l->l_name : _dl_argv[0]); /* First see whether an array is given. */ if (l->l_info[DT_FINI_ARRAY] != NULL) diff --git a/elf/dl-init.c b/elf/dl-init.c index 700efc58e5..b58ff197dc 100644 --- a/elf/dl-init.c +++ b/elf/dl-init.c @@ -51,8 +51,8 @@ call_init (struct link_map *l, int argc, char **argv, char **env) /* Print a debug message if wanted. */ if (__builtin_expect (GL(dl_debug_mask) & DL_DEBUG_IMPCALLS, 0)) - _dl_debug_printf ("\ncalling init: %s\n\n", - l->l_name[0] ? l->l_name : _dl_argv[0]); + INT(_dl_debug_printf) ("\ncalling init: %s\n\n", + l->l_name[0] ? l->l_name : _dl_argv[0]); /* Now run the local constructors. There are two forms of them: - the one named by DT_INIT @@ -106,9 +106,9 @@ _dl_init (struct link_map *main_map, int argc, char **argv, char **env) unsigned int cnt; if (__builtin_expect (GL(dl_debug_mask) & DL_DEBUG_IMPCALLS, 0)) - _dl_debug_printf ("\ncalling preinit: %s\n\n", - main_map->l_name[0] - ? main_map->l_name : _dl_argv[0]); + INT(_dl_debug_printf) ("\ncalling preinit: %s\n\n", + main_map->l_name[0] + ? main_map->l_name : _dl_argv[0]); addrs = (ElfW(Addr) *) (main_map->l_info[DT_PREINIT_ARRAY]->d_un.d_ptr + main_map->l_addr); @@ -121,7 +121,7 @@ _dl_init (struct link_map *main_map, int argc, char **argv, char **env) not been used before. */ r = _dl_debug_initialize (0); r->r_state = RT_ADD; - _dl_debug_state (); + INT(_dl_debug_state) (); /* Stupid users forced the ELF specification to be changed. It now says that the dynamic loader is responsible for determining the @@ -139,8 +139,9 @@ _dl_init (struct link_map *main_map, int argc, char **argv, char **env) /* Notify the debugger all new objects are now ready to go. */ r->r_state = RT_CONSISTENT; - _dl_debug_state (); + INT(_dl_debug_state) (); /* Finished starting up. */ _dl_starting_up = 0; } +INTDEF (_dl_init) diff --git a/elf/dl-load.c b/elf/dl-load.c index ebaccfc000..574d4dad4e 100644 --- a/elf/dl-load.c +++ b/elf/dl-load.c @@ -212,6 +212,7 @@ _dl_dst_count (const char *name, int is_path) return cnt; } +INTDEF (_dl_dst_count) char * @@ -273,6 +274,7 @@ _dl_dst_substitute (struct link_map *l, const char *name, char *result, return result; } +INTDEF (_dl_dst_substitute) /* Return copy of argument with all recognized dynamic string tokens @@ -306,7 +308,7 @@ expand_dynamic_string_token (struct link_map *l, const char *s) if (result == NULL) return NULL; - return DL_DST_SUBSTITUTE (l, s, result, 1); + return INT(_dl_dst_substitute) (l, s, result, 1); } @@ -332,7 +334,8 @@ add_name_to_object (struct link_map *l, const char *name) if (newname == NULL) { /* No more memory. */ - _dl_signal_error (ENOMEM, name, NULL, N_("cannot allocate name record")); + INT(_dl_signal_error) (ENOMEM, name, NULL, + N_("cannot allocate name record")); return; } /* The object should have a libname set from _dl_new_object. */ @@ -433,8 +436,8 @@ fillin_rpath (char *rpath, struct r_search_path_elem **result, const char *sep, malloc (sizeof (*dirp) + ncapstr * sizeof (enum r_dir_status) + where_len + len + 1); if (dirp == NULL) - _dl_signal_error (ENOMEM, NULL, NULL, - N_("cannot create cache for search path")); + INT(_dl_signal_error) (ENOMEM, NULL, NULL, + N_("cannot create cache for search path")); dirp->dirname = ((char *) dirp + sizeof (*dirp) + ncapstr * sizeof (enum r_dir_status)); @@ -509,7 +512,7 @@ decompose_rpath (struct r_search_path_struct *sps, signal_error_cache: errstring = N_("cannot create cache for search path"); signal_error: - _dl_signal_error (ENOMEM, NULL, NULL, errstring); + INT(_dl_signal_error) (ENOMEM, NULL, NULL, errstring); } result[0] = NULL; @@ -584,7 +587,7 @@ _dl_init_paths (const char *llp) { errstring = N_("cannot create search path array"); signal_error: - _dl_signal_error (ENOMEM, NULL, NULL, errstring); + INT(_dl_signal_error) (ENOMEM, NULL, NULL, errstring); } round_size = ((2 * sizeof (struct r_search_path_elem) - 1 @@ -749,7 +752,7 @@ lose (int code, int fd, const char *name, char *realname, struct link_map *l, free (l); } free (realname); - _dl_signal_error (code, name, NULL, msg); + INT(_dl_signal_error) (code, name, NULL, msg); } @@ -808,7 +811,7 @@ _dl_map_object_from_fd (const char *name, int fd, struct filebuf *fbp, /* Print debugging message. */ if (__builtin_expect (GL(dl_debug_mask) & DL_DEBUG_FILES, 0)) - _dl_debug_printf ("file=%s; generating link map\n", name); + INT(_dl_debug_printf) ("file=%s; generating link map\n", name); /* This is the ELF header. We read it in `open_verify'. */ header = (void *) fbp->buf; @@ -821,8 +824,8 @@ _dl_map_object_from_fd (const char *name, int fd, struct filebuf *fbp, if (_dl_zerofd == -1) { __close (fd); - _dl_signal_error (errno, NULL, NULL, - N_("cannot open zero fill device")); + INT(_dl_signal_error) (errno, NULL, NULL, + N_("cannot open zero fill device")); } } #endif @@ -1107,14 +1110,19 @@ _dl_map_object_from_fd (const char *name, int fd, struct filebuf *fbp, l->l_entry += l->l_addr; if (__builtin_expect (GL(dl_debug_mask) & DL_DEBUG_FILES, 0)) - _dl_debug_printf (" dynamic: 0x%0*lx base: 0x%0*lx size: 0x%0*Zx\n" - " entry: 0x%0*lx phdr: 0x%0*lx phnum: %*u\n\n", - (int) sizeof (void *) * 2, (unsigned long int) l->l_ld, - (int) sizeof (void *) * 2, (unsigned long int) l->l_addr, - (int) sizeof (void *) * 2, maplength, - (int) sizeof (void *) * 2, (unsigned long int) l->l_entry, - (int) sizeof (void *) * 2, (unsigned long int) l->l_phdr, - (int) sizeof (void *) * 2, l->l_phnum); + INT(_dl_debug_printf) ("\ + dynamic: 0x%0*lx base: 0x%0*lx size: 0x%0*Zx\n\ + entry: 0x%0*lx phdr: 0x%0*lx phnum: %*u\n\n", + (int) sizeof (void *) * 2, + (unsigned long int) l->l_ld, + (int) sizeof (void *) * 2, + (unsigned long int) l->l_addr, + (int) sizeof (void *) * 2, maplength, + (int) sizeof (void *) * 2, + (unsigned long int) l->l_entry, + (int) sizeof (void *) * 2, + (unsigned long int) l->l_phdr, + (int) sizeof (void *) * 2, l->l_phnum); elf_get_dynamic_info (l); @@ -1189,7 +1197,7 @@ print_search_path (struct r_search_path_elem **list, char buf[max_dirnamelen + max_capstrlen]; int first = 1; - _dl_debug_printf (" search path="); + INT(_dl_debug_printf) (" search path="); while (*list != NULL && (*list)->what == what) /* Yes, ==. */ { @@ -1460,7 +1468,7 @@ open_path (const char *name, size_t namelen, int preloaded, /* Print name we try if this is wanted. */ if (__builtin_expect (GL(dl_debug_mask) & DL_DEBUG_LIBS, 0)) - _dl_debug_printf (" trying file=%s\n", buf); + INT(_dl_debug_printf) (" trying file=%s\n", buf); fd = open_verify (buf, fbp); if (this_dir->status[cnt] == unknown) @@ -1592,9 +1600,10 @@ _dl_map_object (struct link_map *loader, const char *name, int preloaded, } /* Display information if we are debugging. */ - if (__builtin_expect (GL(dl_debug_mask) & DL_DEBUG_FILES, 0) && loader != NULL) - _dl_debug_printf ("\nfile=%s; needed by %s\n", name, - loader->l_name[0] ? loader->l_name : _dl_argv[0]); + if (__builtin_expect (GL(dl_debug_mask) & DL_DEBUG_FILES, 0) + && loader != NULL) + INT(_dl_debug_printf) ("\nfile=%s; needed by %s\n", name, + loader->l_name[0] ? loader->l_name : _dl_argv[0]); if (strchr (name, '/') == NULL) { @@ -1603,7 +1612,7 @@ _dl_map_object (struct link_map *loader, const char *name, int preloaded, size_t namelen = strlen (name) + 1; if (__builtin_expect (GL(dl_debug_mask) & DL_DEBUG_LIBS, 0)) - _dl_debug_printf ("find library=%s; searching\n", name); + INT(_dl_debug_printf) ("find library=%s; searching\n", name); fd = -1; @@ -1752,7 +1761,7 @@ _dl_map_object (struct link_map *loader, const char *name, int preloaded, /* Add another newline when we a tracing the library loading. */ if (__builtin_expect (GL(dl_debug_mask) & DL_DEBUG_LIBS, 0)) - _dl_debug_printf ("\n"); + INT(_dl_debug_printf) ("\n"); } else { @@ -1784,8 +1793,8 @@ _dl_map_object (struct link_map *loader, const char *name, int preloaded, /* Enter the new object in the list of loaded objects. */ if ((name_copy = local_strdup (name)) == NULL || (l = _dl_new_object (name_copy, name, type, loader)) == NULL) - _dl_signal_error (ENOMEM, name, NULL, - N_("cannot create shared object descriptor")); + INT(_dl_signal_error) (ENOMEM, name, NULL, N_("\ +cannot create shared object descriptor")); /* Signal that this is a faked entry. */ l->l_faked = 1; /* Since the descriptor is initialized with zero we do not @@ -1798,9 +1807,10 @@ _dl_map_object (struct link_map *loader, const char *name, int preloaded, return l; } else - _dl_signal_error (errno, name, NULL, - N_("cannot open shared object file")); + INT(_dl_signal_error) (errno, name, NULL, + N_("cannot open shared object file")); } return _dl_map_object_from_fd (name, fd, &fb, realname, loader, type, mode); } +INTDEF (_dl_map_object) diff --git a/elf/dl-lookup.c b/elf/dl-lookup.c index 4f3285fee5..49ee42ad3c 100644 --- a/elf/dl-lookup.c +++ b/elf/dl-lookup.c @@ -168,11 +168,11 @@ add_dependency (struct link_map *undef_map, struct link_map *map) /* Display information if we are debugging. */ if (__builtin_expect (GL(dl_debug_mask) & DL_DEBUG_FILES, 0)) - _dl_debug_printf ("\ + INT(_dl_debug_printf) ("\ \nfile=%s; needed by %s (relocation dependency)\n\n", - map->l_name[0] ? map->l_name : _dl_argv[0], - undef_map->l_name[0] - ? undef_map->l_name : _dl_argv[0]); + map->l_name[0] ? map->l_name : _dl_argv[0], + undef_map->l_name[0] + ? undef_map->l_name : _dl_argv[0]); } else /* Whoa, that was bad luck. We have to search again. */ @@ -203,8 +203,9 @@ static void internal_function _dl_debug_bindings (const char *undef_name, struct link_map *undef_map, const ElfW(Sym) **ref, struct r_scope_elem *symbol_scope[], - struct sym_val *value, const struct r_found_version *version, - int type_class, int protected); + struct sym_val *value, + const struct r_found_version *version, int type_class, + int protected); /* Search loaded objects' symbol tables for a definition of the symbol UNDEF_NAME. */ @@ -239,8 +240,8 @@ _dl_lookup_symbol (const char *undef_name, struct link_map *undef_map, && add_dependency (undef_map, current_value.m) < 0) /* Something went wrong. Perhaps the object we tried to reference was just removed. Try finding another definition. */ - return _dl_lookup_symbol (undef_name, undef_map, ref, symbol_scope, - type_class, 0); + return INT(_dl_lookup_symbol) (undef_name, undef_map, ref, + symbol_scope, type_class, 0); break; } @@ -288,6 +289,7 @@ _dl_lookup_symbol (const char *undef_name, struct link_map *undef_map, *ref = current_value.s; return LOOKUP_VALUE (current_value.m); } +INTDEF (_dl_lookup_symbol) /* This function is nearly the same as `_dl_lookup_symbol' but it @@ -400,9 +402,9 @@ _dl_lookup_versioned_symbol (const char *undef_name, && add_dependency (undef_map, current_value.m) < 0) /* Something went wrong. Perhaps the object we tried to reference was just removed. Try finding another definition. */ - return _dl_lookup_versioned_symbol (undef_name, undef_map, ref, - symbol_scope, version, - type_class, 0); + return INT(_dl_lookup_versioned_symbol) (undef_name, undef_map, + ref, symbol_scope, + version, type_class, 0); break; } @@ -478,6 +480,7 @@ _dl_lookup_versioned_symbol (const char *undef_name, *ref = current_value.s; return LOOKUP_VALUE (current_value.m); } +INTDEF (_dl_lookup_versioned_symbol) /* Similar to _dl_lookup_symbol_skip but takes an additional argument @@ -597,12 +600,14 @@ _dl_debug_bindings (const char *undef_name, struct link_map *undef_map, if (GL(dl_debug_mask) & DL_DEBUG_BINDINGS) { - _dl_debug_printf ("binding file %s to %s: %s symbol `%s'", - (reference_name[0] - ? reference_name : (_dl_argv[0] ?: "<main program>")), - value->m->l_name[0] ? value->m->l_name : _dl_argv[0], - protected ? "protected" : "normal", - undef_name); + INT(_dl_debug_printf) ("binding file %s to %s: %s symbol `%s'", + (reference_name[0] + ? reference_name + : (_dl_argv[0] ?: "<main program>")), + value->m->l_name[0] + ? value->m->l_name : _dl_argv[0], + protected ? "protected" : "normal", + undef_name); if (version) _dl_debug_printf_c (" [%s]\n", version->name); else diff --git a/elf/dl-misc.c b/elf/dl-misc.c index d4d9d13e03..0a37b59ad7 100644 --- a/elf/dl-misc.c +++ b/elf/dl-misc.c @@ -249,6 +249,7 @@ _dl_debug_printf (const char *fmt, ...) _dl_debug_vdprintf (GL(dl_debug_fd), 1, fmt, arg); va_end (arg); } +INTDEF(_dl_debug_printf) /* Write to debug file but don't start with a tag. */ diff --git a/elf/dl-open.c b/elf/dl-open.c index 56b6cbb319..e5f7ac835b 100644 --- a/elf/dl-open.c +++ b/elf/dl-open.c @@ -40,9 +40,6 @@ extern ElfW(Addr) _dl_sysdep_start (void **start_argptr, ElfW(Addr) *user_entry)); weak_extern (BP_SYM (_dl_sysdep_start)) -/* This function is used to unload the cache file if necessary. */ -extern void _dl_unload_cache (void); - extern int __libc_multiple_libcs; /* Defined in init-first.c. */ extern int __libc_argc; @@ -200,7 +197,7 @@ dl_open_worker (void *a) new_file = (char *) alloca (required + 1); /* Generate the new file name. */ - DL_DST_SUBSTITUTE (call_map, file, new_file, 0); + _dl_dst_substitute (call_map, file, new_file, 0); /* If the substitution failed don't try to load. */ if (*new_file == '\0') @@ -374,10 +371,11 @@ dl_open_worker (void *a) if (__builtin_expect (mode & RTLD_NODELETE, 0)) new->l_flags_1 |= DF_1_NODELETE; - if (_dl_sysdep_start == NULL) - /* We must be the static _dl_open in libc.a. A static program that - has loaded a dynamic object now has competition. */ - __libc_multiple_libcs = 1; +#ifndef SHARED + /* We must be the static _dl_open in libc.a. A static program that + has loaded a dynamic object now has competition. */ + __libc_multiple_libcs = 1; +#endif /* Let the user know about the opencount. */ if (__builtin_expect (GL(dl_debug_mask) & DL_DEBUG_FILES, 0)) diff --git a/elf/dl-profile.c b/elf/dl-profile.c index 163a841d6f..83e849561a 100644 --- a/elf/dl-profile.c +++ b/elf/dl-profile.c @@ -430,6 +430,7 @@ _dl_start_profile (struct link_map *map, const char *output_dir) /* Turn on profiling. */ running = 1; } +INTDEF (_dl_start_profile) void diff --git a/elf/dl-reloc.c b/elf/dl-reloc.c index 8fea3fd778..67a47aa14a 100644 --- a/elf/dl-reloc.c +++ b/elf/dl-reloc.c @@ -87,7 +87,7 @@ _dl_relocate_object (struct link_map *l, struct r_scope_elem *scope[], { errstring = N_("cannot make segment writable for relocation"); call_error: - _dl_signal_error (errno, l->l_name, NULL, errstring); + INT(_dl_signal_error) (errno, l->l_name, NULL, errstring); } #if (PF_R | PF_W | PF_X) == 7 && (PROT_READ | PROT_WRITE | PROT_EXEC) == 7 @@ -126,11 +126,12 @@ _dl_relocate_object (struct link_map *l, struct r_scope_elem *scope[], l->l_lookup_cache.type_class = _tc; \ l->l_lookup_cache.sym = (*ref); \ _lr = ((version) != NULL && (version)->hash != 0 \ - ? _dl_lookup_versioned_symbol (strtab + (*ref)->st_name, \ - l, (ref), scope, \ - (version), _tc, 0) \ - : _dl_lookup_symbol (strtab + (*ref)->st_name, l, (ref), \ - scope, _tc, 0)); \ + ? INT(_dl_lookup_versioned_symbol) (strtab \ + + (*ref)->st_name, \ + l, (ref), scope, \ + (version), _tc, 0) \ + : INT(_dl_lookup_symbol) (strtab + (*ref)->st_name, l, \ + (ref), scope, _tc, 0)); \ l->l_lookup_cache.ret = (*ref); \ l->l_lookup_cache.value = _lr; })) \ : l) @@ -146,11 +147,12 @@ _dl_relocate_object (struct link_map *l, struct r_scope_elem *scope[], l->l_lookup_cache.type_class = _tc; \ l->l_lookup_cache.sym = (*ref); \ _lr = ((version) != NULL && (version)->hash != 0 \ - ? _dl_lookup_versioned_symbol (strtab + (*ref)->st_name, \ - l, (ref), scope, \ - (version), _tc, 0) \ - : _dl_lookup_symbol (strtab + (*ref)->st_name, l, (ref), \ - scope, _tc, 0)); \ + ? INT(_dl_lookup_versioned_symbol) (strtab \ + + (*ref)->st_name, \ + l, (ref), scope, \ + (version), _tc, 0) \ + : INT(_dl_lookup_symbol) (strtab + (*ref)->st_name, l, \ + (ref), scope, _tc, 0)); \ l->l_lookup_cache.ret = (*ref); \ l->l_lookup_cache.value = _lr; })) \ : l->l_addr) @@ -201,6 +203,7 @@ _dl_relocate_object (struct link_map *l, struct r_scope_elem *scope[], textrels = textrels->next; } } +INTDEF (_dl_relocate_object) void @@ -220,5 +223,5 @@ _dl_reloc_bad_type (struct link_map *map, unsigned int type, int plt) *cp++ = DIGIT (type >> 4); *cp = DIGIT (type); - _dl_signal_error (0, map->l_name, NULL, msgbuf); + INT(_dl_signal_error) (0, map->l_name, NULL, msgbuf); } diff --git a/elf/dl-runtime.c b/elf/dl-runtime.c index 44af537ab7..be5d8b68ad 100644 --- a/elf/dl-runtime.c +++ b/elf/dl-runtime.c @@ -87,16 +87,18 @@ fixup ( if (version->hash != 0) { - result = _dl_lookup_versioned_symbol (strtab + sym->st_name, - l, &sym, l->l_scope, - version, - ELF_RTYPE_CLASS_PLT, 0); + result = INT(_dl_lookup_versioned_symbol) (strtab + + sym->st_name, + l, &sym, l->l_scope, + version, + ELF_RTYPE_CLASS_PLT, + 0); break; } } case 0: - result = _dl_lookup_symbol (strtab + sym->st_name, l, &sym, - l->l_scope, ELF_RTYPE_CLASS_PLT, 0); + result = INT(_dl_lookup_symbol) (strtab + sym->st_name, l, &sym, + l->l_scope, ELF_RTYPE_CLASS_PLT, 0); } /* Currently result contains the base load address (or link map) @@ -179,17 +181,20 @@ profile_fixup ( if (version->hash != 0) { - result = _dl_lookup_versioned_symbol(strtab + sym->st_name, - l, &sym, l->l_scope, - version, - ELF_RTYPE_CLASS_PLT, - 0); + result = INT(_dl_lookup_versioned_symbol) (strtab + + sym->st_name, + l, &sym, + l->l_scope, + version, + ELF_RTYPE_CLASS_PLT, + 0); break; } } case 0: - result = _dl_lookup_symbol (strtab + sym->st_name, l, &sym, - l->l_scope, ELF_RTYPE_CLASS_PLT, 0); + result = INT(_dl_lookup_symbol) (strtab + sym->st_name, l, &sym, + l->l_scope, ELF_RTYPE_CLASS_PLT, + 0); } /* Currently result contains the base load address (or link map) diff --git a/elf/dl-version.c b/elf/dl-version.c index 7edb8ec359..9ba91b2efe 100644 --- a/elf/dl-version.c +++ b/elf/dl-version.c @@ -87,10 +87,10 @@ match_symbol (const char *name, ElfW(Word) hash, const char *string, /* Display information about what we are doing while debugging. */ if (__builtin_expect (GL(dl_debug_mask) & DL_DEBUG_VERSIONS, 0)) - _dl_debug_printf ("\ + INT(_dl_debug_printf) ("\ checking for version `%s' in file %s required by file %s\n", - string, map->l_name[0] - ? map->l_name : _dl_argv[0], name); + string, map->l_name[0] + ? map->l_name : _dl_argv[0], name); if (__builtin_expect (map->l_info[VERSYMIDX (DT_VERDEF)] == NULL, 0)) { @@ -214,9 +214,9 @@ _dl_check_map_versions (struct link_map *map, int verbose, int trace_mode) &buf[sizeof (buf) - 1], 10, 0), " of Verneed record\n"); call_error: - _dl_signal_error (errval, (*map->l_name - ? map->l_name : _dl_argv[0]), - NULL, errstring); + INT(_dl_signal_error) (errval, (*map->l_name + ? map->l_name : _dl_argv[0]), + NULL, errstring); } while (1) @@ -374,6 +374,7 @@ _dl_check_map_versions (struct link_map *map, int verbose, int trace_mode) return result; } +INTDEF (_dl_check_map_versions) int @@ -384,7 +385,8 @@ _dl_check_all_versions (struct link_map *map, int verbose, int trace_mode) int result = 0; for (l = map; l != NULL; l = l->l_next) - result |= ! l->l_faked && _dl_check_map_versions (l, verbose, trace_mode); + result |= (! l->l_faked + && INT(_dl_check_map_versions) (l, verbose, trace_mode)); return result; } diff --git a/elf/do-lookup.h b/elf/do-lookup.h index 18d1ab5bfe..c42c93ae27 100644 --- a/elf/do-lookup.h +++ b/elf/do-lookup.h @@ -61,8 +61,8 @@ FCT (const char *undef_name, unsigned long int hash, const ElfW(Sym) *ref, /* Print some debugging info if wanted. */ if (__builtin_expect (GL(dl_debug_mask) & DL_DEBUG_SYMBOLS, 0)) - _dl_debug_printf ("symbol=%s; lookup in file=%s\n", undef_name, - map->l_name[0] ? map->l_name : _dl_argv[0]); + INT(_dl_debug_printf) ("symbol=%s; lookup in file=%s\n", undef_name, + map->l_name[0] ? map->l_name : _dl_argv[0]); symtab = (const void *) D_PTR (map, l_info[DT_SYMTAB]); strtab = (const void *) D_PTR (map, l_info[DT_STRTAB]); diff --git a/elf/rtld.c b/elf/rtld.c index b835bd5dda..4dd288b072 100644 --- a/elf/rtld.c +++ b/elf/rtld.c @@ -297,15 +297,14 @@ relocate_doit (void *a) { struct relocate_args *args = (struct relocate_args *) a; - _dl_relocate_object (args->l, args->l->l_scope, - args->lazy, 0); + INT(_dl_relocate_object) (args->l, args->l->l_scope, args->lazy, 0); } static void map_doit (void *a) { struct map_args *args = (struct map_args *) a; - args->main_map = _dl_map_object (NULL, args->str, 0, lt_library, 0, 0); + args->main_map = INT(_dl_map_object) (NULL, args->str, 0, lt_library, 0, 0); } static void @@ -495,7 +494,7 @@ of this helper program; chances are you did not intend to run this program.\n\ struct map_args args; args.str = _dl_argv[0]; - (void) _dl_catch_error (&objname, &err_str, map_doit, &args); + (void) INT(_dl_catch_error) (&objname, &err_str, map_doit, &args); if (__builtin_expect (err_str != NULL, 0)) { if (err_str != _dl_out_of_memory) @@ -506,7 +505,7 @@ of this helper program; chances are you did not intend to run this program.\n\ else { HP_TIMING_NOW (start); - _dl_map_object (NULL, _dl_argv[0], 0, lt_library, 0, 0); + INT(_dl_map_object) (NULL, _dl_argv[0], 0, lt_library, 0, 0); HP_TIMING_NOW (stop); HP_TIMING_DIFF (load_time, start, stop); @@ -703,8 +702,9 @@ of this helper program; chances are you did not intend to run this program.\n\ && (__builtin_expect (! __libc_enable_secure, 1) || strchr (p, '/') == NULL)) { - struct link_map *new_map = _dl_map_object (GL(dl_loaded), p, 1, - lt_library, 0, 0); + struct link_map *new_map = INT(_dl_map_object) (GL(dl_loaded), p, + 1, lt_library, + 0, 0); if (++new_map->l_opencount == 1) /* It is no duplicate. */ ++npreloads; @@ -771,8 +771,10 @@ of this helper program; chances are you did not intend to run this program.\n\ while ((p = strsep (&runp, ": \t\n")) != NULL) if (p[0] != '\0') { - struct link_map *new_map = _dl_map_object (GL(dl_loaded), p, 1, - lt_library, 0, 0); + struct link_map *new_map = INT(_dl_map_object) (GL(dl_loaded), + p, 1, + lt_library, + 0, 0); if (++new_map->l_opencount == 1) /* It is no duplicate. */ ++npreloads; @@ -782,8 +784,8 @@ of this helper program; chances are you did not intend to run this program.\n\ if (problem != NULL) { char *p = strndupa (problem, file_size - (problem - file)); - struct link_map *new_map = _dl_map_object (GL(dl_loaded), p, 1, - lt_library, 0, 0); + struct link_map *new_map = INT(_dl_map_object) (GL(dl_loaded), p, 1, + lt_library, 0, 0); if (++new_map->l_opencount == 1) /* It is no duplicate. */ ++npreloads; @@ -816,7 +818,7 @@ of this helper program; chances are you did not intend to run this program.\n\ specified some libraries to load, these are inserted before the actual dependencies in the executable's searchlist for symbol resolution. */ HP_TIMING_NOW (start); - _dl_map_object_deps (GL(dl_loaded), preloads, npreloads, mode == trace); + INT(_dl_map_object_deps) (GL(dl_loaded), preloads, npreloads, mode == trace); HP_TIMING_NOW (stop); HP_TIMING_DIFF (diff, start, stop); HP_TIMING_ACCUM_NT (load_time, diff); @@ -938,9 +940,9 @@ of this helper program; chances are you did not intend to run this program.\n\ ElfW(Addr) loadbase; lookup_t result; - result = _dl_lookup_symbol (_dl_argv[i], GL(dl_loaded), - &ref, GL(dl_loaded)->l_scope, - ELF_RTYPE_CLASS_PLT, 1); + result = INT(_dl_lookup_symbol) (_dl_argv[i], GL(dl_loaded), + &ref, GL(dl_loaded)->l_scope, + ELF_RTYPE_CLASS_PLT, 1); loadbase = LOOKUP_VALUE_ADDRESS (result); @@ -976,8 +978,8 @@ of this helper program; chances are you did not intend to run this program.\n\ if ((GL(dl_debug_mask) & DL_DEBUG_PRELINK) && GL(dl_rtld_map).l_opencount > 1) - _dl_relocate_object (&GL(dl_rtld_map), GL(dl_loaded)->l_scope, - 0, 0); + INT(_dl_relocate_object) (&GL(dl_rtld_map), + GL(dl_loaded)->l_scope, 0, 0); } #define VERNEEDTAG (DT_NUM + DT_THISPROCNUM + DT_VERSIONTAGIDX (DT_VERNEED)) @@ -1174,7 +1176,8 @@ of this helper program; chances are you did not intend to run this program.\n\ } if (l != &GL(dl_rtld_map)) - _dl_relocate_object (l, l->l_scope, GL(dl_lazy), consider_profiling); + INT(_dl_relocate_object) (l, l->l_scope, GL(dl_lazy), + consider_profiling); l = l->l_prev; } @@ -1196,14 +1199,15 @@ of this helper program; chances are you did not intend to run this program.\n\ needs to have _dl_profile_map set up by the relocator. */ if (__builtin_expect (GL(dl_profile_map) != NULL, 0)) /* We must prepare the profiling. */ - _dl_start_profile (GL(dl_profile_map), GL(dl_profile_output)); + INT(_dl_start_profile) (GL(dl_profile_map), GL(dl_profile_output)); if (GL(dl_rtld_map).l_opencount > 1) { /* There was an explicit ref to the dynamic linker as a shared lib. Re-relocate ourselves with user-controlled symbol definitions. */ HP_TIMING_NOW (start); - _dl_relocate_object (&GL(dl_rtld_map), GL(dl_loaded)->l_scope, 0, 0); + INT(_dl_relocate_object) (&GL(dl_rtld_map), GL(dl_loaded)->l_scope, + 0, 0); HP_TIMING_NOW (stop); HP_TIMING_DIFF (add, start, stop); HP_TIMING_ACCUM_NT (relocate_time, add); @@ -1248,12 +1252,12 @@ of this helper program; chances are you did not intend to run this program.\n\ /* Notify the debugger that all objects are now mapped in. */ r->r_state = RT_ADD; - _dl_debug_state (); + INT(_dl_debug_state) (); } #ifndef MAP_COPY /* We must munmap() the cache file. */ - _dl_unload_cache (); + INT(_dl_unload_cache) (); #endif /* Once we return, _dl_sysdep_start will invoke @@ -1593,8 +1597,9 @@ print_statistics (void) if (HP_TIMING_AVAIL) { HP_TIMING_PRINT (buf, sizeof (buf), rtld_total_time); - _dl_debug_printf ("\nruntime linker statistics:\n" - " total startup time in dynamic loader: %s\n", buf); + INT(_dl_debug_printf) ("\nruntime linker statistics:\n" + " total startup time in dynamic loader: %s\n", + buf); } /* Print relocation statistics. */ @@ -1616,14 +1621,15 @@ print_statistics (void) *wp++ = *cp++; } *wp = '\0'; - _dl_debug_printf (" time needed for relocation: %s (%s%%)\n", - buf, pbuf); + INT(_dl_debug_printf) ("\ + time needed for relocation: %s (%s%%)\n", + buf, pbuf); } #endif - _dl_debug_printf (" number of relocations: %lu\n", - GL(dl_num_relocations)); - _dl_debug_printf (" number of relocations from cache: %lu\n", - GL(dl_num_cache_relocations)); + INT(_dl_debug_printf) (" number of relocations: %lu\n", + GL(dl_num_relocations)); + INT(_dl_debug_printf) (" number of relocations from cache: %lu\n", + GL(dl_num_cache_relocations)); #ifndef HP_TIMING_NONAVAIL /* Time spend while loading the object and the dependencies. */ @@ -1645,8 +1651,9 @@ print_statistics (void) *wp++ = *cp++; } *wp = '\0'; - _dl_debug_printf (" time needed to load objects: %s (%s%%)\n", - buf, pbuf); + INT(_dl_debug_printf) ("\ + time needed to load objects: %s (%s%%)\n", + buf, pbuf); } #endif } diff --git a/include/dlfcn.h b/include/dlfcn.h index feff4a1454..94c8cc0de1 100644 --- a/include/dlfcn.h +++ b/include/dlfcn.h @@ -52,6 +52,10 @@ extern int _dl_catch_error (const char **objname, const char **errstring, void (*operate) (void *), void *args) internal_function; +extern int _dl_catch_error_internal (const char **objname, + const char **errstring, + void (*operate) (void *), void *args) + internal_function; /* Helper function for <dlfcn.h> functions. Runs the OPERATE function via _dl_catch_error. Returns zero for success, nonzero for failure; and diff --git a/include/libc-symbols.h b/include/libc-symbols.h index 97b6726438..a763749564 100644 --- a/include/libc-symbols.h +++ b/include/libc-symbols.h @@ -1,6 +1,6 @@ /* Support macros for making weak and strong aliases for symbols, and for using symbol sets and linker warnings with GNU ld. - Copyright (C) 1995,1996,1997,1998,2000,2001 Free Software Foundation, Inc. + Copyright (C) 1995-1998,2000,2001,2002 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -226,7 +226,7 @@ The native aix linker will remove the .stab and .stabstr sections The gnu linker will have a fatal error if there is a relocation for symbol in the .stab section. Silently disable this macro. */ -# define link_warning(symbol, msg) +# define link_warning(symbol, msg) # else # define link_warning(symbol, msg) \ asm (".stabs \"" msg "\",30,0,0,0\n\t" \ @@ -298,9 +298,9 @@ The native aix linker will remove the .stab and .stabstr sections The gnu linker will have a fatal error if there is a relocation for symbol in the .stab section. Silently disable these macros. */ -# define text_set_element(set, symbol) -# define data_set_element(set, symbol) -# define bss_set_element(set, symbol) +# define text_set_element(set, symbol) +# define data_set_element(set, symbol) +# define bss_set_element(set, symbol) # else # define text_set_element(set, symbol) \ asm (".stabs \"" __SYMBOL_PREFIX #set "\",23,0,0," __SYMBOL_PREFIX #symbol) @@ -349,4 +349,14 @@ strong_alias(real, name) #endif +/* Handling on non-exported internal names. We have to do this only + for shared code. */ +#ifdef SHARED +# define INT(name) name##_internal +# define INTDEF(name) strong_alias (name, name##_internal); +#else +# define INT(name) name +# define INTDEF(name) +#endif + #endif /* libc-symbols.h */ diff --git a/sysdeps/alpha/dl-machine.h b/sysdeps/alpha/dl-machine.h index 9e4c6f4ebf..5feb46d69c 100644 --- a/sysdeps/alpha/dl-machine.h +++ b/sysdeps/alpha/dl-machine.h @@ -333,7 +333,7 @@ $fixup_stack_ret: \n\ lda $18, 8($sp) \n\ s8addq $17, 8, $19 \n\ addq $19, $18, $19 \n\ - jsr $26, _dl_init \n\ + jsr $26, _dl_init_internal \n\ /* Pass our finalizer function to the user in $0. */ \n\ lda $0, _dl_fini \n\ /* Jump to the user's entry point. */ \n\ diff --git a/sysdeps/arm/dl-machine.h b/sysdeps/arm/dl-machine.h index 4c302b5bf5..5d1656480d 100644 --- a/sysdeps/arm/dl-machine.h +++ b/sysdeps/arm/dl-machine.h @@ -302,7 +302,7 @@ _dl_start_user: ldr r0, [sl, r0] ldr r0, [r0] @ call _dl_init - bl _dl_init(PLT) + bl _dl_init_internal(PLT) @ clear the startup flag ldr r2, .L_STARTUP_FLAG ldr r1, [sl, r2] diff --git a/sysdeps/cris/dl-machine.h b/sysdeps/cris/dl-machine.h index ff27005f2a..34d29fa3ac 100644 --- a/sysdeps/cris/dl-machine.h +++ b/sysdeps/cris/dl-machine.h @@ -214,7 +214,7 @@ _dl_start_user: ; main_map: at _dl_loaded. move.d [$r0+_rtld_global:GOT16],$r9 move.d [$r9],$r10 - move.d _dl_init:PLTG,$r9 + move.d _dl_init_internal:PLTG,$r9 add.d $r0,$r9 jsr $r9 ; Pass our finalizer function to the user in R10. diff --git a/sysdeps/generic/dl-cache.c b/sysdeps/generic/dl-cache.c index 3800a677cc..a95f61f009 100644 --- a/sysdeps/generic/dl-cache.c +++ b/sysdeps/generic/dl-cache.c @@ -149,7 +149,7 @@ _dl_load_cache_lookup (const char *name) /* Print a message if the loading of libs is traced. */ if (__builtin_expect (GL(dl_debug_mask) & DL_DEBUG_LIBS, 0)) - _dl_debug_printf (" search cache=%s\n", LD_SO_CACHE); + INT(_dl_debug_printf) (" search cache=%s\n", LD_SO_CACHE); if (cache == NULL) { @@ -251,7 +251,7 @@ _dl_load_cache_lookup (const char *name) /* Print our result if wanted. */ if (__builtin_expect (GL(dl_debug_mask) & DL_DEBUG_LIBS, 0) && best != NULL) - _dl_debug_printf (" trying file=%s\n", best); + INT(_dl_debug_printf) (" trying file=%s\n", best); return best; } @@ -270,4 +270,5 @@ _dl_unload_cache (void) cache = NULL; } } +INTDEF (_dl_unload_cache) #endif diff --git a/sysdeps/generic/dl-sysdep.c b/sysdeps/generic/dl-sysdep.c index d3d5a8cefb..0fb40cb744 100644 --- a/sysdeps/generic/dl-sysdep.c +++ b/sysdeps/generic/dl-sysdep.c @@ -298,8 +298,8 @@ _dl_important_hwcaps (const char *platform, size_t platform_len, size_t *sz, if (result == NULL) { no_memory: - _dl_signal_error (ENOMEM, NULL, NULL, - N_("cannot create capability list")); + INT(_dl_signal_error) (ENOMEM, NULL, NULL, + N_("cannot create capability list")); } result[0].str = (char *) result; /* Does not really matter. */ diff --git a/sysdeps/generic/ldsodefs.h b/sysdeps/generic/ldsodefs.h index be6b172ece..0f63799524 100644 --- a/sysdeps/generic/ldsodefs.h +++ b/sysdeps/generic/ldsodefs.h @@ -352,6 +352,8 @@ extern int _dl_sysdep_open_zero_fill (void); /* dl-sysdep.c */ tag showing the PID. */ extern void _dl_debug_printf (const char *fmt, ...) __attribute__ ((__format__ (__printf__, 1, 2))); +extern void _dl_debug_printf_internal (const char *fmt, ...) + __attribute__ ((__format__ (__printf__, 1, 2))); /* Write message on the debug file descriptor. The parameters are interpreted as for a `printf' call. All the lines buf the first @@ -395,6 +397,11 @@ extern void _dl_signal_error (int errcode, const char *object, const char *occurred, const char *errstring) internal_function __attribute__ ((__noreturn__)); +extern void _dl_signal_error_internal (int errcode, const char *object, + const char *occurred, + const char *errstring) + internal_function + __attribute__ ((__noreturn__)); /* Like _dl_signal_error, but may return when called in the context of _dl_receive_error. */ @@ -420,6 +427,12 @@ extern struct link_map *_dl_map_object (struct link_map *loader, const char *name, int preloaded, int type, int trace_mode, int mode) internal_function; +extern struct link_map *_dl_map_object_internal (struct link_map *loader, + const char *name, + int preloaded, + int type, int trace_mode, + int mode) + internal_function; /* Call _dl_map_object on the dependencies of MAP, and set up MAP->l_searchlist. PRELOADS points to a vector of NPRELOADS previously @@ -429,6 +442,11 @@ extern void _dl_map_object_deps (struct link_map *map, struct link_map **preloads, unsigned int npreloads, int trace_mode) internal_function; +extern void _dl_map_object_deps_internal (struct link_map *map, + struct link_map **preloads, + unsigned int npreloads, + int trace_mode) + internal_function; /* Cache the locations of MAP's hash table. */ extern void _dl_setup_hash (struct link_map *map) internal_function; @@ -449,6 +467,12 @@ extern lookup_t _dl_lookup_symbol (const char *undef, struct r_scope_elem *symbol_scope[], int type_class, int explicit) internal_function; +extern lookup_t _dl_lookup_symbol_internal (const char *undef, + struct link_map *undef_map, + const ElfW(Sym) **sym, + struct r_scope_elem *symbol_scope[], + int type_class, int explicit) + internal_function; /* Lookup versioned symbol. */ extern lookup_t _dl_lookup_versioned_symbol (const char *undef, @@ -458,6 +482,14 @@ extern lookup_t _dl_lookup_versioned_symbol (const char *undef, const struct r_found_version *version, int type_class, int explicit) internal_function; +extern lookup_t _dl_lookup_versioned_symbol_internal (const char *undef, + struct link_map *undef_map, + const ElfW(Sym) **sym, + struct r_scope_elem *symbol_scope[], + const struct r_found_version *version, + int type_class, + int explicit) + internal_function; /* For handling RTLD_NEXT we must be able to skip shared objects. */ extern lookup_t _dl_lookup_symbol_skip (const char *undef, @@ -493,6 +525,9 @@ extern struct link_map *_dl_new_object (char *realname, const char *libname, extern void _dl_relocate_object (struct link_map *map, struct r_scope_elem *scope[], int lazy, int consider_profiling); +extern void _dl_relocate_object_internal (struct link_map *map, + struct r_scope_elem *scope[], + int lazy, int consider_profiling); /* Call _dl_signal_error with a message about an unhandled reloc type. TYPE is the result of ELFW(R_TYPE) (r_info), i.e. an R_<CPU>_* value. @@ -532,6 +567,7 @@ extern void _dl_fini (void) internal_function; says what change is taking place. This function's address is the value of the `r_brk' member. */ extern void _dl_debug_state (void); +extern void _dl_debug_state_internal (void); /* Initialize `struct r_debug' if it has not already been done. The argument is the run-time load address of the dynamic linker, to be put @@ -546,6 +582,9 @@ extern void _dl_init_paths (const char *library_path) internal_function; the timers. */ extern void _dl_start_profile (struct link_map *map, const char *output_dir) internal_function; +extern void _dl_start_profile_internal (struct link_map *map, + const char *output_dir) + internal_function; /* The actual functions used to keep book on the calls. */ extern void _dl_mcount (ElfW(Addr) frompc, ElfW(Addr) selfpc); @@ -579,6 +618,7 @@ extern const char *_dl_load_cache_lookup (const char *name) Therefore we provide this function to close the file and open it again once needed. */ extern void _dl_unload_cache (void); +extern void _dl_unload_cache_internal (void); /* System-dependent function to read a file's whole contents in the most convenient manner available. *SIZEP gets the size of the diff --git a/sysdeps/hppa/dl-machine.h b/sysdeps/hppa/dl-machine.h index 449fa9dbef..bc3a9839f7 100644 --- a/sysdeps/hppa/dl-machine.h +++ b/sysdeps/hppa/dl-machine.h @@ -372,7 +372,7 @@ asm ( \ \ /* envp = argv + argc + 1 */ \ " sh2add %r25,%r24,%r23\n" \ -" bl _dl_init,%r2\n" \ +" bl _dl_init_internal,%r2\n" \ " ldo 4(%r23),%r23\n" /* delay slot */ \ \ /* Reload argc, argv to the registers start.S expects them in (feh) */ \ diff --git a/sysdeps/i386/dl-machine.h b/sysdeps/i386/dl-machine.h index a3d3f2580f..69a0c5550e 100644 --- a/sysdeps/i386/dl-machine.h +++ b/sysdeps/i386/dl-machine.h @@ -243,7 +243,7 @@ _dl_start_user:\n\ pushl %eax\n\ movl (%esi), %eax\n\ # Call the function to run the initializers.\n\ - call _dl_init@PLT\n\ + call _dl_init_internal@PLT\n\ # Pass our finalizer function to the user in %edx, as per ELF ABI.\n\ movl _dl_fini@GOT(%ebx), %edx\n\ # Jump to the user's entry point.\n\ diff --git a/sysdeps/ia64/dl-machine.h b/sysdeps/ia64/dl-machine.h index 04381fe60d..49a5ef27bb 100644 --- a/sysdeps/ia64/dl-machine.h +++ b/sysdeps/ia64/dl-machine.h @@ -402,7 +402,7 @@ elf_machine_runtime_setup (struct link_map *l, int lazy, int profile) " { .mmb\n" \ " ld8 out0 = [out0] /* get the linkmap */\n" \ " st8 [r2] = r17 /* Load the new _dl_argv. */\n" \ -" br.call.sptk.many b0 = _dl_init#\n" \ +" br.call.sptk.many b0 = _dl_init_internal#\n" \ " ;;\n" \ " }\n" \ " /* Pass our finializer function to the user,\n" \ diff --git a/sysdeps/m68k/dl-machine.h b/sysdeps/m68k/dl-machine.h index 3b99978554..1645d83888 100644 --- a/sysdeps/m68k/dl-machine.h +++ b/sysdeps/m68k/dl-machine.h @@ -177,7 +177,7 @@ _dl_start_user:\n\ pea 8(%sp)\n\ move.l %d1, -(%sp)\n\ move.l ([_rtld_global@GOT.w, %a5]), -(%sp)\n\ - jbsr _dl_init@PLTPC\n\ + jbsr _dl_init_internal@PLTPC\n\ addq.l #8, %sp\n\ addq.l #8, %sp\n\ | Pass our finalizer function to the user in %a1.\n\ diff --git a/sysdeps/mips/dl-machine.h b/sysdeps/mips/dl-machine.h index 4c28e17c9f..18eb3eb377 100644 --- a/sysdeps/mips/dl-machine.h +++ b/sysdeps/mips/dl-machine.h @@ -449,7 +449,7 @@ _dl_start_user:\n\ addu $7, $7, 4\n\ subu $29, 16\n\ # Call the function to run the initializers.\n\ - jal _dl_init + jal _dl_init_internal\n\ addiu $29, 16\n\ # Pass our finalizer function to the user in $2 as per ELF ABI.\n\ la $2, _dl_fini\n\ diff --git a/sysdeps/mips/mips64/dl-machine.h b/sysdeps/mips/mips64/dl-machine.h index 7ee3cf52aa..6f89c0bb11 100644 --- a/sysdeps/mips/mips64/dl-machine.h +++ b/sysdeps/mips/mips64/dl-machine.h @@ -486,7 +486,7 @@ _dl_start_user:\n\ dla $7, 8($29)\n\ dsubu $29, 16\n\ # Call the function to run the initializers.\n\ - jal _dl_init + jal _dl_init_internal\n\ daddiu $29, 16\n\ # Pass our finalizer function to the user in ra.\n\ dla $31, _dl_fini\n\ @@ -498,7 +498,7 @@ _dl_start_user:\n\ la $7, 8($29)\n\ subu $29, 16\n\ # Call the function to run the initializers.\n\ - jal _dl_init + jal _dl_init_internal\n\ addiu $29, 16\n\ # Pass our finalizer function to the user in ra.\n\ dla $31, _dl_fini\n\ diff --git a/sysdeps/powerpc/dl-start.S b/sysdeps/powerpc/dl-start.S index 1bca5d5118..527982bfdf 100644 --- a/sysdeps/powerpc/dl-start.S +++ b/sysdeps/powerpc/dl-start.S @@ -63,7 +63,7 @@ ENTRY(_dl_start_user) slwi r6,r4,2 add r6,r5,r6 addi r6,r6,4 - bl _dl_init@local + bl _dl_init_internal@local /* Now, to conform to the ELF ABI, we have to: */ /* Pass argc (actually _dl_argc) in r3; */ diff --git a/sysdeps/s390/s390-32/dl-machine.h b/sysdeps/s390/s390-32/dl-machine.h index 2c7ba2ea6c..344d247550 100644 --- a/sysdeps/s390/s390-32/dl-machine.h +++ b/sysdeps/s390/s390-32/dl-machine.h @@ -305,7 +305,7 @@ _dl_start_user:\n\ .Llit:\n\ .Ladr0: .long _GLOBAL_OFFSET_TABLE_-.Llit\n\ .Ladr1: .long _dl_start-.Llit\n\ -.Ladr4: .long _dl_init@PLT-.Llit\n\ +.Ladr4: .long _dl_init_internal@PLT-.Llit\n\ "); #ifndef RTLD_START_SPECIAL_INIT diff --git a/sysdeps/s390/s390-64/dl-machine.h b/sysdeps/s390/s390-64/dl-machine.h index a6df8ddecd..fcbd02ed10 100644 --- a/sysdeps/s390/s390-64/dl-machine.h +++ b/sysdeps/s390/s390-64/dl-machine.h @@ -270,7 +270,7 @@ _dl_start_user:\n\ lgr %r5,%r3\n\ sllg %r5,%r5,3\n\ la %r5,176(%r5,%r15)\n\ - brasl %r14,_dl_init@PLT\n + brasl %r14,_dl_init_internal@PLT\n # Pass our finalizer function to the user in %r14, as per ELF ABI.\n\ lghi %r14,_dl_fini@GOT lg %r14,0(%r14,%r12)\n\ diff --git a/sysdeps/sh/dl-machine.h b/sysdeps/sh/dl-machine.h index 705e8d614b..72ea757dcb 100644 --- a/sysdeps/sh/dl-machine.h +++ b/sysdeps/sh/dl-machine.h @@ -386,7 +386,7 @@ _dl_start_user:\n\ .L_dl_skip_args:\n\ .long _dl_skip_args@GOT\n\ .L_dl_init:\n\ - .long _dl_init@PLT\n\ + .long _dl_init_internal@PLT\n\ .L_dl_loaded:\n\ .long _rtld_global@GOT\n\ .L_dl_starting_up:\n\ diff --git a/sysdeps/sparc/sparc32/dl-machine.h b/sysdeps/sparc/sparc32/dl-machine.h index 7544707447..69054572b8 100644 --- a/sysdeps/sparc/sparc32/dl-machine.h +++ b/sysdeps/sparc/sparc32/dl-machine.h @@ -320,7 +320,7 @@ _dl_start_user: add %o3, 4, %o3 mov %i5, %o1 add %o2, %o3, %o3 - call _dl_init + call _dl_init_internal ld [%o0], %o0 /* Pass our finalizer function to the user in %g1. */ sethi %hi(_dl_fini), %g1 diff --git a/sysdeps/sparc/sparc64/dl-machine.h b/sysdeps/sparc/sparc64/dl-machine.h index 8cfed7b8ec..c0cccf3b5c 100644 --- a/sysdeps/sparc/sparc64/dl-machine.h +++ b/sysdeps/sparc/sparc64/dl-machine.h @@ -753,7 +753,7 @@ elf_machine_runtime_setup (struct link_map *l, int lazy, int profile) " add %o3, 8, %o3\n" \ " mov %i5, %o1\n" \ " add %o2, %o3, %o3\n" \ -" call _dl_init\n" \ +" call _dl_init_internal\n" \ " ldx [%o0], %o0\n" \ " /* Pass our finalizer function to the user in %g1. */\n" \ " sethi %hi(_dl_fini), %g1\n" \ diff --git a/sysdeps/x86_64/dl-machine.h b/sysdeps/x86_64/dl-machine.h index 504c75e01b..949e8ec301 100644 --- a/sysdeps/x86_64/dl-machine.h +++ b/sysdeps/x86_64/dl-machine.h @@ -257,7 +257,7 @@ _dl_start_user:\n\ # argv -> rdx\n\ leaq 8(%rsp), %rdx\n\ # Call the function to run the initializers.\n\ - call _dl_init@PLT\n\ + call _dl_init_internal@PLT\n\ # Pass our finalizer function to the user in %rdx, as per ELF ABI.\n\ movq _dl_fini@GOTPCREL(%rip), %rdx\n\ # Jump to the user's entry point.\n\ |