diff options
author | Ulrich Drepper <drepper@redhat.com> | 2002-01-31 03:41:25 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2002-01-31 03:41:25 +0000 |
commit | d6b5d570a3255d8dc80e07c3674594574cd98fe7 (patch) | |
tree | 36e05b0d065614559820d2a4f43bb1076ea5cfa1 /sysdeps/generic | |
parent | 1b4575aefaaa43adfed4658f7d66de587f12120e (diff) | |
download | glibc-d6b5d570a3255d8dc80e07c3674594574cd98fe7.tar.gz glibc-d6b5d570a3255d8dc80e07c3674594574cd98fe7.tar.xz glibc-d6b5d570a3255d8dc80e07c3674594574cd98fe7.zip |
Update.
2002-01-30 Ulrich Drepper <drepper@redhat.com> * Versions.def [ld]: Add GLIBC_2.3. * elf/dl-addr.c: Move global variables for SHARED code in struct _rtld_global. Export this struct, remove all exports for the signal variables. * elf/dl-close.c: Likewise. * elf/dl-conflict.c: Likewise. * 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-iteratephdr.c: Likewise. * elf/dl-libc.c: Likewise. * elf/dl-load.c: Likewise. * elf/dl-lookup.c: Likewise. * elf/dl-minimal.c: Likewise. * elf/dl-object.c: Likewise. * elf/dl-open.c: Likewise. * elf/dl-profile.c: Likewise. * elf/dl-profstub.c: Likewise. * elf/dl-reloc.c: Likewise. * elf/dl-runtime.c: Likewise. * elf/dl-support.c: Likewise. * elf/dl-sym.c: Likewise. * elf/dl-version.c: Likewise. * elf/do-lookup.h: Likewise. * elf/do-rel.h: Likewise. * elf/dynamic-link.h: Likewise. * elf/rtld.c: Likewise. * sysdeps/generic/dl-cache.c: Likewise. * sysdeps/generic/dl-sysdep.c: Likewise. * sysdeps/generic/ldsodefs.h: Likewise. * sysdeps/generic/libc-start.c: Likewise. * sysdeps/i386/dl-machine.h: Likewise. * sysdeps/ia64/dl-fptr.c: Likewise. * sysdeps/ia64/dl-machine.h: Likewise. * sysdeps/unix/sysv/linux/dl-librecon.h: Likewise. * sysdeps/unix/sysv/linux/dl-origin.c: Likewise. * sysdeps/unix/sysv/linux/dl-osinfo.h: Likewise. * sysdeps/unix/sysv/linux/getclktck.c: Likewise. * sysdeps/unix/sysv/linux/getpagesize.c: Likewise. * sysdeps/unix/sysv/linux/i386/dl-librecon.h: Likewise. * sysdeps/unix/sysv/linux/ia64/dl-static.c: Likewise. * sysdeps/unix/sysv/linux/ia64/getpagesize.c: Likewise. * malloc/thread-m.h: Spinlock definitions for x86/x86_64.
Diffstat (limited to 'sysdeps/generic')
-rw-r--r-- | sysdeps/generic/dl-cache.c | 17 | ||||
-rw-r--r-- | sysdeps/generic/dl-sysdep.c | 29 | ||||
-rw-r--r-- | sysdeps/generic/ldsodefs.h | 168 | ||||
-rw-r--r-- | sysdeps/generic/libc-start.c | 6 |
4 files changed, 132 insertions, 88 deletions
diff --git a/sysdeps/generic/dl-cache.c b/sysdeps/generic/dl-cache.c index 6ed26a3b7b..7ba00e46f7 100644 --- a/sysdeps/generic/dl-cache.c +++ b/sysdeps/generic/dl-cache.c @@ -1,5 +1,5 @@ /* Support for reading /etc/ld.so.cache files written by Linux ldconfig. - Copyright (C) 1996,1997,1998,1999,2000,2001 Free Software Foundation, Inc. + Copyright (C) 1996,1997,1998,1999,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 @@ -26,8 +26,6 @@ #include <stdio-common/_itoa.h> -extern const char *_dl_platform; - #ifndef _DL_PLATFORMS_COUNT # define _DL_PLATFORMS_COUNT 0 #endif @@ -154,7 +152,7 @@ _dl_load_cache_lookup (const char *name) const char *best; /* Print a message if the loading of libs is traced. */ - if (__builtin_expect (_dl_debug_mask & DL_DEBUG_LIBS, 0)) + if (__builtin_expect (GL(dl_debug_mask) & DL_DEBUG_LIBS, 0)) _dl_debug_printf (" search cache=%s\n", LD_SO_CACHE); if (cache == NULL) @@ -213,7 +211,9 @@ _dl_load_cache_lookup (const char *name) /* This file ends in static libraries where we don't have a hwcap. */ unsigned long int *hwcap; uint64_t platform; +#ifndef SHARED weak_extern (_dl_hwcap); +#endif /* This is where the strings start. */ cache_data = (const char *) cache_new; @@ -221,14 +221,15 @@ _dl_load_cache_lookup (const char *name) /* Now we can compute how large the string table is. */ cache_data_size = (const char *) cache + cachesize - cache_data; - hwcap = &_dl_hwcap; - platform = _dl_string_platform (_dl_platform); + hwcap = &GL(dl_hwcap); + platform = _dl_string_platform (GL(dl_platform)); if (platform != -1) platform = 1ULL << platform; /* Only accept hwcap if it's for the right platform. */ #define HWCAP_CHECK \ - if (_dl_osversion && cache_new->libs[middle].osversion > _dl_osversion) \ + if (GL(dl_osversion) \ + && cache_new->libs[middle].osversion > GL(dl_osversion)) \ continue; \ if (_DL_PLATFORMS_COUNT && platform != -1 \ && (lib->hwcap & _DL_HWCAP_PLATFORM) != 0 \ @@ -253,7 +254,7 @@ _dl_load_cache_lookup (const char *name) } /* Print our result if wanted. */ - if (__builtin_expect (_dl_debug_mask & DL_DEBUG_LIBS, 0) && best != NULL) + if (__builtin_expect (GL(dl_debug_mask) & DL_DEBUG_LIBS, 0) && best != NULL) _dl_debug_printf (" trying file=%s\n", best); return best; diff --git a/sysdeps/generic/dl-sysdep.c b/sysdeps/generic/dl-sysdep.c index 8d182be9e9..2954b3309f 100644 --- a/sysdeps/generic/dl-sysdep.c +++ b/sysdeps/generic/dl-sysdep.c @@ -1,5 +1,5 @@ /* Operating system support for run-time dynamic linker. Generic Unix version. - 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 @@ -38,14 +38,7 @@ #include <dl-osinfo.h> #include <hp-timing.h> -extern int _dl_argc; -extern char **_dl_argv; extern char **_environ; -extern size_t _dl_pagesize; -extern int _dl_clktck; -extern const char *_dl_platform; -extern unsigned long int _dl_hwcap; -extern size_t _dl_platformlen; extern fpu_control_t _dl_fpu_control; extern void _end; @@ -61,7 +54,7 @@ int __libc_multiple_libcs = 0; /* Defining this here avoids the inclusion /* This variable contains the lowest stack address ever used. */ void *__libc_stack_end; static ElfW(auxv_t) *_dl_auxv; -unsigned long int _dl_hwcap_mask = HWCAP_IMPORTANT; +//Xunsigned long int _dl_hwcap_mask = HWCAP_IMPORTANT; #if HP_TIMING_AVAIL hp_timing_t _dl_cpuclock_offset; #endif @@ -109,7 +102,7 @@ _dl_sysdep_start (void **start_argptr, _dl_auxv); user_entry = (ElfW(Addr)) ENTRY_POINT; - _dl_platform = NULL; /* Default to nothing known about the platform. */ + GL(dl_platform) = NULL; /* Default to nothing known about the platform. */ for (av = _dl_auxv; av->a_type != AT_NULL; set_seen (av++)) switch (av->a_type) @@ -121,7 +114,7 @@ _dl_sysdep_start (void **start_argptr, phnum = av->a_un.a_val; break; case AT_PAGESZ: - _dl_pagesize = av->a_un.a_val; + GL(dl_pagesize) = av->a_un.a_val; break; case AT_ENTRY: user_entry = av->a_un.a_val; @@ -144,13 +137,13 @@ _dl_sysdep_start (void **start_argptr, egid = av->a_un.a_val; break; case AT_PLATFORM: - _dl_platform = av->a_un.a_ptr; + GL(dl_platform) = av->a_un.a_ptr; break; case AT_HWCAP: - _dl_hwcap = av->a_un.a_val; + GL(dl_hwcap) = av->a_un.a_val; break; case AT_CLKTCK: - _dl_clktck = av->a_un.a_val; + GL(dl_clktck) = av->a_un.a_val; break; case AT_FPUCW: _dl_fpu_control = av->a_un.a_val; @@ -188,8 +181,8 @@ _dl_sysdep_start (void **start_argptr, #endif /* Determine the length of the platform name. */ - if (_dl_platform != NULL) - _dl_platformlen = strlen (_dl_platform); + if (GL(dl_platform) != NULL) + GL(dl_platformlen) = strlen (GL(dl_platform)); if (__sbrk (0) == &_end) /* The dynamic linker was run as a program, and so the initial break @@ -197,7 +190,7 @@ _dl_sysdep_start (void **start_argptr, will consume the rest of this page, so tell the kernel to move the break up that far. When the user program examines its break, it will see this new value and not clobber our data. */ - __sbrk (_dl_pagesize - ((&_end - (void *) 0) & (_dl_pagesize - 1))); + __sbrk (GL(dl_pagesize) - ((&_end - (void *) 0) & (GL(dl_pagesize) - 1))); /* If this is a SUID program we make sure that FDs 0, 1, and 2 are allocated. If necessary we are doing it ourself. If it is not @@ -288,7 +281,7 @@ _dl_important_hwcaps (const char *platform, size_t platform_len, size_t *sz, size_t *max_capstrlen) { /* Determine how many important bits are set. */ - unsigned long int masked = _dl_hwcap & _dl_hwcap_mask; + unsigned long int masked = GL(dl_hwcap) & GL(dl_hwcap_mask); size_t cnt = platform != NULL; size_t n, m; size_t total; diff --git a/sysdeps/generic/ldsodefs.h b/sysdeps/generic/ldsodefs.h index 837d32d0ca..52303327c0 100644 --- a/sysdeps/generic/ldsodefs.h +++ b/sysdeps/generic/ldsodefs.h @@ -1,5 +1,5 @@ /* Run-time dynamic linker data structures for loaded ELF shared objects. - Copyright (C) 1995-1999, 2000, 2001 Free Software Foundation, Inc. + Copyright (C) 1995-1999, 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 @@ -29,6 +29,7 @@ #include <elf.h> #include <dlfcn.h> +#include <sys/mman.h> #include <link.h> #include <dl-lookupcfg.h> #include <bits/libc-lock.h> @@ -189,29 +190,35 @@ typedef void (*receiver_fct) (int, const char *, const char *); user interface to run-time dynamic linking. */ -/* Parameters passed to the dynamic linker. */ -extern char **_dl_argv; - -/* Cached value of `getpagesize ()'. */ -extern size_t _dl_pagesize; - -/* OS version. */ -extern unsigned int _dl_osversion; - -/* File descriptor referring to the zero-fill device. */ -extern int _dl_zerofd; - -/* Name of the shared object to be profiled (if any). */ -extern const char *_dl_profile; -/* Map of shared object to be profiled. */ -extern struct link_map *_dl_profile_map; -/* Filename of the output file. */ -extern const char *_dl_profile_output; -/* Map of shared object to be prelink traced. */ -extern struct link_map *_dl_trace_prelink_map; - -/* If nonzero the appropriate debug information is printed. */ -extern int _dl_debug_mask; +#ifndef SHARED +# define EXTERN extern +# define GL(name) _##name +#else +# define EXTERN +# define GL(name) _rtld_global._##name +struct rtld_global +{ +#endif + /* Don't change the order of the following elements. 'dl_loaded' + must remain the first element. Forever. */ + + /* And a pointer to the map for the main map. */ + EXTERN struct link_map *_dl_loaded; + /* Number of object in the _dl_loaded list. */ + EXTERN unsigned int _dl_nloaded; + /* Array representing global scope. */ + EXTERN struct r_scope_elem *_dl_global_scope[2]; + /* Direct pointer to the searchlist of the main object. */ + EXTERN struct r_scope_elem *_dl_main_searchlist; + /* Copy of the content of `_dl_main_searchlist'. */ + EXTERN struct r_scope_elem _dl_initial_searchlist; + /* This is zero at program start to signal that the global scope map is + allocated by rtld. Later it keeps the size of the map. It might be + reset if in _dl_close if the last global object is removed. */ + EXTERN size_t _dl_global_scope_alloc; + + /* If nonzero the appropriate debug information is printed. */ + EXTERN int _dl_debug_mask; #define DL_DEBUG_LIBS (1 << 0) #define DL_DEBUG_IMPCALLS (1 << 1) #define DL_DEBUG_BINDINGS (1 << 2) @@ -224,33 +231,94 @@ extern int _dl_debug_mask; #define DL_DEBUG_HELP (1 << 8) #define DL_DEBUG_PRELINK (1 << 9) -/* Expect cache ID. */ -extern int _dl_correct_cache_id; + /* Cached value of `getpagesize ()'. */ + EXTERN size_t _dl_pagesize; -/* Mask for hardware capabilities that are available. */ -extern unsigned long int _dl_hwcap; + /* OS version. */ + EXTERN unsigned int _dl_osversion; + /* Platform name. */ + EXTERN const char *_dl_platform; + EXTERN size_t _dl_platformlen; -/* Mask for important hardware capabilities we honour. */ -extern unsigned long int _dl_hwcap_mask; +#ifndef MAP_ANON + /* File descriptor referring to the zero-fill device. */ + EXTERN int _dl_zerofd; +#endif -/* File descriptor to write debug messages to. */ -extern int _dl_debug_fd; + /* CLK_TCK as reported by the kernel. */ + EXTERN int _dl_clktck; -/* Names of shared object for which the RPATH should be ignored. */ -extern const char *_dl_inhibit_rpath; + /* If nonzero print warnings messages. */ + EXTERN int _dl_verbose; -/* Nonzero if references should be treated as weak during runtime linking. */ -extern int _dl_dynamic_weak; + /* Nonzero if runtime lookups should not update the .got/.plt. */ + EXTERN int _dl_bind_not; + + /* The object to be initialized first. */ + EXTERN struct link_map *_dl_initfirst; + + /* Name of the shared object to be profiled (if any). */ + EXTERN const char *_dl_profile; + /* Map of shared object to be profiled. */ + EXTERN struct link_map *_dl_profile_map; + /* Filename of the output file. */ + EXTERN const char *_dl_profile_output; + /* Map of shared object to be prelink traced. */ + EXTERN struct link_map *_dl_trace_prelink_map; + /* Name of the object we want to trace the prelinking. */ + EXTERN const char *_dl_trace_prelink; + + /* Expect cache ID. */ + EXTERN int _dl_correct_cache_id; + + /* Counters for the number of relocations performed. */ + EXTERN unsigned long int _dl_num_relocations; + EXTERN unsigned long int _dl_num_cache_relocations; + + /* Mask for hardware capabilities that are available. */ + EXTERN unsigned long int _dl_hwcap; + + /* Mask for important hardware capabilities we honour. */ + EXTERN unsigned long int _dl_hwcap_mask; + + /* Names of shared object for which the RPATH should be ignored. */ + EXTERN const char *_dl_inhibit_rpath; + + /* Location of the binary. */ + EXTERN const char *_dl_origin_path; + + /* List of search directories. */ + EXTERN struct r_search_path_elem *_dl_all_dirs; + EXTERN struct r_search_path_elem *_dl_init_all_dirs; + + /* Structure describing the dynamic linker itself. */ + EXTERN struct link_map _dl_rtld_map; +#ifdef SHARED +}; +extern struct rtld_global _rtld_global; +#endif +#undef EXTERN + +/* Parameters passed to the dynamic linker. */ +extern int _dl_argc; +extern char **_dl_argv; + +/* Do we do lazy relocations? */ +extern int _dl_lazy; /* The array with message we print as a last resort. */ extern const char _dl_out_of_memory[]; -/* Nonzero if runtime lookups should not update the .got/.plt. */ -extern int _dl_bind_not; +/* File descriptor to write debug messages to. */ +extern int _dl_debug_fd; + +/* Nonzero if references should be treated as weak during runtime + linking. + + XXX Once we can set the default for this variable to zero move it + into _rtld_global. */ +extern int _dl_dynamic_weak; -/* List of search directories. */ -extern struct r_search_path_elem *_dl_all_dirs; -extern struct r_search_path_elem *_dl_init_all_dirs; /* OS-dependent function to open the zero-fill device. */ extern int _dl_sysdep_open_zero_fill (void); /* dl-sysdep.c */ @@ -400,24 +468,6 @@ extern lookup_t _dl_lookup_versioned_symbol_skip (const char *undef, extern ElfW(Addr) _dl_symbol_value (struct link_map *map, const char *name) internal_function; - -/* Structure describing the dynamic linker itself. */ -extern struct link_map _dl_rtld_map; -/* And a pointer to the map for the main map. */ -extern struct link_map *_dl_loaded; -/* Number of object in the _dl_loaded list. */ -extern unsigned int _dl_nloaded; -/* Array representing global scope. */ -extern struct r_scope_elem *_dl_global_scope[2]; -/* Direct pointer to the searchlist of the main object. */ -extern struct r_scope_elem *_dl_main_searchlist; -/* Copy of the content of `_dl_main_searchlist'. */ -extern struct r_scope_elem _dl_initial_searchlist; -/* This is zero at program start to signal that the global scope map is - allocated by rtld. Later it keeps the size of the map. It might be - reset if in _dl_close if the last global object is removed. */ -extern size_t _dl_global_scope_alloc; - /* Allocate a `struct link_map' for a new object being loaded, and enter it into the _dl_main_map list. */ extern struct link_map *_dl_new_object (char *realname, const char *libname, diff --git a/sysdeps/generic/libc-start.c b/sysdeps/generic/libc-start.c index 71aef46731..4d1748614e 100644 --- a/sysdeps/generic/libc-start.c +++ b/sysdeps/generic/libc-start.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc. +/* Copyright (C) 1998, 1999, 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 @@ -115,14 +115,14 @@ BP_SYM (__libc_start_main) (int (*main) (int, char **, char **), /* Call the initializer of the program, if any. */ #ifdef SHARED - if (__builtin_expect (_dl_debug_mask & DL_DEBUG_IMPCALLS, 0)) + if (__builtin_expect (GL(dl_debug_mask) & DL_DEBUG_IMPCALLS, 0)) _dl_debug_printf ("\ninitialize program: %s\n\n", argv[0]); #endif if (init) (*init) (); #ifdef SHARED - if (__builtin_expect (_dl_debug_mask & DL_DEBUG_IMPCALLS, 0)) + if (__builtin_expect (GL(dl_debug_mask) & DL_DEBUG_IMPCALLS, 0)) _dl_debug_printf ("\ntransferring control: %s\n\n", argv[0]); #endif |