From 7969407a01a108298ea506e0c37c1d6b7c9d424c Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Sun, 3 Feb 2002 00:31:37 +0000 Subject: 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. --- elf/dl-load.c | 68 ++++++++++++++++++++++++++++++++++------------------------- 1 file changed, 39 insertions(+), 29 deletions(-) (limited to 'elf/dl-load.c') 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) -- cgit 1.4.1