diff options
author | Ulrich Drepper <drepper@redhat.com> | 2002-02-01 01:33:04 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2002-02-01 01:33:04 +0000 |
commit | 5688da55372193e5941f0240e6ea759d28483970 (patch) | |
tree | 07e201b5db41088611a28d339926c7a953fa7391 /sysdeps | |
parent | a204ea3607d148c7b83dec5b54496762a99699d8 (diff) | |
download | glibc-5688da55372193e5941f0240e6ea759d28483970.tar glibc-5688da55372193e5941f0240e6ea759d28483970.tar.gz glibc-5688da55372193e5941f0240e6ea759d28483970.tar.bz2 glibc-5688da55372193e5941f0240e6ea759d28483970.zip |
Update.
* sysdeps/generic/ldsodefs.h: Add _dl_load_lock, _dl_lazy,
_dl_dynamic_weak, _dl_fpu_control, _dl_cpuclock_offset, and
_dl_debug_fd to rtld_global.
* elf/Versions: Likewise.
* elf/dl-close.c: Likewise.
* elf/dl-iteratephdr.c: Likewise.
* elf/dl-lookup.c: Likewise.
* elf/dl-misc.c: Likewise.
* elf/dl-open.c: Likewise.
* elf/dl-support.c: Likewise.
* elf/do-lookup.h: Likewise.
* elf/rtld.c: Likewise.
* sysdeps/generic/dl-cache.c: Likewise.
* sysdeps/generic/dl-sysdep.c: Likewise.
* sysdeps/ia64/Versions: Likewise.
* sysdeps/unix/clock_gettime.c: Likewise.
* sysdeps/unix/clock_settime.c: Likewise.
* sysdeps/unix/sysv/linux/init-first.c: Likewise.
* sysdeps/sparc/Versions: Removed.
* sysdeps/i386/i686/Versions : Removed.
* sysdeps/x86_64/Versions: Removed.
* configure.in: Define HAVE_PROTECTED if .protected is available.
* config.h.in: Add entry for HAVE_PROTECTED.
2002-01-31 Jakub Jelinek <jakub@redhat.com.
* sysdeps/alpha/dl-machine.h: Move global variables for SHARED
code in struct _rtld_global. Export this struct, remove all
exports for the signal variables.
* sysdeps/arm/dl-machine: Likewise.
* sysdeps/generic/dl-origin: Likewise.
* sysdeps/generic/dl-sysdep: Likewise.
* sysdeps/generic/dl-cache: Likewise.
* sysdeps/hppa/dl-fptr: Likewise.
* sysdeps/hppa/dl-machine: Likewise.
* sysdeps/cris/dl-machine: Likewise.
* sysdeps/i386/dl-machine: Likewise.
* sysdeps/ia64/dl-machine: Likewise.
* sysdeps/m68k/dl-machine: Likewise.
* sysdeps/mach/hurd/dl-sysdep: Likewise.
* sysdeps/mips/mips64/dl-machine: Likewise.
* sysdeps/mips/dl-machine: Likewise.
* sysdeps/powerpc/elf/libc-start: Likewise.
* sysdeps/powerpc/dl-machine: Likewise.
* sysdeps/powerpc/dl-start: Likewise.
* sysdeps/sparc/sparc32/dl-machine: Likewise.
* sysdeps/sparc/sparc64/dl-machine: Likewise.
* sysdeps/sh/dl-machine: Likewise.
* sysdeps/s390/s390-32/dl-machine: Likewise.
* sysdeps/s390/s390-64/dl-machine: Likewise.
* sysdeps/unix/sysv/aix/libc-start: Likewise.
* sysdeps/unix/sysv/aix/start-libc: Likewise.
* sysdeps/unix/sysv/linux/ia64/dl-static: Likewise.
* sysdeps/unix/sysv/linux/m68k/getpagesize: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc32/getpagesize: Likewise.
* sysdeps/x86_64/dl-machine: Likewise.
2002-01-31 Ulrich Drepper <drepper@redhat.com>
Diffstat (limited to 'sysdeps')
36 files changed, 206 insertions, 237 deletions
diff --git a/sysdeps/alpha/dl-machine.h b/sysdeps/alpha/dl-machine.h index 7b6dcec746..9e4c6f4ebf 100644 --- a/sysdeps/alpha/dl-machine.h +++ b/sysdeps/alpha/dl-machine.h @@ -1,5 +1,5 @@ /* Machine-dependent ELF dynamic relocation inline functions. Alpha version. - Copyright (C) 1996,1997,1998,1999,2000,2001 Free Software Foundation, Inc. + Copyright (C) 1996-2001, 2002 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Richard Henderson <rth@tamu.edu>. @@ -110,11 +110,11 @@ elf_machine_runtime_setup (struct link_map *l, int lazy, int profile) { *(Elf64_Addr *)(plt + 16) = (Elf64_Addr) &_dl_runtime_profile; - if (_dl_name_match_p (_dl_profile, l)) + if (_dl_name_match_p (GL(dl_profile), l)) { /* This is the object we are looking for. Say that we really want profiling and the timers are started. */ - _dl_profile_map = l; + GL(dl_profile_map) = l; } } @@ -328,7 +328,7 @@ $fixup_stack_ret: \n\ " RTLD_START_SPECIAL_INIT " \n\ /* Call _dl_init(_dl_loaded, argc, argv, envp) to run \n\ initializers. */ \n\ - ldq $16, _dl_loaded \n\ + ldq $16, _rtld_global \n\ ldq $17, 0($sp) \n\ lda $18, 8($sp) \n\ s8addq $17, 8, $19 \n\ @@ -498,7 +498,7 @@ elf_machine_rela (struct link_map *map, { unsigned long int const r_type = ELF64_R_TYPE (reloc->r_info); -#if !defined RTLD_BOOTSTRAP && !defined HAVE_Z_COMBRELOC +#if !defined RTLD_BOOTSTRAP && !defined HAVE_Z_COMBRELOC && !defined SHARED /* This is defined in rtld.c, but nowhere in the static libc.a; make the reference weak so static programs can still link. This declaration cannot be done when compiling rtld.c (i.e. #ifdef RTLD_BOOTSTRAP) @@ -515,7 +515,7 @@ elf_machine_rela (struct link_map *map, { # if !defined RTLD_BOOTSTRAP && !defined HAVE_Z_COMBRELOC /* Already done in dynamic linker. */ - if (map != &_dl_rtld_map) + if (map != &GL(dl_rtld_map)) # endif { /* XXX Make some timings. Maybe it's preverable to test for diff --git a/sysdeps/arm/dl-machine.h b/sysdeps/arm/dl-machine.h index 73edd776ee..4c302b5bf5 100644 --- a/sysdeps/arm/dl-machine.h +++ b/sysdeps/arm/dl-machine.h @@ -1,5 +1,5 @@ /* Machine-dependent ELF dynamic relocation inline functions. ARM version. - Copyright (C) 1995,96,97,98,99,2000,2001 Free Software Foundation, Inc. + Copyright (C) 1995,96,97,98,99,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 @@ -109,10 +109,10 @@ elf_machine_runtime_setup (struct link_map *l, int lazy, int profile) { got[2] = (Elf32_Addr) &_dl_runtime_profile; - if (_dl_name_match_p (_dl_profile, l)) + if (_dl_name_match_p (GL(dl_profile), l)) /* Say that we really want profiling and the timers are started. */ - _dl_profile_map = l; + GL(dl_profile_map) = l; } else /* This function will get called to fix up the GOT entry indicated by @@ -324,7 +324,7 @@ _dl_start_user: .L_STACK_END: .word __libc_stack_end(GOT) .L_LOADED: - .word _dl_loaded(GOT) + .word _rtld_global(GOT) .previous\n\ "); @@ -347,14 +347,12 @@ _dl_start_user: _dl_sysdep_start. */ #define DL_PLATFORM_INIT dl_platform_init () -extern const char *_dl_platform; - static inline void __attribute__ ((unused)) dl_platform_init (void) { - if (_dl_platform != NULL && *_dl_platform == '\0') + if (GL(dl_platform) != NULL && *GL(dl_platform) == '\0') /* Avoid an empty string which would disturb us. */ - _dl_platform = NULL; + GL(dl_platform) = NULL; } static inline Elf32_Addr @@ -452,7 +450,7 @@ elf_machine_rel (struct link_map *map, const Elf32_Rel *reloc, found. */ break; if (sym->st_size > refsym->st_size - || (_dl_verbose && sym->st_size < refsym->st_size)) + || (GL(dl_verbose) && sym->st_size < refsym->st_size)) { const char *strtab; @@ -484,7 +482,9 @@ elf_machine_rel (struct link_map *map, const Elf32_Rel *reloc, compiling rtld.c (i.e. #ifdef RTLD_BOOTSTRAP) because rtld.c contains the common defn for _dl_rtld_map, which is incompatible with a weak decl in the same file. */ +# ifndef SHARED weak_extern (_dl_rtld_map); +# endif if (map == &_dl_rtld_map) /* Undo the relocation done here during bootstrapping. Now we will relocate it anew, possibly using a diff --git a/sysdeps/cris/dl-machine.h b/sysdeps/cris/dl-machine.h index e4778e38a1..ff27005f2a 100644 --- a/sysdeps/cris/dl-machine.h +++ b/sysdeps/cris/dl-machine.h @@ -1,5 +1,5 @@ /* Machine-dependent ELF dynamic relocation inline functions. CRIS version. - Copyright (C) 1996,1997,1998,1999,2000,2001 Free Software Foundation, Inc. + Copyright (C) 1996-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 @@ -106,11 +106,11 @@ elf_machine_runtime_setup (struct link_map *l, int lazy, int profile) { got[2] = (Elf32_Addr) &_dl_runtime_profile; - if (_dl_name_match_p (_dl_profile, l)) + if (_dl_name_match_p (GL(dl_profile), l)) { /* This is the object we are looking for. Say that we really want profiling and the timers are started. */ - _dl_profile_map = l; + GL(dl_profile_map) = l; } } else @@ -212,7 +212,7 @@ _dl_start_user: move.d $sp,$r12 addq 4,$r12 ; main_map: at _dl_loaded. - move.d [$r0+_dl_loaded:GOT16],$r9 + move.d [$r0+_rtld_global:GOT16],$r9 move.d [$r9],$r10 move.d _dl_init:PLTG,$r9 add.d $r0,$r9 @@ -246,14 +246,12 @@ _dl_start_user: _dl_sysdep_start. */ #define DL_PLATFORM_INIT dl_platform_init () -extern const char *_dl_platform; - static inline void __attribute__ ((unused)) dl_platform_init (void) { - if (_dl_platform != NULL && *_dl_platform == '\0') + if (GL(dl_platform) != NULL && *GL(dl_platform) == '\0') /* Avoid an empty string which would disturb us. */ - _dl_platform = NULL; + GL(dl_platform) = NULL; } static inline Elf32_Addr @@ -314,7 +312,7 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc, found. */ break; if (sym->st_size > refsym->st_size - || (_dl_verbose && sym->st_size < refsym->st_size)) + || (GL(dl_verbose) && sym->st_size < refsym->st_size)) { extern char **_dl_argv; const char *strtab; diff --git a/sysdeps/generic/dl-cache.c b/sysdeps/generic/dl-cache.c index 7ba00e46f7..3800a677cc 100644 --- a/sysdeps/generic/dl-cache.c +++ b/sysdeps/generic/dl-cache.c @@ -38,10 +38,6 @@ static size_t cachesize; /* 1 if cache_data + PTR points into the cache. */ #define _dl_cache_verify_ptr(ptr) (ptr < cache_data_size) -/* This is the cache ID we expect. Normally it is 3 for glibc linked - binaries. */ -int _dl_correct_cache_id = _DL_CACHE_DEFAULT_ID; - #define SEARCH_CACHE(cache) \ /* We use binary search since the table is sorted in the cache file. \ The first matching entry in the table is returned. \ @@ -111,12 +107,12 @@ do \ if (_dl_cache_check_flags (flags) \ && _dl_cache_verify_ptr (lib->value)) \ { \ - if (best == NULL || flags == _dl_correct_cache_id) \ + if (best == NULL || flags == GL(dl_correct_cache_id)) \ { \ HWCAP_CHECK; \ best = cache_data + lib->value; \ \ - if (flags == _dl_correct_cache_id) \ + if (flags == GL(dl_correct_cache_id)) \ /* We've found an exact match for the shared \ object and no general `ELF' release. Stop \ searching. */ \ diff --git a/sysdeps/generic/dl-origin.c b/sysdeps/generic/dl-origin.c index 273ffebedf..db990e6d36 100644 --- a/sysdeps/generic/dl-origin.c +++ b/sysdeps/generic/dl-origin.c @@ -1,5 +1,5 @@ /* Find path of executable. - Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc. + Copyright (C) 1998, 1999, 2000, 2002 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998. @@ -25,9 +25,6 @@ #include <dl-dst.h> -/* Generally it is not possible to implement this. We have to fall - back on a solution where the user provides the information. */ -extern const char *_dl_origin_path; const char * _dl_get_origin (void) @@ -35,15 +32,15 @@ _dl_get_origin (void) char *result = (char *) -1; /* We use the environment variable LD_ORIGIN_PATH. If it is set make a copy and strip out trailing slashes. */ - if (_dl_origin_path != NULL) + if (GL(dl_origin_path) != NULL) { - size_t len = strlen (_dl_origin_path); - result = malloc (len + 1); + size_t len = strlen (GL(dl_origin_path)); + result = (char *) malloc (len + 1); if (result == NULL) result = (char *) -1; else { - char *cp = __mempcpy (result, _dl_origin_path, len); + char *cp = __mempcpy (result, GL(dl_origin_path), len); while (cp > result + 1 && cp[-1] == '/') --cp; *cp = '\0'; diff --git a/sysdeps/generic/dl-sysdep.c b/sysdeps/generic/dl-sysdep.c index f8b8ac1e75..d3d5a8cefb 100644 --- a/sysdeps/generic/dl-sysdep.c +++ b/sysdeps/generic/dl-sysdep.c @@ -39,7 +39,6 @@ #include <hp-timing.h> extern char **_environ; -extern fpu_control_t _dl_fpu_control; extern void _end; /* Protect SUID program against misuse of file descriptors. */ @@ -54,10 +53,6 @@ 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; -//Xunsigned long int _dl_hwcap_mask = HWCAP_IMPORTANT; -#if HP_TIMING_AVAIL -hp_timing_t _dl_cpuclock_offset; -#endif #ifndef DL_FIND_ARG_COMPONENTS # define DL_FIND_ARG_COMPONENTS(cookie, argc, argv, envp, auxp) \ @@ -95,7 +90,7 @@ _dl_sysdep_start (void **start_argptr, #endif #if HP_TIMING_AVAIL - HP_TIMING_NOW (_dl_cpuclock_offset); + HP_TIMING_NOW (GL(dl_cpuclock_offset)); #endif DL_FIND_ARG_COMPONENTS (start_argptr, _dl_argc, _dl_argv, _environ, @@ -146,7 +141,7 @@ _dl_sysdep_start (void **start_argptr, GL(dl_clktck) = av->a_un.a_val; break; case AT_FPUCW: - _dl_fpu_control = av->a_un.a_val; + GL(dl_fpu_control) = av->a_un.a_val; break; } diff --git a/sysdeps/generic/ldsodefs.h b/sysdeps/generic/ldsodefs.h index 52303327c0..3249105ac1 100644 --- a/sysdeps/generic/ldsodefs.h +++ b/sysdeps/generic/ldsodefs.h @@ -29,10 +29,12 @@ #include <elf.h> #include <dlfcn.h> +#include <fpu_control.h> #include <sys/mman.h> #include <link.h> #include <dl-lookupcfg.h> #include <bits/libc-lock.h> +#include <hp-timing.h> __BEGIN_DECLS @@ -234,6 +236,15 @@ struct rtld_global /* Cached value of `getpagesize ()'. */ EXTERN size_t _dl_pagesize; + /* During the program run we must not modify the global data of + loaded shared object simultanously in two threads. Therefore we + protect `_dl_open' and `_dl_close' in dl-close.c. + + This must be a recursive lock since the initializer function of + the loaded object might as well require a call to this function. + At this time it is not anymore a problem to modify the tables. */ + __libc_lock_define_recursive (EXTERN, _dl_load_lock) + /* OS version. */ EXTERN unsigned int _dl_osversion; /* Platform name. */ @@ -251,12 +262,27 @@ struct rtld_global /* If nonzero print warnings messages. */ EXTERN int _dl_verbose; + /* Do we do lazy relocations? */ + EXTERN int _dl_lazy; + /* Nonzero if runtime lookups should not update the .got/.plt. */ EXTERN int _dl_bind_not; + /* Nonzero if references should be treated as weak during runtime + linking. */ + EXTERN int _dl_dynamic_weak; + + /* Default floating-point control word. */ + EXTERN fpu_control_t _dl_fpu_control; + /* The object to be initialized first. */ EXTERN struct link_map *_dl_initfirst; + /* Start time on CPU clock. */ +#if HP_TIMING_AVAIL + EXTERN hp_timing_t _dl_cpuclock_offset; +#endif + /* Name of the shared object to be profiled (if any). */ EXTERN const char *_dl_profile; /* Map of shared object to be profiled. */ @@ -268,7 +294,7 @@ struct rtld_global /* Name of the object we want to trace the prelinking. */ EXTERN const char *_dl_trace_prelink; - /* Expect cache ID. */ + /* Expected cache ID. */ EXTERN int _dl_correct_cache_id; /* Counters for the number of relocations performed. */ @@ -291,6 +317,9 @@ struct rtld_global EXTERN struct r_search_path_elem *_dl_all_dirs; EXTERN struct r_search_path_elem *_dl_init_all_dirs; + /* File descriptor to write debug messages to. */ + EXTERN int _dl_debug_fd; + /* Structure describing the dynamic linker itself. */ EXTERN struct link_map _dl_rtld_map; #ifdef SHARED @@ -303,22 +332,9 @@ extern struct rtld_global _rtld_global; 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[]; -/* 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; - /* OS-dependent function to open the zero-fill device. */ extern int _dl_sysdep_open_zero_fill (void); /* dl-sysdep.c */ diff --git a/sysdeps/hppa/dl-fptr.c b/sysdeps/hppa/dl-fptr.c index 4f8cc8b5d1..f8b6424abf 100644 --- a/sysdeps/hppa/dl-fptr.c +++ b/sysdeps/hppa/dl-fptr.c @@ -1,5 +1,5 @@ /* Make dynamic PLABELs for function pointers. HPPA version. - Copyright (C) 1999, 2000 Free Software Foundation, Inc. + Copyright (C) 1999, 2000, 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 @@ -44,10 +44,9 @@ static int __hppa_fptr_lock = 1; #ifdef MAP_ANON /* The fd is not examined when using MAP_ANON. */ -#define ANONFD -1 +# define ANONFD -1 #else -extern int _dl_zerofd; -#define ANONFD _dl_zerofd +# define ANONFD GL(dl_zerofd) #endif struct hppa_fptr __boot_ldso_fptr[HPPA_BOOT_FPTR_SIZE]; @@ -95,10 +94,10 @@ __hppa_make_fptr (const struct link_map *sym_map, Elf32_Addr value, { #ifndef MAP_ANON # define MAP_ANON 0 - if (_dl_zerofd == -1) + if (GL(dl_zerofd) == -1) { - _dl_zerofd = _dl_sysdep_open_zero_fill (); - if (_dl_zerofd == -1) + GL(dl_zerofd) = _dl_sysdep_open_zero_fill (); + if (GL(dl_zerofd) == -1) { __close (fd); _dl_signal_error (errno, NULL, NULL, @@ -107,11 +106,11 @@ __hppa_make_fptr (const struct link_map *sym_map, Elf32_Addr value, } #endif - __fptr_next = __mmap (0, _dl_pagesize, PROT_READ | PROT_WRITE, + __fptr_next = __mmap (0, GL(dl_pagesize), PROT_READ | PROT_WRITE, MAP_ANON | MAP_PRIVATE, ANONFD, 0); if (__fptr_next == MAP_FAILED) _dl_signal_error(errno, NULL, NULL, "cannot map page for fptr"); - __fptr_count = _dl_pagesize / sizeof (struct hppa_fptr); + __fptr_count = GL(dl_pagesize) / sizeof (struct hppa_fptr); } f = __fptr_next++; __fptr_count--; diff --git a/sysdeps/hppa/dl-machine.h b/sysdeps/hppa/dl-machine.h index d13f15b3e5..449fa9dbef 100644 --- a/sysdeps/hppa/dl-machine.h +++ b/sysdeps/hppa/dl-machine.h @@ -1,5 +1,5 @@ /* Machine-dependent ELF dynamic relocation inline functions. PA-RISC version. - Copyright (C) 1995,1996,1997,1999,2000,2001 Free Software Foundation, Inc. + Copyright (C) 1995-1997,1999,2000,2001,2002 Free Software Foundation, Inc. Contributed by David Huggins-Daines <dhd@debian.org> This file is part of the GNU C Library. @@ -227,12 +227,12 @@ elf_machine_runtime_setup (struct link_map *l, int lazy, int profile) ((unsigned long) &_dl_runtime_resolve & ~3))->func; else { - if (_dl_name_match_p (_dl_profile, l)) + if (_dl_name_match_p (GL(dl_profile), l)) { /* This is the object we are looking for. Say that we really want profiling and the timers are started. */ - _dl_profile_map = l; + GL(dl_profile_map) = l; } got[-2] = (Elf32_Addr) ((struct hppa_fptr *) @@ -362,8 +362,8 @@ asm ( \ " stw %r24,-44(%sp)\n" \ \ ".Lnofix:\n" \ -" addil LT'_dl_loaded,%r19\n" \ -" ldw RT'_dl_loaded(%r1),%r26\n" \ +" addil LT'_rtld_global,%r19\n" \ +" ldw RT'_rtld_global(%r1),%r26\n" \ " bl set_dp, %r2\n" \ " ldw 0(%r26),%r26\n" \ \ @@ -488,13 +488,13 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc, struct link_map *sym_map; Elf32_Addr value; -#ifndef RTLD_BOOTSTRAP +#if !defined RTLD_BOOTSTRAP && !defined SHARED /* This is defined in rtld.c, but nowhere in the static libc.a; make the reference weak so static programs can still link. This declaration cannot be done when compiling rtld.c (i.e. #ifdef RTLD_BOOTSTRAP) because rtld.c contains the common defn for _dl_rtld_map, which is incompatible with a weak decl in the same file. */ - weak_extern (_dl_rtld_map); + weak_extern (GL(dl_rtld_map)); #endif /* RESOLVE_MAP will return a null value for undefined syms, and @@ -527,7 +527,7 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc, other ones will have their values reset. In particular, __fptr_next will be reset, sometimes causing endless loops in __hppa_make_fptr(). So don't do that. */ - if (map == &_dl_rtld_map) + if (map == &GL(dl_rtld_map)) return; #endif /* .eh_frame can have unaligned relocs. */ @@ -604,7 +604,7 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc, break; if (__builtin_expect (sym->st_size > refsym->st_size, 0) || (__builtin_expect (sym->st_size < refsym->st_size, 0) - && __builtin_expect (_dl_verbose, 0))) + && __builtin_expect (GL(dl_verbose), 0))) { const char *strtab; diff --git a/sysdeps/i386/dl-machine.h b/sysdeps/i386/dl-machine.h index 338dbfbdbe..66392da8fe 100644 --- a/sysdeps/i386/dl-machine.h +++ b/sysdeps/i386/dl-machine.h @@ -328,8 +328,10 @@ elf_machine_rel (struct link_map *map, const Elf32_Rel *reloc, (i.e. #ifdef RTLD_BOOTSTRAP) because rtld.c contains the common defn for _dl_rtld_map, which is incompatible with a weak decl in the same file. */ +# ifndef SHARED weak_extern (_dl_rtld_map); - if (map != &_dl_rtld_map) /* Already done in rtld itself. */ +# endif + if (map != &GL(dl_rtld_map)) /* Already done in rtld itself. */ # endif *reloc_addr += map->l_addr; } diff --git a/sysdeps/i386/i686/Versions b/sysdeps/i386/i686/Versions deleted file mode 100644 index 4242ca448a..0000000000 --- a/sysdeps/i386/i686/Versions +++ /dev/null @@ -1,5 +0,0 @@ -ld { - GLIBC_2.2.3 { - _dl_cpuclock_offset; - } -} diff --git a/sysdeps/ia64/Versions b/sysdeps/ia64/Versions index b1df498940..1e1387f9d4 100644 --- a/sysdeps/ia64/Versions +++ b/sysdeps/ia64/Versions @@ -4,7 +4,4 @@ ld { _dl_symbol_address; _dl_unmap; _dl_lookup_address; _dl_function_address; } - GLIBC_2.2.3 { - _dl_cpuclock_offset; - } } diff --git a/sysdeps/ia64/dl-machine.h b/sysdeps/ia64/dl-machine.h index b81cf29ebd..04381fe60d 100644 --- a/sysdeps/ia64/dl-machine.h +++ b/sysdeps/ia64/dl-machine.h @@ -1,5 +1,5 @@ /* Machine-dependent ELF dynamic relocation inline functions. IA-64 version. - Copyright (C) 1995, 1996, 1997, 2000, 2001 Free Software Foundation, Inc. + Copyright (C) 1995,1996,1997,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 @@ -508,7 +508,7 @@ elf_machine_rela (struct link_map *map, const unsigned long int r_type = ELF64_R_TYPE (reloc->r_info); Elf64_Addr value; -#if !defined RTLD_BOOTSTRAP && !defined HAVE_Z_COMBRELOC +#if !defined RTLD_BOOTSTRAP && !defined HAVE_Z_COMBRELOC && !defined SHARED /* This is defined in rtld.c, but nowhere in the static libc.a; make the reference weak so static programs can still link. This declaration cannot be done when compiling rtld.c (i.e. #ifdef RTLD_BOOTSTRAP) diff --git a/sysdeps/m68k/dl-machine.h b/sysdeps/m68k/dl-machine.h index d9c819429b..bd2d1e255b 100644 --- a/sysdeps/m68k/dl-machine.h +++ b/sysdeps/m68k/dl-machine.h @@ -1,5 +1,5 @@ /* Machine-dependent ELF dynamic relocation inline functions. m68k version. - Copyright (C) 1996,1997,1998,1999,2000,2001 Free Software Foundation, Inc. + Copyright (C) 1996-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 @@ -85,11 +85,11 @@ elf_machine_runtime_setup (struct link_map *l, int lazy, int profile) { got[2] = (Elf32_Addr) &_dl_runtime_profile; - if (_dl_name_match_p (_dl_profile, l)) + if (_dl_name_match_p (GL(dl_profile), l)) { /* This is the object we are looking for. Say that we really want profiling and the timers are started. */ - _dl_profile_map = l; + GL(dl_profile_map) = l; } } else @@ -176,7 +176,7 @@ _dl_start_user: pea 8(%sp, %d1*4) pea 8(%sp) move.l %d1, -(%sp) - move.l ([_dl_loaded@GOT.w, %a5]), -(%sp) + move.l ([_rtld_global@GOT.w, %a5]), -(%sp) jbsr _dl_init@PLTPC addq.l #8, %sp addq.l #8, %sp @@ -251,7 +251,7 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc, found. */ break; if (sym->st_size > refsym->st_size - || (sym->st_size < refsym->st_size && _dl_verbose)) + || (sym->st_size < refsym->st_size && GL(dl_verbose))) { extern char **_dl_argv; const char *strtab; diff --git a/sysdeps/mach/hurd/dl-sysdep.c b/sysdeps/mach/hurd/dl-sysdep.c index a17e92aff3..596f161525 100644 --- a/sysdeps/mach/hurd/dl-sysdep.c +++ b/sysdeps/mach/hurd/dl-sysdep.c @@ -1,5 +1,5 @@ /* Operating system support for run-time dynamic linker. Hurd version. - Copyright (C) 1995,96,97,98,99,2000,2001 Free Software Foundation, Inc. + Copyright (C) 1995,96,97,98,99,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 @@ -52,7 +52,6 @@ int __libc_multiple_libcs = 0; /* Defining this here avoids the inclusion of init-first. */ /* This variable containts the lowest stack address ever used. */ void *__libc_stack_end; -unsigned long int _dl_hwcap_mask = HWCAP_IMPORTANT; struct hurd_startup_data *_dl_hurd_data; @@ -236,7 +235,7 @@ unfmh(); /* XXX */ __mach_init (); /* Initialize frequently used global variable. */ - _dl_pagesize = __getpagesize (); + GL(dl_pagesize) = __getpagesize (); fmh(); /* XXX */ diff --git a/sysdeps/mips/dl-machine.h b/sysdeps/mips/dl-machine.h index de5106914c..4c28e17c9f 100644 --- a/sysdeps/mips/dl-machine.h +++ b/sysdeps/mips/dl-machine.h @@ -216,7 +216,7 @@ elf_machine_runtime_link_map (ElfW(Addr) gpreg, ElfW(Addr) stub_pc) } { - struct link_map *l = _dl_loaded; + struct link_map *l = GL(dl_loaded); while (l) { @@ -441,7 +441,7 @@ _dl_start_user:\n\ # Save back the modified argument count.\n\ sw $4, 0($29)\n\ 1: # Call _dl_init (struct link_map *main_map, int argc, char **argv, char **env) \n\ - lw $4, _dl_loaded\n\ + lw $4, _rtld_global\n\ lw $5, 0($29)\n\ la $6, 4($29)\n\ sll $7, $5, 2\n\ @@ -477,14 +477,14 @@ elf_machine_rel (struct link_map *map, const ElfW(Rel) *reloc, { const unsigned long int r_type = ELFW(R_TYPE) (reloc->r_info); -#ifndef RTLD_BOOTSTRAP +#if !defined RTLD_BOOTSTRAP && !defined SHARED /* This is defined in rtld.c, but nowhere in the static libc.a; make the reference weak so static programs can still link. This declaration cannot be done when compiling rtld.c (i.e. #ifdef RTLD_BOOTSTRAP) because rtld.c contains the common defn for _dl_rtld_map, which is incompatible with a weak decl in the same file. */ - weak_extern (_dl_rtld_map); + weak_extern (GL(dl_rtld_map)); #endif switch (r_type) @@ -501,7 +501,7 @@ elf_machine_rel (struct link_map *map, const ElfW(Rel) *reloc, if (symidx < gotsym) { #ifndef RTLD_BOOTSTRAP - if (map != &_dl_rtld_map) + if (map != &GL(dl_rtld_map)) #endif *reloc_addr += sym->st_value + map->l_addr; } @@ -520,7 +520,7 @@ elf_machine_rel (struct link_map *map, const ElfW(Rel) *reloc, } else #ifndef RTLD_BOOTSTRAP - if (map != &_dl_rtld_map) + if (map != &GL(dl_rtld_map)) #endif *reloc_addr += map->l_addr; } @@ -561,7 +561,7 @@ elf_machine_got_rel (struct link_map *map, int lazy) ({ \ const ElfW(Sym) *ref = sym; \ const struct r_found_version *version \ - = vernum ? &map->l_versions [vernum [sym_index]] : NULL; \ + = vernum ? &map->l_versions[vernum[sym_index]] : NULL; \ ElfW(Addr) value; \ value = RESOLVE (&ref, version, R_MIPS_REL32); \ (ref)? value + ref->st_value: 0; \ @@ -576,7 +576,7 @@ elf_machine_got_rel (struct link_map *map, int lazy) n = map->l_info[DT_MIPS (LOCAL_GOTNO)]->d_un.d_val; /* The dynamic linker's local got entries have already been relocated. */ - if (map != &_dl_rtld_map) + if (map != &GL(dl_rtld_map)) { /* got[0] is reserved. got[1] is also reserved for the dynamic object generated by gnu ld. Skip these reserved entries from relocation. */ diff --git a/sysdeps/mips/mips64/dl-machine.h b/sysdeps/mips/mips64/dl-machine.h index d51f1e3cb1..7ee3cf52aa 100644 --- a/sysdeps/mips/mips64/dl-machine.h +++ b/sysdeps/mips/mips64/dl-machine.h @@ -1,5 +1,5 @@ /* Machine-dependent ELF dynamic relocation inline functions. MIPS64 version. - Copyright (C) 1996, 1997, 1999, 2000, 2001 Free Software Foundation, Inc. + Copyright (C) 1996,1997,1999,2000,2001,2002 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Kazumoto Kojima <kkojima@info.kanagawa-u.ac.jp>. @@ -289,7 +289,7 @@ elf_machine_runtime_link_map (ElfW(Addr) gpreg, ElfW(Addr) stub_pc) } { - struct link_map *l = _dl_loaded; + struct link_map *l = GL(dl_loaded); while (l) { @@ -480,7 +480,7 @@ _dl_start_user:\n\ # Save back the modified argument count.\n\ sd $4, 0($29)\n\ 1: # Call _dl_init (struct link_map *main_map, int argc, char **argv, char **env) \n\ - ld $4, _dl_loaded\n\ + ld $4, _rtld_global\n\ ld $5, 0($29)\n\ dla $6, 4($29)\n\ dla $7, 8($29)\n\ @@ -492,7 +492,7 @@ _dl_start_user:\n\ dla $31, _dl_fini\n\ # Jump to the user entry point.\n\ 1: # Call _dl_init (struct link_map *main_map, int argc, char **argv, char **env) \n\ - lw $4, _dl_loaded\n\ + lw $4, _rtld_global\n\ lw $5, 0($29)\n\ la $6, 4($29)\n\ la $7, 8($29)\n\ @@ -553,8 +553,10 @@ elf_machine_rel (struct link_map *map, const ElfW(Rel) *reloc, RTLD_BOOTSTRAP) because rtld.c contains the common defn for _dl_rtld_map, which is incompatible with a weak decl in the same file. */ - weak_extern (_dl_rtld_map); - if (map == &_dl_rtld_map) +# ifndef SHARED + weak_extern (GL(dl_rtld_map)); +# endif + if (map == &GL(dl_rtld_map)) /* Undo the relocation done here during bootstrapping. Now we will relocate it anew, possibly using a binding found in the user program or a loaded library rather than the dynamic linker's diff --git a/sysdeps/powerpc/dl-machine.c b/sysdeps/powerpc/dl-machine.c index 0e3164f70d..7081466945 100644 --- a/sysdeps/powerpc/dl-machine.c +++ b/sysdeps/powerpc/dl-machine.c @@ -1,5 +1,5 @@ /* Machine-dependent ELF dynamic relocation functions. PowerPC version. - Copyright (C) 1995,96,97,98,99,2000,2001 Free Software Foundation, Inc. + Copyright (C) 1995-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 @@ -112,11 +112,11 @@ __elf_preferred_address(struct link_map *loader, size_t maplength, be superceded by the program's load address). */ low = 0x0003FFFF; high = 0x70000000; - for (l = _dl_loaded; l; l = l->l_next) + for (l = GL(dl_loaded); l; l = l->l_next) { ElfW(Addr) mapstart, mapend; - mapstart = l->l_map_start & ~(_dl_pagesize - 1); - mapend = l->l_map_end | (_dl_pagesize - 1); + mapstart = l->l_map_start & ~(GL(dl_pagesize) - 1); + mapend = l->l_map_end | (GL(dl_pagesize) - 1); assert (mapend > mapstart); /* Prefer gaps below the main executable, note that l == @@ -137,7 +137,7 @@ __elf_preferred_address(struct link_map *loader, size_t maplength, } high -= 0x10000; /* Allow some room between objects. */ - maplength = (maplength | (_dl_pagesize-1)) + 1; + maplength = (maplength | (GL(dl_pagesize) - 1)) + 1; if (high <= low || high - low < maplength ) return 0; return high - maplength; /* Both high and maplength are page-aligned. */ @@ -235,10 +235,10 @@ __elf_machine_runtime_setup (struct link_map *map, int lazy, int profile) : _dl_runtime_resolve); Elf32_Word offset; - if (profile && _dl_name_match_p (_dl_profile, map)) + if (profile && _dl_name_match_p (GL(dl_profile), map)) /* This is the object we are looking for. Say that we really want profiling and the timers are started. */ - _dl_profile_map = map; + GL(dl_profile_map) = map; /* For the long entries, subtract off data_words. */ tramp[0] = OPCODE_ADDIS_HI (11, 11, -data_words); @@ -467,7 +467,7 @@ __process_machine_rela (struct link_map *map, found. */ return; if (sym->st_size > refsym->st_size - || (_dl_verbose && sym->st_size < refsym->st_size)) + || (GL(dl_verbose) && sym->st_size < refsym->st_size)) { const char *strtab; diff --git a/sysdeps/powerpc/dl-start.S b/sysdeps/powerpc/dl-start.S index beb926248c..1bca5d5118 100644 --- a/sysdeps/powerpc/dl-start.S +++ b/sysdeps/powerpc/dl-start.S @@ -1,5 +1,5 @@ /* Machine-dependent ELF startup code. PowerPC version. - Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000 Free Software Foundation, Inc. + Copyright (C) 1995-2000, 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 @@ -52,7 +52,7 @@ ENTRY(_dl_start_user) /* the address of _start in r30, */ mr r30,r3 /* &_dl_argc in 29, &_dl_argv in 27, and _dl_loaded in 28. */ - lwz r28,_dl_loaded@got(r31) + lwz r28,_rtld_global@got(r31) lwz r29,_dl_argc@got(r31) lwz r27,_dl_argv@got(r31) diff --git a/sysdeps/powerpc/elf/libc-start.c b/sysdeps/powerpc/elf/libc-start.c index 99dc436b07..e20fd04fb7 100644 --- a/sysdeps/powerpc/elf/libc-start.c +++ b/sysdeps/powerpc/elf/libc-start.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1998,2000,01,02 Free Software Foundation, Inc. +/* Copyright (C) 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 @@ -96,7 +96,7 @@ BP_SYM (__libc_start_main) (int argc, char *__unbounded *__unbounded ubp_av, /* Call the initializer of the libc. */ #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 libc\n\n"); #endif __libc_init_first (argc, argv, __environ); @@ -107,14 +107,14 @@ BP_SYM (__libc_start_main) (int argc, char *__unbounded *__unbounded ubp_av, /* 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 (stinfo->init) stinfo->init (argc, argv, __environ, auxvec); #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 diff --git a/sysdeps/s390/s390-32/dl-machine.h b/sysdeps/s390/s390-32/dl-machine.h index 2207dd48db..2c7ba2ea6c 100644 --- a/sysdeps/s390/s390-32/dl-machine.h +++ b/sysdeps/s390/s390-32/dl-machine.h @@ -1,5 +1,5 @@ /* Machine-dependent ELF dynamic relocation inline functions. S390 Version. - Copyright (C) 2000, 2001 Free Software Foundation, Inc. + Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc. Contributed by Carl Pederson & Martin Schwidefsky. This file is part of the GNU C Library. @@ -112,10 +112,10 @@ elf_machine_runtime_setup (struct link_map *l, int lazy, int profile) { got[2] = (Elf32_Addr) &_dl_runtime_profile; - if (_dl_name_match_p (_dl_profile, l)) + if (_dl_name_match_p (GL(dl_profile), l)) /* This is the object we are looking for. Say that we really want profiling and the timers are started. */ - _dl_profile_map = l; + GL(dl_profile_map) = l; } else /* This function will get called to fix up the GOT entry indicated by @@ -287,7 +287,7 @@ _dl_start_user:\n\ # Call the function to run the initializers.\n\ # Load the parameters:\n\ # (%r2, %r3, %r4, %r5) = (_dl_loaded, argc, argv, envp)\n\ - l %r2,_dl_loaded@GOT(%r12)\n\ + l %r2,_rtld_global@GOT(%r12)\n\ l %r2,0(%r2)\n\ l %r3,96(%r15)\n\ la %r4,100(%r15)\n\ @@ -333,14 +333,12 @@ _dl_start_user:\n\ _dl_sysdep_start. */ #define DL_PLATFORM_INIT dl_platform_init () -extern const char *_dl_platform; - static inline void __attribute__ ((unused)) dl_platform_init (void) { - if (_dl_platform != NULL && *_dl_platform == '\0') + if (GL(dl_platform) != NULL && *GL(dl_platform) == '\0') /* Avoid an empty string which would disturb us. */ - _dl_platform = NULL; + GL(dl_platform) = NULL; } static inline Elf32_Addr @@ -401,7 +399,7 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc, break; if (__builtin_expect (sym->st_size > refsym->st_size, 0) || (__builtin_expect (sym->st_size < refsym->st_size, 0) - && __builtin_expect (_dl_verbose, 0))) + && __builtin_expect (GL(dl_verbose), 0))) { const char *strtab; diff --git a/sysdeps/s390/s390-64/dl-machine.h b/sysdeps/s390/s390-64/dl-machine.h index 25294fc787..a6df8ddecd 100644 --- a/sysdeps/s390/s390-64/dl-machine.h +++ b/sysdeps/s390/s390-64/dl-machine.h @@ -1,6 +1,6 @@ /* Machine-dependent ELF dynamic relocation inline functions. 64 bit S/390 Version. - Copyright (C) 2001 Free Software Foundation, Inc. + Copyright (C) 2001, 2002 Free Software Foundation, Inc. Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com). This file is part of the GNU C Library. @@ -105,10 +105,10 @@ elf_machine_runtime_setup (struct link_map *l, int lazy, int profile) { got[2] = (Elf64_Addr) &_dl_runtime_profile; - if (_dl_name_match_p (_dl_profile, l)) + if (_dl_name_match_p (GL(dl_profile), l)) /* This is the object we are looking for. Say that we really want profiling and the timers are started. */ - _dl_profile_map = l; + GL(dl_profile_map) = l; } else /* This function will get called to fix up the GOT entry indicated by @@ -262,7 +262,7 @@ _dl_start_user:\n\ # Call the function to run the initializers.\n\ # Load the parameters:\n\ # (%r2, %r3, %r4, %r5) = (_dl_loaded, argc, argv, envp)\n\ - lghi %r2,_dl_loaded@GOT + lghi %r2,_rtld_global@GOT lg %r2,0(%r2,%r12)\n\ lg %r2,0(%r2)\n\ lg %r3,160(%r15)\n\ @@ -302,14 +302,12 @@ _dl_start_user:\n\ _dl_sysdep_start. */ #define DL_PLATFORM_INIT dl_platform_init () -extern const char *_dl_platform; - static inline void __attribute__ ((unused)) dl_platform_init (void) { - if (_dl_platform != NULL && *_dl_platform == '\0') + if (GL(dl_platform) != NULL && *GL(dl_platform) == '\0') /* Avoid an empty string which would disturb us. */ - _dl_platform = NULL; + GL(dl_platform) = NULL; } static inline Elf64_Addr @@ -369,7 +367,7 @@ elf_machine_rela (struct link_map *map, const Elf64_Rela *reloc, break; if (__builtin_expect (sym->st_size > refsym->st_size, 0) || (__builtin_expect (sym->st_size < refsym->st_size, 0) - && __builtin_expect (_dl_verbose, 0))) + && __builtin_expect (GL(dl_verbose), 0))) { const char *strtab; diff --git a/sysdeps/sh/dl-machine.h b/sysdeps/sh/dl-machine.h index b303756e44..705e8d614b 100644 --- a/sysdeps/sh/dl-machine.h +++ b/sysdeps/sh/dl-machine.h @@ -1,5 +1,5 @@ /* Machine-dependent ELF dynamic relocation inline functions. SH version. - Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc. + Copyright (C) 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 @@ -105,7 +105,7 @@ elf_machine_runtime_setup (struct link_map *l, int lazy, int profile) { got[2] = (Elf32_Addr) &_dl_runtime_profile; /* Say that we really want profiling and the timers are started. */ - _dl_profile_map = l; + GL(dl_profile_map) = l; } else /* This function will get called to fix up the GOT entry indicated by @@ -388,7 +388,7 @@ _dl_start_user:\n\ .L_dl_init:\n\ .long _dl_init@PLT\n\ .L_dl_loaded:\n\ - .long _dl_loaded@GOT\n\ + .long _rtld_global@GOT\n\ .L_dl_starting_up:\n\ .long _dl_starting_up@GOT\n\ .L_dl_fini:\n\ @@ -411,14 +411,12 @@ _dl_start_user:\n\ _dl_sysdep_start. */ #define DL_PLATFORM_INIT dl_platform_init () -extern const char *_dl_platform; - static inline void __attribute__ ((unused)) dl_platform_init (void) { - if (_dl_platform != NULL && *_dl_platform == '\0') + if (GL(dl_platform) != NULL && *GL(dl_platform) == '\0') /* Avoid an empty string which would disturb us. */ - _dl_platform = NULL; + GL(dl_platform) = NULL; } static inline Elf32_Addr @@ -481,7 +479,7 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc, if (__builtin_expect (r_type == R_SH_RELATIVE, 0)) { #ifndef RTLD_BOOTSTRAP - if (map != &_dl_rtld_map) /* Already done in rtld itself. */ + if (map != &GL(dl_rtld_map)) /* Already done in rtld itself. */ #endif { if (reloc->r_addend) @@ -515,7 +513,7 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc, found. */ break; if (sym->st_size > refsym->st_size - || (sym->st_size < refsym->st_size && _dl_verbose)) + || (sym->st_size < erefsym->st_size && GL(dl_verbose))) { const char *strtab; @@ -542,8 +540,10 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc, compiling rtld.c (i.e. #ifdef RTLD_BOOTSTRAP) because rtld.c contains the common defn for _dl_rtld_map, which is incompatible with a weak decl in the same file. */ - weak_extern (_dl_rtld_map); - if (map == &_dl_rtld_map) +# ifndef SHARED + weak_extern (GL(dl_rtld_map)); +# endif + if (map == &GL(dl_rtld_map)) /* Undo the relocation done here during bootstrapping. Now we will relocate it anew, possibly using a binding found in the user program or a loaded library diff --git a/sysdeps/sparc/Versions b/sysdeps/sparc/Versions deleted file mode 100644 index 778543059a..0000000000 --- a/sysdeps/sparc/Versions +++ /dev/null @@ -1,6 +0,0 @@ -ld { - GLIBC_2.2.3 { - # If this symbol is ever available on SPARC it was introduced in 2.2.3. - _dl_cpuclock_offset; - } -} diff --git a/sysdeps/sparc/sparc32/dl-machine.h b/sysdeps/sparc/sparc32/dl-machine.h index 19a3897edb..7544707447 100644 --- a/sysdeps/sparc/sparc32/dl-machine.h +++ b/sysdeps/sparc/sparc32/dl-machine.h @@ -1,5 +1,5 @@ /* Machine-dependent ELF dynamic relocation inline functions. SPARC version. - Copyright (C) 1996,1997,1998,1999,2000,2001 Free Software Foundation, Inc. + Copyright (C) 1996-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 @@ -44,7 +44,8 @@ /* Use a different preload file when running in 32-bit emulation mode on a 64-bit host. */ -#define LD_SO_PRELOAD ((_dl_hwcap & HWCAP_SPARC_V9) ? "/etc/ld.so.preload32" \ +#define LD_SO_PRELOAD ((GL(dl_hwcap) & HWCAP_SPARC_V9) \ + ? "/etc/ld.so.preload32" \ : "/etc/ld.so.preload") @@ -57,13 +58,15 @@ elf_machine_matches_host (const Elf32_Ehdr *ehdr) else if (ehdr->e_machine == EM_SPARC32PLUS) { unsigned long *hwcap; +#ifndef SHARED weak_extern (_dl_hwcap); weak_extern (_dl_hwcap_mask); +#endif - hwcap = WEAKADDR(_dl_hwcap); + hwcap = WEAKADDR (GL(dl_hwcap)); /* XXX The following is wrong! Dave Miller rejected to implement it correctly. If this causes problems shoot *him*! */ - return hwcap == NULL || (*hwcap & _dl_hwcap_mask & HWCAP_SPARC_V9); + return hwcap == NULL || (*hwcap & GL(dl_hwcap_mask) & HWCAP_SPARC_V9); } else return 0; @@ -124,8 +127,8 @@ elf_machine_runtime_setup (struct link_map *l, int lazy, int profile) { rfunc = (Elf32_Addr) &_dl_runtime_profile; - if (_dl_name_match_p (_dl_profile, l)) - _dl_profile_map = l; + if (_dl_name_match_p (GL(dl_profile), l)) + GL(dl_profile_map) = l; } /* The beginning of the PLT does: @@ -154,8 +157,10 @@ elf_machine_runtime_setup (struct link_map *l, int lazy, int profile) Elf32_Rela *relaend = (Elf32_Rela *) ((char *) rela + l->l_info[DT_PLTRELSZ]->d_un.d_val); +#ifndef SHARED weak_extern (_dl_hwcap); - hwcap = WEAKADDR(_dl_hwcap); +#endif + hwcap = WEAKADDR (GL(dl_hwcap)); do_flush = (!hwcap || (*hwcap & HWCAP_SPARC_FLUSH)); /* prelink must ensure there are no R_SPARC_NONE relocs left @@ -307,9 +312,9 @@ _dl_start_user: bne 23b add %i1, 8, %i1 /* %o0 = _dl_loaded, %o1 = argc, %o2 = argv, %o3 = envp. */ -3: sethi %hi(_dl_loaded), %o0 +3: sethi %hi(_rtld_global), %o0 add %sp, 23*4, %o2 - orcc %o0, %lo(_dl_loaded), %o0 + orcc %o0, %lo(_rtld_global), %o0 sll %i5, 2, %o3 ld [%l7+%o0], %o0 add %o3, 4, %o3 @@ -337,15 +342,17 @@ sparc_fixup_plt (const Elf32_Rela *reloc, Elf32_Addr *reloc_addr, functionality on those cpu's that implement it. */ unsigned long *hwcap; int do_flush; +# ifndef SHARED weak_extern (_dl_hwcap); - hwcap = WEAKADDR(_dl_hwcap); +# endif + hwcap = WEAKADDR (GL(dl_hwcap)); do_flush = (!hwcap || (*hwcap & HWCAP_SPARC_FLUSH)); #else /* Unfortunately, this is necessary, so that we can ensure ld.so will not execute corrupt PLT entry instructions. */ const int do_flush = 1; #endif - + if (0 && disp >= -0x800000 && disp < 0x800000) { /* Don't need to worry about thread safety. We're writing just one @@ -451,7 +458,7 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc, found. */ break; if (sym->st_size > refsym->st_size - || (_dl_verbose && sym->st_size < refsym->st_size)) + || (GL(dl_verbose) && sym->st_size < refsym->st_size)) { extern char **_dl_argv; const char *strtab; diff --git a/sysdeps/sparc/sparc64/dl-machine.h b/sysdeps/sparc/sparc64/dl-machine.h index 913f98a5e1..8cfed7b8ec 100644 --- a/sysdeps/sparc/sparc64/dl-machine.h +++ b/sysdeps/sparc/sparc64/dl-machine.h @@ -1,5 +1,5 @@ /* Machine-dependent ELF dynamic relocation inline functions. Sparc64 version. - Copyright (C) 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. + Copyright (C) 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 @@ -284,7 +284,7 @@ elf_machine_rela (struct link_map *map, const Elf64_Rela *reloc, found. */ break; if (sym->st_size > refsym->st_size - || (_dl_verbose && sym->st_size < refsym->st_size)) + || (GL(dl_verbose) && sym->st_size < refsym->st_size)) { extern char **_dl_argv; const char *strtab; @@ -498,8 +498,8 @@ elf_machine_runtime_setup (struct link_map *l, int lazy, int profile) { res0_addr = (Elf64_Addr) &_dl_runtime_profile_0; res1_addr = (Elf64_Addr) &_dl_runtime_profile_1; - if (_dl_name_match_p (_dl_profile, l)) - _dl_profile_map = l; + if (_dl_name_match_p (GL(dl_profile), l)) + GL(dl_profile_map) = l; } /* PLT0 looks like: @@ -745,9 +745,9 @@ elf_machine_runtime_setup (struct link_map *l, int lazy, int profile) " add %i1, 16, %i1\n" \ " stx %l5, [%l4]\n" \ " /* %o0 = _dl_loaded, %o1 = argc, %o2 = argv, %o3 = envp. */\n" \ -"2: sethi %hi(_dl_loaded), %o0\n" \ +"2: sethi %hi(_rtld_global), %o0\n" \ " add %sp, " __S(STACK_BIAS) " + 23*8, %o2\n" \ -" orcc %o0, %lo(_dl_loaded), %o0\n" \ +" orcc %o0, %lo(_rtld_global), %o0\n" \ " sllx %i5, 3, %o3\n" \ " ldx [%l7 + %o0], %o0\n" \ " add %o3, 8, %o3\n" \ diff --git a/sysdeps/unix/clock_gettime.c b/sysdeps/unix/clock_gettime.c index a86786bb26..5dc329e1c0 100644 --- a/sysdeps/unix/clock_gettime.c +++ b/sysdeps/unix/clock_gettime.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc. +/* Copyright (C) 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 @@ -21,7 +21,7 @@ #include <time.h> #include <sys/time.h> #include <libc-internal.h> -#include <hp-timing.h> +#include <ldsodefs.h> #if HP_TIMING_AVAIL @@ -31,10 +31,6 @@ static hp_timing_t freq; -/* We need the starting time for the process. */ -extern hp_timing_t _dl_cpuclock_offset; - - /* This function is defined in the thread library. */ extern int __pthread_clock_gettime (hp_timing_t freq, struct timespec *tp) __attribute__ ((__weak__)); @@ -86,7 +82,7 @@ clock_gettime (clockid_t clock_id, struct timespec *tp) HP_TIMING_NOW (tsc); /* Compute the offset since the start time of the process. */ - tsc -= _dl_cpuclock_offset; + tsc -= GL(dl_cpuclock_offset); /* Compute the seconds. */ tp->tv_sec = tsc / freq; diff --git a/sysdeps/unix/clock_settime.c b/sysdeps/unix/clock_settime.c index 79a9b564af..407e759137 100644 --- a/sysdeps/unix/clock_settime.c +++ b/sysdeps/unix/clock_settime.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc. +/* Copyright (C) 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 @@ -20,6 +20,7 @@ #include <time.h> #include <sys/time.h> #include <libc-internal.h> +#include <ldsodefs.h> #if HP_TIMING_AVAIL @@ -29,10 +30,6 @@ static hp_timing_t freq; -/* We need the starting time for the process. */ -extern hp_timing_t _dl_cpuclock_offset; - - /* This function is defined in the thread library. */ extern void __pthread_clock_settime (hp_timing_t offset) __attribute__ ((__weak__)); @@ -92,7 +89,7 @@ clock_settime (clockid_t clock_id, const struct timespec *tp) /* Determine the offset and use it as the new base value. */ if (clock_id != CLOCK_THREAD_CPUTIME_ID || __pthread_clock_settime == NULL) - _dl_cpuclock_offset = tsc - usertime; + GL(dl_cpuclock_offset) = tsc - usertime; else __pthread_clock_settime (tsc - usertime); diff --git a/sysdeps/unix/sysv/aix/libc-start.c b/sysdeps/unix/sysv/aix/libc-start.c index 1184664b57..757b34975c 100644 --- a/sysdeps/unix/sysv/aix/libc-start.c +++ b/sysdeps/unix/sysv/aix/libc-start.c @@ -1,5 +1,5 @@ /* Initialization code run first thing by the XCOFF startup code. AIX version. - Copyright (C) 2001 Free Software Foundation, Inc. + Copyright (C) 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 @@ -73,10 +73,6 @@ extern int __loadx (int flag, void *module, void *arg1, void *arg2, /* Needed by setenv */ char **__environ; -/* Needed by dl-support.c */ -/* XXX stubbing out dl-support.c for now.. - size_t _dl_pagesize = 0; */ - /* * Find __rtinit symbol * @@ -277,7 +273,7 @@ __libc_start_main (void) /* 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", __libc_start_data.argv[0]); #endif @@ -285,7 +281,7 @@ __libc_start_main (void) (*__libc_start_data.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", __libc_start_data.argv[0]); #endif diff --git a/sysdeps/unix/sysv/aix/start-libc.c b/sysdeps/unix/sysv/aix/start-libc.c index e3582e3892..303caa7078 100644 --- a/sysdeps/unix/sysv/aix/start-libc.c +++ b/sysdeps/unix/sysv/aix/start-libc.c @@ -1,5 +1,5 @@ /* Initialization code run first thing by the XCOFF startup code. AIX version. - Copyright (C) 2001 Free Software Foundation, Inc. + Copyright (C) 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 @@ -74,10 +74,6 @@ extern int __loadx (int flag, void *module, void *arg1, void *arg2, /* Needed by setenv */ char **__environ; -/* Needed by dl-support.c */ -/* XXX stubbing out dl-support.c for now.. - size_t _dl_pagesize = 0; */ - /* Find __rtinit symbol diff --git a/sysdeps/unix/sysv/linux/ia64/dl-static.c b/sysdeps/unix/sysv/linux/ia64/dl-static.c index f74353e725..11f372d368 100644 --- a/sysdeps/unix/sysv/linux/ia64/dl-static.c +++ b/sysdeps/unix/sysv/linux/ia64/dl-static.c @@ -1,5 +1,5 @@ /* Variable initialization. IA-64 version. - Copyright (C) 2001 Free Software Foundation, Inc. + Copyright (C) 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 @@ -19,8 +19,6 @@ #include <ldsodefs.h> -extern int _dl_clktck; - #ifdef SHARED void @@ -44,8 +42,8 @@ __libc_lock_define_initialized_recursive (static, _dl_static_lock) static void *variables[] = { - &_dl_pagesize, - &_dl_clktck + &GL(dl_pagesize), + &GL(dl_clktck) }; void diff --git a/sysdeps/unix/sysv/linux/init-first.c b/sysdeps/unix/sysv/linux/init-first.c index 3cfb08dbf9..39f53a7c6d 100644 --- a/sysdeps/unix/sysv/linux/init-first.c +++ b/sysdeps/unix/sysv/linux/init-first.c @@ -1,5 +1,5 @@ /* Initialization code run first thing by the ELF startup code. Linux version. - 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 @@ -28,8 +28,8 @@ #include "kernel-features.h" #include <libc-internal.h> +#include <ldsodefs.h> #ifndef SHARED -# include <ldsodefs.h> # include "dl-osinfo.h" #endif @@ -41,7 +41,6 @@ static void init (int, char **, char **) __attribute__ ((unused)); extern int _dl_starting_up; weak_extern (_dl_starting_up) -extern fpu_control_t _dl_fpu_control; extern int _dl_fpu_control_set; /* Set nonzero if we have to be prepared for more then one libc being @@ -78,7 +77,7 @@ init (int argc, char **argv, char **envp) kernel would use a different value. (In a static program we don't have this information.) */ #ifdef SHARED - if (__fpu_control != _dl_fpu_control) + if (__fpu_control != GL(dl_fpu_control)) #endif __setfpucw (__fpu_control); } diff --git a/sysdeps/unix/sysv/linux/m68k/getpagesize.c b/sysdeps/unix/sysv/linux/m68k/getpagesize.c index bbabbb1773..ce1048b47d 100644 --- a/sysdeps/unix/sysv/linux/m68k/getpagesize.c +++ b/sysdeps/unix/sysv/linux/m68k/getpagesize.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2000 Free Software Foundation, Inc. +/* Copyright (C) 2000, 2002 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Andreas Schwab <schwab@suse.de>. @@ -21,6 +21,7 @@ #include <sys/param.h> #include <errno.h> +#include <ldsodefs.h> #include <sysdep.h> #include <sys/syscall.h> @@ -28,13 +29,12 @@ int __getpagesize () { - extern size_t _dl_pagesize; #ifdef __NR_getpagesize int result; #endif - if (_dl_pagesize != 0) - return _dl_pagesize; + if (GL(dl_pagesize) != 0) + return GL(dl_pagesize); #ifdef __NR_getpagesize result = INLINE_SYSCALL (getpagesize, 0); diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/getpagesize.c b/sysdeps/unix/sysv/linux/sparc/sparc32/getpagesize.c index db7f98b959..8bd47325b1 100644 --- a/sysdeps/unix/sysv/linux/sparc/sparc32/getpagesize.c +++ b/sysdeps/unix/sysv/linux/sparc/sparc32/getpagesize.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1997 Free Software Foundation, Inc. +/* Copyright (C) 1997, 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 @@ -18,6 +18,7 @@ #include <unistd.h> #include <sys/param.h> +#include <ldsodefs.h> /* Return the system page size. This value will either be 4k or 8k depending on whether or not we are running on Sparc v9 machine. */ @@ -26,16 +27,14 @@ via the AT_PAGESZ auxiliary argument. If we are a static program, we use the getpagesize system call. */ -size_t _dl_pagesize; - extern size_t __syscall_getpagesize(void); int __getpagesize () { - if (_dl_pagesize == 0) - _dl_pagesize = __syscall_getpagesize(); - return _dl_pagesize; + if (GL(dl_pagesize) == 0) + GL(dl_pagesize) = __syscall_getpagesize(); + return GL(dl_pagesize); } weak_alias (__getpagesize, getpagesize) diff --git a/sysdeps/x86_64/Versions b/sysdeps/x86_64/Versions deleted file mode 100644 index 42386f4dcc..0000000000 --- a/sysdeps/x86_64/Versions +++ /dev/null @@ -1,5 +0,0 @@ -ld { - GLIBC_2.2.5 { - _dl_cpuclock_offset; - } -} diff --git a/sysdeps/x86_64/dl-machine.h b/sysdeps/x86_64/dl-machine.h index 955239dd27..504c75e01b 100644 --- a/sysdeps/x86_64/dl-machine.h +++ b/sysdeps/x86_64/dl-machine.h @@ -1,5 +1,5 @@ /* Machine-dependent ELF dynamic relocation inline functions. x86-64 version. - Copyright (C) 2001 Free Software Foundation, Inc. + Copyright (C) 2001, 2002 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Andreas Jaeger <aj@suse.de>. @@ -96,10 +96,10 @@ elf_machine_runtime_setup (struct link_map *l, int lazy, int profile) { got[2] = (Elf64_Addr) &_dl_runtime_profile; - if (_dl_name_match_p (_dl_profile, l)) + if (_dl_name_match_p (GL(dl_profile), l)) /* This is the object we are looking for. Say that we really want profiling and the timers are started. */ - _dl_profile_map = l; + GL(dl_profile_map) = l; } else /* This function will get called to fix up the GOT entry indicated by @@ -250,7 +250,7 @@ _dl_start_user:\n\ # argc -> rsi\n\ movq %rdx, %rsi\n\ # _dl_loaded -> rdi\n\ - movq _dl_loaded@GOTPCREL(%rip), %rdi\n\ + movq _rtld_global@GOTPCREL(%rip), %rdi\n\ movq (%rdi), %rdi\n\ # env -> rcx\n\ leaq 16(%rsp,%rdx,8), %rcx\n\ @@ -283,14 +283,12 @@ _dl_start_user:\n\ _dl_sysdep_start. */ #define DL_PLATFORM_INIT dl_platform_init () -extern const char *_dl_platform; - static inline void __attribute__ ((unused)) dl_platform_init (void) { - if (_dl_platform != NULL && *_dl_platform == '\0') + if (GL(dl_platform) != NULL && *GL(dl_platform) == '\0') /* Avoid an empty string which would disturb us. */ - _dl_platform = NULL; + GL(dl_platform) = NULL; } static inline Elf64_Addr @@ -334,8 +332,10 @@ elf_machine_rela (struct link_map *map, const Elf64_Rela *reloc, (i.e. #ifdef RTLD_BOOTSTRAP) because rtld.c contains the common defn for _dl_rtld_map, which is incompatible with a weak decl in the same file. */ - weak_extern (_dl_rtld_map); - if (map != &_dl_rtld_map) /* Already done in rtld itself. */ +# ifndef SHARED + weak_extern (GL(dl_rtld_map)); +# endif + if (map != &GL(dl_rtld_map)) /* Already done in rtld itself. */ # endif *reloc_addr = map->l_addr + reloc->r_addend; } @@ -379,7 +379,7 @@ elf_machine_rela (struct link_map *map, const Elf64_Rela *reloc, break; if (__builtin_expect (sym->st_size > refsym->st_size, 0) || (__builtin_expect (sym->st_size < refsym->st_size, 0) - && _dl_verbose)) + && GL(dl_verbose))) { const char *strtab; |