aboutsummaryrefslogtreecommitdiff
path: root/elf
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2002-01-31 03:41:25 +0000
committerUlrich Drepper <drepper@redhat.com>2002-01-31 03:41:25 +0000
commitd6b5d570a3255d8dc80e07c3674594574cd98fe7 (patch)
tree36e05b0d065614559820d2a4f43bb1076ea5cfa1 /elf
parent1b4575aefaaa43adfed4658f7d66de587f12120e (diff)
downloadglibc-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 'elf')
-rw-r--r--elf/Versions27
-rw-r--r--elf/dl-addr.c4
-rw-r--r--elf/dl-close.c32
-rw-r--r--elf/dl-conflict.c27
-rw-r--r--elf/dl-debug.c4
-rw-r--r--elf/dl-deps.c20
-rw-r--r--elf/dl-dst.h4
-rw-r--r--elf/dl-error.c2
-rw-r--r--elf/dl-fini.c20
-rw-r--r--elf/dl-init.c15
-rw-r--r--elf/dl-iteratephdr.c4
-rw-r--r--elf/dl-libc.c8
-rw-r--r--elf/dl-load.c98
-rw-r--r--elf/dl-lookup.c33
-rw-r--r--elf/dl-minimal.c9
-rw-r--r--elf/dl-object.c12
-rw-r--r--elf/dl-open.c52
-rw-r--r--elf/dl-profile.c23
-rw-r--r--elf/dl-profstub.c6
-rw-r--r--elf/dl-reloc.c18
-rw-r--r--elf/dl-runtime.c6
-rw-r--r--elf/dl-support.c29
-rw-r--r--elf/dl-sym.c26
-rw-r--r--elf/dl-version.c17
-rw-r--r--elf/do-lookup.h4
-rw-r--r--elf/do-rel.h8
-rw-r--r--elf/dynamic-link.h7
-rw-r--r--elf/rtld.c320
28 files changed, 397 insertions, 438 deletions
diff --git a/elf/Versions b/elf/Versions
index 0c3480450f..5c8da22843 100644
--- a/elf/Versions
+++ b/elf/Versions
@@ -35,12 +35,12 @@ ld {
# Those are in the dynamic linker, but used by libc.so.
__libc_enable_secure; _dl_catch_error; _dl_check_all_versions;
- _dl_debug_initialize; _dl_debug_state; _dl_default_scope;
- _dl_global_scope_end; _dl_lookup_symbol;
+ _dl_debug_initialize; _dl_debug_state;
+ _dl_lookup_symbol;
_dl_map_object; _dl_map_object_deps; _dl_object_relocation_scope;
_dl_relocate_object; _dl_signal_error; _dl_starting_up;
_dl_sysdep_start; _r_debug;
- _dl_global_scope; _dl_lookup_symbol_skip;
+ _dl_lookup_symbol_skip;
_dl_lookup_versioned_symbol; _dl_lookup_versioned_symbol_skip;
# Function from libc.so which must be shared with libc.
@@ -48,31 +48,28 @@ ld {
}
GLIBC_2.1 {
# global variables
- _dl_profile; _dl_profile_map; _dl_profile_output; _dl_start_profile;
- _dl_loaded; _dl_main_searchlist; _dl_fpu_control; _dl_initial_searchlist;
- _dl_global_scope_alloc; __libc_stack_end;
+ _dl_fpu_control; __libc_stack_end;
# functions used in other libraries
- _dl_mcount; _dl_unload_cache;
+ _dl_start_profile; _dl_mcount; _dl_unload_cache;
}
GLIBC_2.1.1 {
# global variables
- _dl_lazy; _dl_origin_path; _dl_platformlen;
+ _dl_lazy;
# functions used in other libraries
_dl_dst_count; _dl_dst_substitute;
}
GLIBC_2.2 {
- _dl_init; _dl_load_lock; _dl_argv; _dl_nloaded; _dl_check_map_versions;
-
- # this is defined in ld.so and overridden by libc
- _dl_init_first;
+ _dl_init; _dl_load_lock; _dl_argv; _dl_check_map_versions;
# variables used elsewhere
- _dl_out_of_memory; _dl_all_dirs; _dl_init_all_dirs;
- _dl_clktck; _dl_pagesize;
+ _dl_out_of_memory;
}
GLIBC_2.2.3 {
- _dl_debug_mask; _dl_debug_printf;
+ _dl_debug_printf;
+ }
+ GLIBC_2.3 {
+ _rtld_global;
}
}
diff --git a/elf/dl-addr.c b/elf/dl-addr.c
index ebb62858e6..59f1a430b5 100644
--- a/elf/dl-addr.c
+++ b/elf/dl-addr.c
@@ -1,5 +1,5 @@
/* Locate the shared object symbol nearest a given address.
- Copyright (C) 1996-2000, 2001 Free Software Foundation, Inc.
+ Copyright (C) 1996-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
@@ -34,7 +34,7 @@ _dl_addr (const void *address, Dl_info *info)
/* Find the highest-addressed object that ADDRESS is not below. */
match = NULL;
- for (l = _dl_loaded; l; l = l->l_next)
+ for (l = GL(dl_loaded); l; l = l->l_next)
if (addr >= l->l_map_start && addr < l->l_map_end)
{
/* We know ADDRESS lies within L if in any shared object.
diff --git a/elf/dl-close.c b/elf/dl-close.c
index de4b91ac03..cece96b7fb 100644
--- a/elf/dl-close.c
+++ b/elf/dl-close.c
@@ -1,5 +1,5 @@
/* Close a shared object opened by `_dl_open'.
- 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
@@ -63,7 +63,7 @@ _dl_close (void *_map)
if (map->l_opencount > 1 || map->l_type != lt_loaded)
{
/* There are still references to this object. Do nothing more. */
- if (__builtin_expect (_dl_debug_mask & DL_DEBUG_FILES, 0))
+ if (__builtin_expect (GL(dl_debug_mask) & DL_DEBUG_FILES, 0))
_dl_debug_printf ("\nclosing file=%s; opencount == %u\n",
map->l_name, map->l_opencount);
@@ -125,7 +125,7 @@ _dl_close (void *_map)
&& imap->l_init_called)
{
/* When debugging print a message first. */
- if (__builtin_expect (_dl_debug_mask & DL_DEBUG_IMPCALLS, 0))
+ if (__builtin_expect (GL(dl_debug_mask) & DL_DEBUG_IMPCALLS, 0))
_dl_debug_printf ("\ncalling fini: %s\n\n", imap->l_name);
/* Call its termination function. */
@@ -192,18 +192,18 @@ _dl_close (void *_map)
if (__builtin_expect (imap->l_global, 0))
{
/* This object is in the global scope list. Remove it. */
- unsigned int cnt = _dl_main_searchlist->r_nlist;
+ unsigned int cnt = GL(dl_main_searchlist)->r_nlist;
do
--cnt;
- while (_dl_main_searchlist->r_list[cnt] != imap);
+ while (GL(dl_main_searchlist)->r_list[cnt] != imap);
/* The object was already correctly registered. */
- while (++cnt < _dl_main_searchlist->r_nlist)
- _dl_main_searchlist->r_list[cnt - 1]
- = _dl_main_searchlist->r_list[cnt];
+ while (++cnt < GL(dl_main_searchlist)->r_nlist)
+ GL(dl_main_searchlist)->r_list[cnt - 1]
+ = GL(dl_main_searchlist)->r_list[cnt];
- --_dl_main_searchlist->r_nlist;
+ --GL(dl_main_searchlist)->r_nlist;
}
/* We can unmap all the maps at once. We determined the
@@ -221,9 +221,9 @@ _dl_close (void *_map)
if (imap->l_prev != NULL)
imap->l_prev->l_next = imap->l_next;
else
- _dl_loaded = imap->l_next;
+ GL(dl_loaded) = imap->l_next;
#endif
- --_dl_nloaded;
+ --GL(dl_nloaded);
if (imap->l_next)
imap->l_next->l_prev = imap->l_prev;
@@ -305,17 +305,17 @@ _dl_close (void *_map)
static void
free_mem (void)
{
- if (__builtin_expect (_dl_global_scope_alloc, 0) != 0
- && _dl_main_searchlist->r_nlist == _dl_initial_searchlist.r_nlist)
+ if (__builtin_expect (GL(dl_global_scope_alloc), 0) != 0
+ && GL(dl_main_searchlist)->r_nlist == GL(dl_initial_searchlist).r_nlist)
{
/* All object dynamically loaded by the program are unloaded. Free
the memory allocated for the global scope variable. */
- struct link_map **old = _dl_main_searchlist->r_list;
+ struct link_map **old = GL(dl_main_searchlist)->r_list;
/* Put the old map in. */
- _dl_main_searchlist->r_list = _dl_initial_searchlist.r_list;
+ GL(dl_main_searchlist)->r_list = GL(dl_initial_searchlist).r_list;
/* Signal that the original map is used. */
- _dl_global_scope_alloc = 0;
+ GL(dl_global_scope_alloc) = 0;
/* Now free the old map. */
free (old);
diff --git a/elf/dl-conflict.c b/elf/dl-conflict.c
index 0f863ac893..3e88e54021 100644
--- a/elf/dl-conflict.c
+++ b/elf/dl-conflict.c
@@ -1,5 +1,5 @@
/* Resolve conflicts against already prelinked libraries.
- 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 Jakub Jelinek <jakub@redhat.com>, 2001.
@@ -28,13 +28,12 @@
#include <sys/types.h>
#include "dynamic-link.h"
-extern unsigned long int _dl_num_cache_relocations; /* in dl-lookup.c */
void
_dl_resolve_conflicts (struct link_map *l, ElfW(Rela) *conflict,
ElfW(Rela) *conflictend)
{
- if (__builtin_expect (_dl_debug_mask & DL_DEBUG_RELOC, 0))
+ 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]);
@@ -45,25 +44,21 @@ _dl_resolve_conflicts (struct link_map *l, ElfW(Rela) *conflict,
/* This macro is used as a callback from the ELF_DYNAMIC_RELOCATE code. */
#define RESOLVE_MAP(ref, version, flags) (*ref = NULL, 0)
#define RESOLVE(ref, version, flags) (*ref = NULL, 0)
-#define RESOLVE_CONFLICT_FIND_MAP(map, r_offset) \
-do \
- { \
- while ((resolve_conflict_map->l_map_end \
- < (ElfW(Addr))(r_offset)) \
- || (resolve_conflict_map->l_map_start \
- > (ElfW(Addr))(r_offset))) \
- resolve_conflict_map \
- = resolve_conflict_map->l_next; \
- (map) = resolve_conflict_map; \
+#define RESOLVE_CONFLICT_FIND_MAP(map, r_offset) \
+ do { \
+ while ((resolve_conflict_map->l_map_end < (ElfW(Addr)) (r_offset)) \
+ || (resolve_conflict_map->l_map_start > (ElfW(Addr)) (r_offset))) \
+ resolve_conflict_map = resolve_conflict_map->l_next; \
+ \
+ (map) = resolve_conflict_map; \
} while (0)
struct link_map *resolve_conflict_map __attribute__ ((__unused__))
- = _dl_loaded;
-
+ = GL(dl_loaded);
#include "dynamic-link.h"
- _dl_num_cache_relocations += conflictend - conflict;
+ GL(dl_num_cache_relocations) += conflictend - conflict;
for (; conflict < conflictend; ++conflict)
elf_machine_rela (l, conflict, NULL, NULL, (void *) conflict->r_offset);
diff --git a/elf/dl-debug.c b/elf/dl-debug.c
index 5a51b53357..4e8197227e 100644
--- a/elf/dl-debug.c
+++ b/elf/dl-debug.c
@@ -1,5 +1,5 @@
/* Communicate dynamic linker state to the debugger at runtime.
- Copyright (C) 1996, 1998, 2000 Free Software Foundation, Inc.
+ Copyright (C) 1996, 1998, 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
@@ -39,7 +39,7 @@ _dl_debug_initialize (ElfW(Addr) ldbase)
/* Tell the debugger where to find the map of loaded objects. */
_r_debug.r_version = 1 /* R_DEBUG_VERSION XXX */;
_r_debug.r_ldbase = ldbase;
- _r_debug.r_map = _dl_loaded;
+ _r_debug.r_map = GL(dl_loaded);
_r_debug.r_brk = (ElfW(Addr)) &_dl_debug_state;
}
diff --git a/elf/dl-deps.c b/elf/dl-deps.c
index af39de1023..368ad2d557 100644
--- a/elf/dl-deps.c
+++ b/elf/dl-deps.c
@@ -1,5 +1,5 @@
/* Load the dependencies of a mapped object.
- 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
@@ -39,12 +39,6 @@
#define FILTERTAG (DT_NUM + DT_THISPROCNUM + DT_VERSIONTAGNUM \
+ DT_EXTRATAGIDX (DT_FILTER))
-/* 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. */
-size_t _dl_global_scope_alloc;
-
-extern size_t _dl_platformlen;
/* When loading auxiliary objects we must ignore errors. It's ok if
an object is missing. */
@@ -131,7 +125,7 @@ empty dynamics string token substitution")); \
else \
{ \
/* This is for DT_AUXILIARY. */ \
- if (__builtin_expect (_dl_debug_mask & DL_DEBUG_LIBS, 0)) \
+ if (__builtin_expect (GL(dl_debug_mask) & DL_DEBUG_LIBS, 0)) \
_dl_debug_printf ("cannot load auxiliary `%s' because of" \
"empty dynamic string token " \
"substitution\n", __str); \
@@ -294,7 +288,8 @@ _dl_map_object_deps (struct link_map *map,
int err;
/* Say that we are about to load an auxiliary library. */
- if (__builtin_expect (_dl_debug_mask & DL_DEBUG_LIBS, 0))
+ if (__builtin_expect (GL(dl_debug_mask) & DL_DEBUG_LIBS,
+ 0))
_dl_debug_printf ("load auxiliary object=%s"
" requested by file=%s\n", name,
l->l_name[0]
@@ -320,7 +315,8 @@ _dl_map_object_deps (struct link_map *map,
int err;
/* Say that we are about to load an auxiliary library. */
- if (__builtin_expect (_dl_debug_mask & DL_DEBUG_LIBS, 0))
+ if (__builtin_expect (GL(dl_debug_mask) & DL_DEBUG_LIBS,
+ 0))
_dl_debug_printf ("load filtered object=%s"
" requested by file=%s\n", name,
l->l_name[0]
@@ -507,8 +503,8 @@ _dl_map_object_deps (struct link_map *map,
runp->map->l_reserved = 0;
}
- if (__builtin_expect(_dl_debug_mask & DL_DEBUG_PRELINK, 0) != 0
- && map == _dl_loaded)
+ if (__builtin_expect(GL(dl_debug_mask) & DL_DEBUG_PRELINK, 0) != 0
+ && map == GL(dl_loaded))
{
/* If we are to compute conflicts, we have to build local scope
for each library, not just the ultimate loader. */
diff --git a/elf/dl-dst.h b/elf/dl-dst.h
index 2ebd4d9636..af4a94a3b3 100644
--- a/elf/dl-dst.h
+++ b/elf/dl-dst.h
@@ -1,5 +1,5 @@
/* Handling of dynamic sring tokens.
- Copyright (C) 1999, 2001 Free Software Foundation, Inc.
+ Copyright (C) 1999, 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
@@ -57,7 +57,7 @@ extern size_t _dl_dst_count (const char *name, int is_path);
else \
origin_len = (l)->l_origin == (char *) -1 ? 0 : strlen ((l)->l_origin); \
\
- __len + cnt * (MAX (origin_len, _dl_platformlen) - 7); })
+ __len + cnt * (MAX (origin_len, GL(dl_platformlen)) - 7); })
/* Find origin of the executable. */
extern const char *_dl_get_origin (void);
diff --git a/elf/dl-error.c b/elf/dl-error.c
index be9a84361c..922de5caeb 100644
--- a/elf/dl-error.c
+++ b/elf/dl-error.c
@@ -1,5 +1,5 @@
/* Error handling for runtime dynamic linker.
- 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
diff --git a/elf/dl-fini.c b/elf/dl-fini.c
index fc4f4b68a6..e8533a471c 100644
--- a/elf/dl-fini.c
+++ b/elf/dl-fini.c
@@ -1,5 +1,5 @@
/* Call the termination functions of loaded shared objects.
- Copyright (C) 1995,96,98,99,2000,2001 Free Software Foundation, Inc.
+ Copyright (C) 1995,96,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
@@ -47,15 +47,15 @@ _dl_fini (void)
struct link_map **maps;
/* XXX Could it be (in static binaries) that there is no object loaded? */
- assert (_dl_nloaded > 0);
+ assert (GL(dl_nloaded) > 0);
/* Now we can allocate an array to hold all the pointers and copy
the pointers in. */
- maps = (struct link_map **) alloca (_dl_nloaded
+ maps = (struct link_map **) alloca (GL(dl_nloaded)
* sizeof (struct link_map *));
- for (l = _dl_loaded, i = 0; l != NULL; l = l->l_next)
+ for (l = GL(dl_loaded), i = 0; l != NULL; l = l->l_next)
{
- assert (i < _dl_nloaded);
+ assert (i < GL(dl_nloaded));
maps[i++] = l;
@@ -63,10 +63,10 @@ _dl_fini (void)
from underneath us. */
++l->l_opencount;
}
- assert (i == _dl_nloaded);
+ assert (i == GL(dl_nloaded));
/* Now we have to do the sorting. */
- for (l = _dl_loaded->l_next; l != NULL; l = l->l_next)
+ for (l = GL(dl_loaded)->l_next; l != NULL; l = l->l_next)
{
unsigned int j;
unsigned int k;
@@ -77,7 +77,7 @@ _dl_fini (void)
/* Find all object for which the current one is a dependency and
move the found object (if necessary) in front. */
- for (k = j + 1; k < _dl_nloaded; ++k)
+ for (k = j + 1; k < GL(dl_nloaded); ++k)
{
struct link_map **runp;
@@ -128,7 +128,7 @@ _dl_fini (void)
/* `maps' now contains the objects in the right order. Now call the
destructors. We have to process this array from the front. */
- for (i = 0; i < _dl_nloaded; ++i)
+ for (i = 0; i < GL(dl_nloaded); ++i)
{
l = maps[i];
@@ -146,7 +146,7 @@ _dl_fini (void)
continue;
/* When debugging print a message first. */
- if (__builtin_expect (_dl_debug_mask & DL_DEBUG_IMPCALLS, 0))
+ if (__builtin_expect (GL(dl_debug_mask) & DL_DEBUG_IMPCALLS, 0))
_dl_debug_printf ("\ncalling fini: %s\n\n",
l->l_name[0] ? l->l_name : _dl_argv[0]);
diff --git a/elf/dl-init.c b/elf/dl-init.c
index 5448b03c33..700efc58e5 100644
--- a/elf/dl-init.c
+++ b/elf/dl-init.c
@@ -1,5 +1,5 @@
/* Return the next shared object initializer function not yet run.
- Copyright (C) 1995,1996,1998,1999,2000,2001 Free Software Founda