diff options
author | Ulrich Drepper <drepper@redhat.com> | 2004-03-06 08:19:29 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2004-03-06 08:19:29 +0000 |
commit | 154d10bdf1984f4fe28f898e07bc25c5367f443e (patch) | |
tree | 10b4e36bf9d3fd223d680a054e744bf84bb66212 /sysdeps/generic | |
parent | dd70526e8a07e95336ee87e1d968deafa8b5f34c (diff) | |
download | glibc-154d10bdf1984f4fe28f898e07bc25c5367f443e.zip glibc-154d10bdf1984f4fe28f898e07bc25c5367f443e.tar.gz glibc-154d10bdf1984f4fe28f898e07bc25c5367f443e.tar.bz2 |
Update.
* elf/Versions: Remove functions which are not exported anymore.
* dlfcn/dlerror.c: Call ld.so functions through GLSO.
* dlfcn/dlinfo.c: Likewise.
* elf/dl-close.c: Likewise.
* elf/dl-libc.c: Likewise.
* elf/dl-open.c: Likewise.
* elf/dl-sym.c: Likewise.
* sysdeps/generic/libc-start.c: Likewise.
* elf/dl-debug.c: Remove *_internal definition. Don't use INTUSE for
functions which are not exported anymore.
* 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-profile.c: Likewise.
* elf/dl-profstub.c: Likewise.
* elf/dl-reloc.c: Likewise.
* elf/dl-runtime.c: Likewise.
* elf/dl-version.c: Likewise.
* elf/do-lookup.h: Likewise.
* include/dlfcn.h: Likewise.
* sysdeps/generic/dl-cache.c: Likewise.
* sysdeps/generic/dl-fptr.c: Likewise.
* sysdeps/generic/dl-origin.c: Likewise.
* sysdeps/generic/dl-sysdep.c: Likewise.
* sysdeps/generic/dl-tls.c: Likewise.
* sysdeps/generic/ldsodefs.h: Likewise.
* sysdeps/i386/dl-tls.h: Likewise.
* sysdeps/unix/sysv/linux/dl-origin.c: Likewise.
* elf/rtld.c: Likewise. Export function though _rtld_global_ro.
* generic/dl-fptr.c: Likewise.
* mach/hurd/dl-sysdep.c: Likewise.
* unix/sysv/linux/ia64/dl-static.c: Likewise.
* unix/sysv/linux/ia64/getpagesize.c: Likewise.
* unix/sysv/linux/m68k/getpagesize.c: Likewise.
* unix/sysv/linux/sparc/sparc32/getpagesize.c: Likewise.
Diffstat (limited to 'sysdeps/generic')
-rw-r--r-- | sysdeps/generic/dl-cache.c | 5 | ||||
-rw-r--r-- | sysdeps/generic/dl-fptr.c | 20 | ||||
-rw-r--r-- | sysdeps/generic/dl-origin.c | 2 | ||||
-rw-r--r-- | sysdeps/generic/dl-sysdep.c | 4 | ||||
-rw-r--r-- | sysdeps/generic/dl-tls.c | 28 | ||||
-rw-r--r-- | sysdeps/generic/ldsodefs.h | 128 | ||||
-rw-r--r-- | sysdeps/generic/libc-start.c | 4 |
7 files changed, 93 insertions, 98 deletions
diff --git a/sysdeps/generic/dl-cache.c b/sysdeps/generic/dl-cache.c index 5a44148..2861dc2 100644 --- a/sysdeps/generic/dl-cache.c +++ b/sysdeps/generic/dl-cache.c @@ -188,7 +188,7 @@ _dl_load_cache_lookup (const char *name) /* Print a message if the loading of libs is traced. */ if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_LIBS, 0)) - INTUSE(_dl_debug_printf) (" search cache=%s\n", LD_SO_CACHE); + _dl_debug_printf (" search cache=%s\n", LD_SO_CACHE); if (cache == NULL) { @@ -291,7 +291,7 @@ _dl_load_cache_lookup (const char *name) /* Print our result if wanted. */ if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_LIBS, 0) && best != NULL) - INTUSE(_dl_debug_printf) (" trying file=%s\n", best); + _dl_debug_printf (" trying file=%s\n", best); return best; } @@ -310,5 +310,4 @@ _dl_unload_cache (void) cache = NULL; } } -INTDEF (_dl_unload_cache) #endif diff --git a/sysdeps/generic/dl-fptr.c b/sysdeps/generic/dl-fptr.c index 1ed4637..78beecf 100644 --- a/sysdeps/generic/dl-fptr.c +++ b/sysdeps/generic/dl-fptr.c @@ -1,5 +1,5 @@ /* Manage function descriptors. Generic version. - Copyright (C) 1999,2000,2001,2002,2003 Free Software Foundation, Inc. + Copyright (C) 1999,2000,2001,2002,2003,2004 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 @@ -80,12 +80,12 @@ new_fdesc_table (struct local *l, size_t *size) if (! COMPARE_AND_SWAP (&l->npages, old_npages, new_npages)) return (struct fdesc_table *) NULL; - *size = old_npages * GL(dl_pagesize); + *size = old_npages * GLRO(dl_pagesize); new_table = __mmap (NULL, *size, PROT_READ | PROT_WRITE, MAP_ANON | MAP_PRIVATE, -1, 0); if (new_table == MAP_FAILED) - INTUSE(_dl_signal_error) (errno, NULL, NULL, - N_("cannot map pages for fdesc table")); + _dl_signal_error (errno, NULL, NULL, + N_("cannot map pages for fdesc table")); new_table->len = (*size - sizeof (*new_table)) / sizeof (struct fdesc); @@ -178,8 +178,8 @@ make_fptr_table (struct link_map *map) afterwards... */ len = ((strtab - (char *) symtab) / map->l_info[DT_SYMENT]->d_un.d_val); - size = ((len * sizeof (fptr_table[0]) + GL(dl_pagesize) - 1) - & -GL(dl_pagesize)); + size = ((len * sizeof (fptr_table[0]) + GLRO(dl_pagesize) - 1) + & -GLRO(dl_pagesize)); /* XXX We don't support here in the moment systems without MAP_ANON. There probably are none for IA-64. In case this is proven wrong we will have to open /dev/null here and use the file descriptor @@ -188,8 +188,8 @@ make_fptr_table (struct link_map *map) PROT_READ | PROT_WRITE, MAP_ANON | MAP_PRIVATE, -1, 0); if (fptr_table == MAP_FAILED) - INTUSE(_dl_signal_error) (errno, NULL, NULL, - N_("cannot map pages for fptr table")); + _dl_signal_error (errno, NULL, NULL, + N_("cannot map pages for fptr table")); if (COMPARE_AND_SWAP ((ElfW(Addr) *) &map->l_mach.fptr_table, (ElfW(Addr)) NULL, (ElfW(Addr)) fptr_table)) @@ -217,8 +217,8 @@ _dl_make_fptr (struct link_map *map, const ElfW(Sym) *sym, symidx = sym - symtab; if (symidx >= map->l_mach.fptr_table_len) - INTUSE(_dl_signal_error) (0, NULL, NULL, N_("\ -internal error: symidx out of range of fptr table")); + _dl_signal_error (0, NULL, NULL, + N_("internal error: symidx out of range of fptr table")); while (ftab[symidx] == 0) { diff --git a/sysdeps/generic/dl-origin.c b/sysdeps/generic/dl-origin.c index 4837c2e..8761937 100644 --- a/sysdeps/generic/dl-origin.c +++ b/sysdeps/generic/dl-origin.c @@ -26,7 +26,6 @@ #include <dl-dst.h> -#undef _dl_get_origin const char * _dl_get_origin (void) { @@ -50,4 +49,3 @@ _dl_get_origin (void) return result; } -INTDEF(_dl_get_origin) diff --git a/sysdeps/generic/dl-sysdep.c b/sysdeps/generic/dl-sysdep.c index e9eccd5..3447f4c 100644 --- a/sysdeps/generic/dl-sysdep.c +++ b/sysdeps/generic/dl-sysdep.c @@ -416,8 +416,8 @@ _dl_important_hwcaps (const char *platform, size_t platform_len, size_t *sz, #ifndef USE_TLS no_memory: #endif - INTUSE(_dl_signal_error) (ENOMEM, NULL, NULL, - N_("cannot create capability list")); + _dl_signal_error (ENOMEM, NULL, NULL, + N_("cannot create capability list")); } if (cnt == 1) diff --git a/sysdeps/generic/dl-tls.c b/sysdeps/generic/dl-tls.c index e0ffcc0..4fe67da 100644 --- a/sysdeps/generic/dl-tls.c +++ b/sysdeps/generic/dl-tls.c @@ -1,5 +1,5 @@ /* Thread-local storage handling in the ELF dynamic linker. Generic version. - Copyright (C) 2002, 2003 Free Software Foundation, Inc. + Copyright (C) 2002, 2003, 2004 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 @@ -505,32 +505,6 @@ rtld_hidden_def (_dl_deallocate_tls) # ifndef GET_ADDR_OFFSET # define GET_ADDR_OFFSET ti->ti_offset # endif -/* Systems which do not have tls_index also probably have to define - DONT_USE_TLS_INDEX. */ - -# ifndef __TLS_GET_ADDR -# define __TLS_GET_ADDR __tls_get_addr -# endif - - -/* Return the symbol address given the map of the module it is in and - the symbol record. This is used in dl-sym.c. */ -void * -internal_function -_dl_tls_symaddr (struct link_map *map, const ElfW(Sym) *ref) -{ -# ifndef DONT_USE_TLS_INDEX - tls_index tmp = - { - .ti_module = map->l_tls_modid, - .ti_offset = ref->st_value - }; - - return __TLS_GET_ADDR (&tmp); -# else - return __TLS_GET_ADDR (map->l_tls_modid, ref->st_value); -# endif -} static void * diff --git a/sysdeps/generic/ldsodefs.h b/sysdeps/generic/ldsodefs.h index 98294cb..e6e144f 100644 --- a/sysdeps/generic/ldsodefs.h +++ b/sysdeps/generic/ldsodefs.h @@ -447,14 +447,74 @@ struct rtld_global_ro #endif #ifdef SHARED + /* We add a function table to _rtld_global which is then used to + call the function instead of going through the PLT. The result + is that we can avoid exporting the functions and we do not jump + PLT relocations in libc.so. */ + const char *(*_dl_get_origin) (void); + size_t (*_dl_dst_count) (const char *, int); + char *(*_dl_dst_substitute) (struct link_map *, const char *, char *, int); + struct link_map *(internal_function *_dl_map_object) (struct link_map *, + const char *, int, + int, int, int); + void (internal_function *_dl_map_object_deps) (struct link_map *, + struct link_map **, + unsigned int, int, int); + void (*_dl_relocate_object) (struct link_map *, struct r_scope_elem *[], + int, int); + int (internal_function *_dl_check_map_versions) (struct link_map *, int, + int); + void (internal_function *_dl_init) (struct link_map *, int, char **, + char **); + void (*_dl_debug_state) (void); +#ifndef MAP_COPY + void (*_dl_unload_cache) (void); +#endif + void (*_dl_debug_printf) (const char *, ...) + __attribute__ ((__format__ (__printf__, 1, 2))); + int (internal_function *_dl_catch_error) (const char **, const char **, + void (*) (void *), void *); + void (internal_function *_dl_signal_error) (int, const char *, const char *, + const char *); + void (internal_function *_dl_start_profile) (struct link_map *, + const char *); + void (*_dl_mcount) (ElfW(Addr) frompc, ElfW(Addr) selfpc); + lookup_t (internal_function *_dl_lookup_symbol) (const char *, + struct link_map *, + const ElfW(Sym) **, + struct r_scope_elem *[], + int, int); + lookup_t (internal_function *_dl_lookup_versioned_symbol) (const char *, + struct link_map *, + const ElfW(Sym) **, + struct r_scope_elem *[], + const struct r_found_version *, + int, int); + lookup_t (internal_function *_dl_lookup_symbol_skip) (const char *, + struct link_map *, + const ElfW(Sym) **, + struct r_scope_elem *[], + struct link_map *); + lookup_t (internal_function *_dl_lookup_versioned_symbol_skip) (const char *, + struct link_map *, + const ElfW(Sym) **, + struct r_scope_elem *[], + const struct r_found_version *, + struct link_map *); + }; # define __rtld_global_attribute__ # ifdef IS_IN_rtld extern struct rtld_global_ro _rtld_local_ro attribute_relro __rtld_local_attribute__; -# endif extern struct rtld_global_ro _rtld_global_ro attribute_relro __rtld_global_attribute__; +# else +/* We cheat a bit here. We declare the variable as as const even + though it is at startup. */ +extern const struct rtld_global_ro _rtld_global_ro + attribute_relro __rtld_global_attribute__; +# endif #endif #undef EXTERN @@ -518,10 +578,7 @@ extern int _dl_sysdep_open_zero_fill (void); /* dl-sysdep.c */ interpreted as for a `printf' call. All the lines start with a 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))) - attribute_hidden; + __attribute__ ((__format__ (__printf__, 1, 2))) attribute_hidden; /* Write message on the debug file descriptor. The parameters are interpreted as for a `printf' call. All the lines buf the first @@ -564,11 +621,6 @@ extern void _dl_dprintf (int fd, const char *fmt, ...) problem. */ 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__)) attribute_hidden; /* Like _dl_signal_error, but may return when called in the context of @@ -594,12 +646,6 @@ extern void _dl_receive_error (receiver_fct fct, void (*operate) (void *), 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 attribute_hidden; /* Call _dl_map_object on the dependencies of MAP, and set up @@ -610,11 +656,6 @@ extern void _dl_map_object_deps (struct link_map *map, struct link_map **preloads, unsigned int npreloads, int trace_mode, int open_mode) - internal_function; -extern void _dl_map_object_deps_internal (struct link_map *map, - struct link_map **preloads, - unsigned int npreloads, - int trace_mode, int open_mode) internal_function attribute_hidden; /* Cache the locations of MAP's hash table. */ @@ -646,12 +687,6 @@ extern lookup_t _dl_lookup_symbol (const char *undef, const ElfW(Sym) **sym, struct r_scope_elem *symbol_scope[], int type_class, int flags) - 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 *symbolscope[], - int type_class, int flags) internal_function attribute_hidden; enum @@ -670,14 +705,6 @@ extern lookup_t _dl_lookup_versioned_symbol (const char *undef, struct r_scope_elem *symbol_scope[], 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 attribute_hidden; /* For handling RTLD_NEXT we must be able to skip shared objects. */ @@ -713,10 +740,7 @@ extern struct link_map *_dl_new_object (char *realname, const char *libname, If LAZY is nonzero, don't relocate its PLT. */ 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) + int lazy, int consider_profiling) attribute_hidden; /* Protect PT_GNU_RELRO area. */ @@ -750,7 +774,7 @@ extern int _dl_check_map_versions (struct link_map *map, int verbose, /* Initialize the object in SCOPE by calling the constructors with ARGC, ARGV, and ENV as the parameters. */ extern void _dl_init (struct link_map *main_map, int argc, char **argv, - char **env) internal_function; + char **env) internal_function attribute_hidden; /* Call the finalizer functions of all shared objects whose initializer functions have completed. */ @@ -760,8 +784,7 @@ extern void _dl_fini (void) internal_function; any shared object mappings. The `r_state' member of `struct r_debug' 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) attribute_hidden; +extern void _dl_debug_state (void) attribute_hidden; /* 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 @@ -775,9 +798,6 @@ extern void _dl_init_paths (const char *library_path) internal_function; /* Gather the information needed to install the profiling tables and start 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 attribute_hidden; /* The actual functions used to keep book on the calls. */ @@ -813,8 +833,7 @@ extern const char *_dl_load_cache_lookup (const char *name) all the time since this would create problems when the file is replaced. 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) attribute_hidden; +extern void _dl_unload_cache (void) attribute_hidden; /* System-dependent function to read a file's whole contents in the most convenient manner available. *SIZEP gets the size of the @@ -871,15 +890,20 @@ rtld_hidden_proto (_dl_allocate_tls_init) extern void _dl_deallocate_tls (void *tcb, bool dealloc_tcb) internal_function; rtld_hidden_proto (_dl_deallocate_tls) -/* Return the symbol address given the map of the module it is in and - the symbol record. */ -extern void *_dl_tls_symaddr (struct link_map *map, const ElfW(Sym) *ref) - internal_function; - #if defined USE_TLS extern void _dl_nothread_init_static_tls (struct link_map *) attribute_hidden; #endif +/* Find origin of the executable. */ +extern const char *_dl_get_origin (void) attribute_hidden; + +/* Count DSTs. */ +extern size_t _dl_dst_count (const char *name, int is_path) attribute_hidden; + +/* Substitute DST values. */ +extern char *_dl_dst_substitute (struct link_map *l, const char *name, + char *result, int is_path) attribute_hidden; + __END_DECLS #endif /* ldsodefs.h */ diff --git a/sysdeps/generic/libc-start.c b/sysdeps/generic/libc-start.c index 9edbf8e..b92ab04 100644 --- a/sysdeps/generic/libc-start.c +++ b/sysdeps/generic/libc-start.c @@ -174,7 +174,7 @@ LIBC_START_MAIN (int (*main) (int, char **, char ** MAIN_AUXVEC_DECL), /* Call the initializer of the program, if any. */ #ifdef SHARED if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_IMPCALLS, 0)) - _dl_debug_printf ("\ninitialize program: %s\n\n", argv[0]); + GLRO(dl_debug_printf) ("\ninitialize program: %s\n\n", argv[0]); #endif if (init) (*init) ( @@ -185,7 +185,7 @@ LIBC_START_MAIN (int (*main) (int, char **, char ** MAIN_AUXVEC_DECL), #ifdef SHARED if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_IMPCALLS, 0)) - _dl_debug_printf ("\ntransferring control: %s\n\n", argv[0]); + GLRO(dl_debug_printf) ("\ntransferring control: %s\n\n", argv[0]); #endif #ifdef HAVE_CLEANUP_JMP_BUF |