diff options
| author | Ulrich Drepper <drepper@redhat.com> | 2002-03-01 09:44:29 +0000 |
|---|---|---|
| committer | Ulrich Drepper <drepper@redhat.com> | 2002-03-01 09:44:29 +0000 |
| commit | e6caf4e12ebb89254977a74b882757e371c5cc16 (patch) | |
| tree | 294c7931b89d526659023e762272b36ad53744a3 | |
| parent | 90a77d0a958c5822ad8a2f479c466a6f4d093e74 (diff) | |
| download | glibc-e6caf4e12ebb89254977a74b882757e371c5cc16.tar.xz glibc-e6caf4e12ebb89254977a74b882757e371c5cc16.zip | |
Update.
2002-03-01 Ulrich Drepper <drepper@redhat.com>
* elf/Makefile (dl-routines): Add dl-origin.
(elide-routines.os): Add dl-origin.
* elf/Versions [ld] (GLIBC_PRIVATE): Add _dl_get_origin.
* elf/dl-debug.c (_dl_debug_initialize): Add missing INTUSE around
_dl_debug_state.
* include/libc-symbols.c: Define attribute_hidden depending on
HAVE_VISIBILITY_ATTRIBUTE. Add definition of INTVARDEF.
* elf/dl-deps.c: Use INTUSE with __libc_enable_secure.
* elf/dl-load.c: Likewise.
* elf/rtld.c: Likewise.
* include/unistd.h: Declare __libc_enable_secure_internal.
* sysdeps/generic/dl-sysdep.c: Use INTVARDEF with __libc_enable_secure.
Use INTUSE with __libc_enable_secure.
* sysdeps/mach/hurd/dl-sysdep.c: Likewise.
* elf/dl-deps.c: Use INTUSE with _dl_out_of_memory.
* elf/dl-error.c: Likewise,
* sysdeps/generic/ldsodefs.h: Declare _dl_out_of_memory_internal.
* elf/dl-dst.h [_RTLD_GLOBAL]: Define _dl_get_origin to use INTUSE.
* sysdeps/generic/dl-origin.c: Undefine _dl_get_origin macro before
function definition. Use INTDEF with _dl_get_origin.
* sysdeps/unix/sysv/linux/dl-origin.c: Likewise.
* elf/dl-init.c: Use INTUSE with _dl_starting_up.
* elf/rtld.c: Likewise. Use INTVARDEF for _dl_starting_up.
* elf/dl-profile.c: Use INTDEF for _dl_mcount.
* elf/dl-runtime.c: Use INTUSE with _dl_mcount.
* sysdeps/generic/ldsodefs.h: Declare _dl_mcount_internal.
* elf/dl-conflict.c: Use rtld_progrname instead of _dl_argv[0].
* elf/dl-deps.c: 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-reloc.c: Likewise.
* elf/dl-version.c: Likewise.
* elf/do-lookup.h: Likewise.
* 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/m68k/dl-machine.h: Likewise.
* sysdeps/powerpc/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/sparc-32/dl-machine.h: Likewise.
* sysdeps/sparc/sparc-64/dl-machine.h: Likewise.
* sysdeps/x86_64/dl-machine.h: Likewise.
* elf/rtld.c: Use INTDEF for _dl_argv. Use rtld_progrname instead of
_dl_argv[0]. Use INTUSE with _dl_argv.
* sysdeps/generic/dl-sysdep.c: Use INTUSE with _dl_argv.
* sysdeps/generic/ldsodefs.h: Define rtld_progname macro.
37 files changed, 224 insertions, 123 deletions
@@ -1,3 +1,64 @@ +2002-03-01 Ulrich Drepper <drepper@redhat.com> + + * elf/Makefile (dl-routines): Add dl-origin. + (elide-routines.os): Add dl-origin. + * elf/Versions [ld] (GLIBC_PRIVATE): Add _dl_get_origin. + * elf/dl-debug.c (_dl_debug_initialize): Add missing INTUSE around + _dl_debug_state. + * include/libc-symbols.c: Define attribute_hidden depending on + HAVE_VISIBILITY_ATTRIBUTE. Add definition of INTVARDEF. + + * elf/dl-deps.c: Use INTUSE with __libc_enable_secure. + * elf/dl-load.c: Likewise. + * elf/rtld.c: Likewise. + * include/unistd.h: Declare __libc_enable_secure_internal. + * sysdeps/generic/dl-sysdep.c: Use INTVARDEF with __libc_enable_secure. + Use INTUSE with __libc_enable_secure. + * sysdeps/mach/hurd/dl-sysdep.c: Likewise. + + * elf/dl-deps.c: Use INTUSE with _dl_out_of_memory. + * elf/dl-error.c: Likewise, + * sysdeps/generic/ldsodefs.h: Declare _dl_out_of_memory_internal. + + * elf/dl-dst.h [_RTLD_GLOBAL]: Define _dl_get_origin to use INTUSE. + * sysdeps/generic/dl-origin.c: Undefine _dl_get_origin macro before + function definition. Use INTDEF with _dl_get_origin. + * sysdeps/unix/sysv/linux/dl-origin.c: Likewise. + + * elf/dl-init.c: Use INTUSE with _dl_starting_up. + * elf/rtld.c: Likewise. Use INTVARDEF for _dl_starting_up. + + * elf/dl-profile.c: Use INTDEF for _dl_mcount. + * elf/dl-runtime.c: Use INTUSE with _dl_mcount. + * sysdeps/generic/ldsodefs.h: Declare _dl_mcount_internal. + + * elf/dl-conflict.c: Use rtld_progrname instead of _dl_argv[0]. + * elf/dl-deps.c: 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-reloc.c: Likewise. + * elf/dl-version.c: Likewise. + * elf/do-lookup.h: Likewise. + * 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/m68k/dl-machine.h: Likewise. + * sysdeps/powerpc/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/sparc-32/dl-machine.h: Likewise. + * sysdeps/sparc/sparc-64/dl-machine.h: Likewise. + * sysdeps/x86_64/dl-machine.h: Likewise. + * elf/rtld.c: Use INTDEF for _dl_argv. Use rtld_progrname instead of + _dl_argv[0]. Use INTUSE with _dl_argv. + * sysdeps/generic/dl-sysdep.c: Use INTUSE with _dl_argv. + * sysdeps/generic/ldsodefs.h: Define rtld_progname macro. + 2002-02-28 Jakub Jelinek <jakub@redhat.com> * elf/rtld.c (_rtld_global): Remove .protected. diff --git a/elf/Makefile b/elf/Makefile index 4ff6f89b64..dd4c787dd1 100644 --- a/elf/Makefile +++ b/elf/Makefile @@ -29,11 +29,11 @@ routines = $(dl-routines) dl-open dl-close dl-support dl-iteratephdr \ # profiled libraries. dl-routines = $(addprefix dl-,load cache lookup object reloc deps \ runtime error init fini debug misc \ - version profile conflict tls) + version profile conflict tls origin) all-dl-routines = $(dl-routines) $(sysdep-dl-routines) # But they are absent from the shared libc, because that code is in ld.so. elide-routines.os = $(all-dl-routines) dl-support enbl-secure \ - dl-iteratephdr-static + dl-iteratephdr-static dl-origin # ld.so uses those routines, plus some special stuff for being the program # interpreter and operating independent of libc. diff --git a/elf/Versions b/elf/Versions index 37d11d87b9..477fd2d220 100644 --- a/elf/Versions +++ b/elf/Versions @@ -50,5 +50,6 @@ ld { _dl_relocate_object; _dl_signal_error; _dl_start_profile; _dl_starting_up; _dl_unload_cache; _rtld_global; _dl_tls_symaddr; _dl_allocate_tls; _dl_deallocate_tls; + _dl_get_origin; } } diff --git a/elf/dl-conflict.c b/elf/dl-conflict.c index bf48acd8a4..07ebfe5378 100644 --- a/elf/dl-conflict.c +++ b/elf/dl-conflict.c @@ -35,7 +35,7 @@ _dl_resolve_conflicts (struct link_map *l, ElfW(Rela) *conflict, { if (__builtin_expect (GL(dl_debug_mask) & DL_DEBUG_RELOC, 0)) _dl_printf ("\nconflict processing: %s\n", - l->l_name[0] ? l->l_name : _dl_argv[0]); + l->l_name[0] ? l->l_name : rtld_progname); { /* Do the conflict relocation of the object and library GOT and other diff --git a/elf/dl-debug.c b/elf/dl-debug.c index 462a21e8a8..e072b685f2 100644 --- a/elf/dl-debug.c +++ b/elf/dl-debug.c @@ -40,7 +40,7 @@ _dl_debug_initialize (ElfW(Addr) ldbase) _r_debug.r_version = 1 /* R_DEBUG_VERSION XXX */; _r_debug.r_ldbase = ldbase; _r_debug.r_map = GL(dl_loaded); - _r_debug.r_brk = (ElfW(Addr)) &_dl_debug_state; + _r_debug.r_brk = (ElfW(Addr)) &INTUSE(_dl_debug_state); } return &_r_debug; diff --git a/elf/dl-deps.c b/elf/dl-deps.c index e79e8f1b7b..6dac54ab23 100644 --- a/elf/dl-deps.c +++ b/elf/dl-deps.c @@ -107,7 +107,7 @@ struct list char *__newp; \ \ /* DST must not appear in SUID/SGID programs. */ \ - if (__libc_enable_secure) \ + if (INTUSE(__libc_enable_secure)) \ INTUSE(_dl_signal_error) (0, __str, NULL, N_("\ DST not allowed in SUID/SGID programs")); \ \ @@ -297,7 +297,7 @@ _dl_map_object_deps (struct link_map *map, " requested by file=%s\n", name, l->l_name[0] - ? l->l_name : _dl_argv[0]); + ? l->l_name : rtld_progname); /* We must be prepared that the addressed shared object is not available. */ @@ -307,7 +307,7 @@ _dl_map_object_deps (struct link_map *map, { /* We are not interested in the error message. */ assert (errstring != NULL); - if (errstring != _dl_out_of_memory) + if (errstring != INTUSE(_dl_out_of_memory)) free ((char *) errstring); /* Simply ignore this error and continue the work. */ @@ -325,7 +325,7 @@ _dl_map_object_deps (struct link_map *map, " requested by file=%s\n", name, l->l_name[0] - ? l->l_name : _dl_argv[0]); + ? l->l_name : rtld_progname); /* For filter objects the dependency must be available. */ err = INTUSE(_dl_catch_error) (&objname, &errstring, diff --git a/elf/dl-dst.h b/elf/dl-dst.h index 615580b481..05bdee5ee9 100644 --- a/elf/dl-dst.h +++ b/elf/dl-dst.h @@ -62,6 +62,11 @@ extern size_t _dl_dst_count_internal (const char *name, int is_path); /* Find origin of the executable. */ extern const char *_dl_get_origin (void); +extern const char *_dl_get_origin_internal (void); + +#ifdef _RTLD_LOCAL +# define _dl_get_origin INTUSE(_dl_get_origin) +#endif /* Prototype for used function. */ extern char *_dl_dst_substitute (struct link_map *l, const char *name, diff --git a/elf/dl-error.c b/elf/dl-error.c index 71088fbe4c..fbb35d242c 100644 --- a/elf/dl-error.c +++ b/elf/dl-error.c @@ -49,6 +49,7 @@ __libc_tsd_define (static, DL_ERROR) variable since we have to avoid freeing it and so have to enable a pointer comparison. See below and in dlfcn/dlerror.c. */ const char _dl_out_of_memory[] = "out of memory"; +INTVARDEF(_dl_out_of_memory) /* This points to a function which is called when an continuable error is @@ -92,7 +93,7 @@ _dl_signal_error (int errcode, const char *objname, const char *occation, { /* This is better than nothing. */ lcatch->objname = ""; - lcatch->errstring = _dl_out_of_memory; + lcatch->errstring = INTUSE(_dl_out_of_memory); } longjmp (lcatch->env, errcode ?: -1); } @@ -101,7 +102,7 @@ _dl_signal_error (int errcode, const char *objname, const char *occation, /* Lossage while resolving the program's own symbols is always fatal. */ char buffer[1024]; _dl_fatal_printf ("%s: %s: %s%s%s%s%s\n", - _dl_argv[0] ?: "<program name unknown>", + rtld_progname ?: "<program name unknown>", occation ?: N_("error while loading shared libraries"), objname, *objname ? ": " : "", errstring, errcode ? ": " : "", diff --git a/elf/dl-fini.c b/elf/dl-fini.c index 5beb24b042..4e2e66e841 100644 --- a/elf/dl-fini.c +++ b/elf/dl-fini.c @@ -148,7 +148,8 @@ _dl_fini (void) /* When debugging print a message first. */ if (__builtin_expect (GL(dl_debug_mask) & DL_DEBUG_IMPCALLS, 0)) INTUSE(_dl_debug_printf) ("\ncalling fini: %s\n\n", - l->l_name[0] ? l->l_name : _dl_argv[0]); + l->l_name[0] + ? l->l_name : rtld_progname); /* 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 a328716bf3..74810feff1 100644 --- a/elf/dl-init.c +++ b/elf/dl-init.c @@ -26,6 +26,7 @@ typedef void (*init_t) (int, char **, char **); /* Flag, nonzero during startup phase. */ extern int _dl_starting_up; +extern int _dl_starting_up_internal attribute_hidden; static void @@ -52,7 +53,7 @@ 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)) INTUSE(_dl_debug_printf) ("\ncalling init: %s\n\n", - l->l_name[0] ? l->l_name : _dl_argv[0]); + l->l_name[0] ? l->l_name : rtld_progname); /* Now run the local constructors. There are two forms of them: - the one named by DT_INIT @@ -108,7 +109,7 @@ _dl_init (struct link_map *main_map, int argc, char **argv, char **env) if (__builtin_expect (GL(dl_debug_mask) & DL_DEBUG_IMPCALLS, 0)) INTUSE(_dl_debug_printf) ("\ncalling preinit: %s\n\n", main_map->l_name[0] - ? main_map->l_name : _dl_argv[0]); + ? main_map->l_name : rtld_progname); addrs = (ElfW(Addr) *) (main_map->l_info[DT_PREINIT_ARRAY]->d_un.d_ptr + main_map->l_addr); @@ -142,6 +143,6 @@ _dl_init (struct link_map *main_map, int argc, char **argv, char **env) INTUSE(_dl_debug_state) (); /* Finished starting up. */ - _dl_starting_up = 0; + INTUSE(_dl_starting_up) = 0; } INTDEF (_dl_init) diff --git a/elf/dl-load.c b/elf/dl-load.c index 2be2083408..b404205d0f 100644 --- a/elf/dl-load.c +++ b/elf/dl-load.c @@ -201,7 +201,7 @@ _dl_dst_count (const char *name, int is_path) is $ORIGIN alone) and it must always appear first in path. */ ++name; if ((len = is_dst (start, name, "ORIGIN", is_path, - __libc_enable_secure)) != 0 + INTUSE(__libc_enable_secure))) != 0 || ((len = is_dst (start, name, "PLATFORM", is_path, 0)) != 0)) ++cnt; @@ -237,7 +237,7 @@ _dl_dst_substitute (struct link_map *l, const char *name, char *result, ++name; if ((len = is_dst (start, name, "ORIGIN", is_path, - __libc_enable_secure)) != 0) + INTUSE(__libc_enable_secure))) != 0) repl = l->l_origin; else if ((len = is_dst (start, name, "PLATFORM", is_path, 0)) != 0) @@ -494,7 +494,7 @@ decompose_rpath (struct r_search_path_struct *sps, /* First see whether we must forget the RUNPATH and RPATH from this object. */ if (__builtin_expect (GL(dl_inhibit_rpath) != NULL, 0) - && !__libc_enable_secure) + && !INTUSE(__libc_enable_secure)) { const char *inhp = GL(dl_inhibit_rpath); @@ -711,7 +711,8 @@ _dl_init_paths (const char *llp) } (void) fillin_rpath (llp_tmp, env_path_list.dirs, ":;", - __libc_enable_secure, "LD_LIBRARY_PATH", NULL); + INTUSE(__libc_enable_secure), "LD_LIBRARY_PATH", + NULL); if (env_path_list.dirs[0] == NULL) { @@ -1268,7 +1269,7 @@ print_search_path (struct r_search_path_elem **list, if (name != NULL) _dl_debug_printf_c ("\t\t(%s from file %s)\n", what, - name[0] ? name : _dl_argv[0]); + name[0] ? name : rtld_progname); else _dl_debug_printf_c ("\t\t(%s)\n", what); } @@ -1542,7 +1543,7 @@ open_path (const char *name, size_t namelen, int preloaded, here_any |= this_dir->status[cnt] == existing; if (fd != -1 && __builtin_expect (preloaded, 0) - && __libc_enable_secure) + && INTUSE(__libc_enable_secure)) { /* This is an extra security effort to make sure nobody can preload broken shared objects which are in the trusted @@ -1649,7 +1650,8 @@ _dl_map_object (struct link_map *loader, const char *name, int preloaded, if (__builtin_expect (GL(dl_debug_mask) & DL_DEBUG_FILES, 0) && loader != NULL) INTUSE(_dl_debug_printf) ("\nfile=%s; needed by %s\n", name, - loader->l_name[0] ? loader->l_name : _dl_argv[0]); + loader->l_name[0] + ? loader->l_name : rtld_progname); if (strchr (name, '/') == NULL) { @@ -1740,7 +1742,8 @@ _dl_map_object (struct link_map *loader, const char *name, int preloaded, } if (fd == -1 - && (__builtin_expect (! preloaded, 1) || ! __libc_enable_secure)) + && (__builtin_expect (! preloaded, 1) + || ! INTUSE(__libc_enable_secure))) { /* Check the list of libraries in the file /etc/ld.so.cache, for compatibility with Linux's ldconfig program. */ diff --git a/elf/dl-lookup.c b/elf/dl-lookup.c index 521f032b2b..f9a229d8ea 100644 --- a/elf/dl-lookup.c +++ b/elf/dl-lookup.c @@ -171,9 +171,9 @@ add_dependency (struct link_map *undef_map, struct link_map * |
