diff options
-rw-r--r-- | ChangeLog | 39 | ||||
-rw-r--r-- | bits/types.h | 3 | ||||
-rw-r--r-- | elf/Versions | 1 | ||||
-rw-r--r-- | elf/dl-deps.c | 100 | ||||
-rw-r--r-- | elf/dl-object.c | 1 | ||||
-rw-r--r-- | elf/dl-open.c | 70 | ||||
-rw-r--r-- | elf/ldsodefs.h | 7 | ||||
-rw-r--r-- | elf/rtld.c | 6 | ||||
-rw-r--r-- | posix/glob.h | 6 | ||||
-rw-r--r-- | posix/ptestcases.h | 3 | ||||
-rw-r--r-- | sysdeps/generic/bits/types.h | 3 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/bits/sockunion.h | 2 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/i386/sysdep.h | 22 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/netatalk/at.h | 2 | ||||
-rw-r--r-- | time/tzset.c | 13 |
15 files changed, 179 insertions, 99 deletions
@@ -1,5 +1,44 @@ 1998-11-02 Ulrich Drepper <drepper@cygnus.com> + * elf/Versions [libc, GLIBC_2.01]: Add _dl_global_scope_alloc. + * elf/dl-open.c (_dl_global_scope_alloc): Move definition to + * elf/dl-deps.c: ...here. + * elf/dl-open.c (dl_open_worker): Call _dl_map_object_deps with + new parameter and expect result. Remove code handling RTLD_GLOBAL. + Add return value of _dl_map_object_deps to + _dl_main_searchlist->r_nlist. + * elf/dl-deps.c (_dl_map_object_deps): Change to return value. + If we parameter GLOBAL is nonzero add object and dependencies to + the global scope. + * elf/ldsodefs.h: Adapt prototype for _dl_map_object_deps. + * elf/rtld.c (dl_main): Call _dl_map_object_deps with new parameter. + Mark all objects as in global scope. + * elf/dl-object.c (_dl_new_object): Initialize l_global to zero. + + * sysdeps/unix/sysv/linux/bits/sockunion.h: Add Econet support. + + * sysdeps/unix/sysv/linux/i386/sysdep.h: Add .L prefix to symbols + used in macro magic. + +1998-11-02 Andreas Jaeger <aj@arthur.rhein-neckar.de> + + * sysdeps/unix/sysv/linux/netatalk/at.h: Include <linux/atalk.h> + before <sys/socket.h> to make sockaddr_at available to + <sys/socket.h>. + + * posix/glob.h: Remove __P from parameter lists of declarations. + +1998-11-02 Andreas Jaeger <aj@arthur.rhein-neckar.de> + + * time/tzset.c (tz_compute): Remove unused parameter timer. + Change caller. + +1998-11-02 Mark Kettenis <kettenis@phys.uva.nl> + + * sysdeps/generic/bits/types.h (__ipc_pid_t): New typedef. + +1998-11-02 Ulrich Drepper <drepper@cygnus.com> + * sysdeps/unix/sysv/linux/i386/setgroups.c (setgroups): Remove unnecessary test and add cast. diff --git a/bits/types.h b/bits/types.h index 8bb6c78..e34ad72 100644 --- a/bits/types.h +++ b/bits/types.h @@ -109,6 +109,9 @@ typedef struct #endif } __fd_set; +/* XXX Used in `struct shmid_ds'. */ +typedef unsigned short int __ipc_pid_t; + /* Types from the Large File Support interface. */ diff --git a/elf/Versions b/elf/Versions index 5e10adf..c8bea74 100644 --- a/elf/Versions +++ b/elf/Versions @@ -20,6 +20,7 @@ libc { # 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; # functions used in other libraries _dl_mcount; _dl_mcount_wrapper; _dl_mcount_wrapper_check; _dl_unload_cache; diff --git a/elf/dl-deps.c b/elf/dl-deps.c index f08f652..04c4010 100644 --- a/elf/dl-deps.c +++ b/elf/dl-deps.c @@ -34,6 +34,11 @@ #define FILTERTAG (DT_NUM + DT_PROCNUM + 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; + /* When loading auxiliary objects we must ignore errors. It's ok if an object is missing. */ @@ -79,11 +84,11 @@ struct list }; -void +unsigned int internal_function _dl_map_object_deps (struct link_map *map, struct link_map **preloads, unsigned int npreloads, - int trace_mode) + int trace_mode, int global_scope) { struct list known[1 + npreloads + 1]; struct list *runp, *utail, *dtail; @@ -158,7 +163,7 @@ _dl_map_object_deps (struct link_map *map, orig = runp; for (d = l->l_ld; d->d_tag != DT_NULL; ++d) - if (d->d_tag == DT_NEEDED) + if (__builtin_expect (d->d_tag, DT_NEEDED) == DT_NEEDED) { /* Map in the needed object. */ struct link_map *dep @@ -392,13 +397,98 @@ _dl_map_object_deps (struct link_map *map, map->l_searchlist.r_duplist = map->l_searchlist.r_list; else { + unsigned int cnt; + map->l_searchlist.r_duplist = malloc (nduplist * sizeof (struct link_map *)); if (map->l_searchlist.r_duplist == NULL) _dl_signal_error (ENOMEM, map->l_name, "cannot allocate symbol search list"); - for (nlist = 0, runp = known; runp; runp = runp->dup) - map->l_searchlist.r_duplist[nlist++] = runp->map; + for (cnt = 0, runp = known; runp; runp = runp->dup) + map->l_searchlist.r_duplist[cnt++] = runp->map; } + + /* Now that all this succeeded put the objects in the global scope if + this is necessary. We put the original object and all the dependencies + in the global scope. If an object is already loaded and not in the + global scope we promote it. */ + if (global_scope) + { + unsigned int cnt; + unsigned int to_add = 0; + struct link_map **new_global; + + /* Count the objects we have to put in the global scope. */ + for (cnt = 0; cnt < nlist; ++cnt) + if (map->l_searchlist.r_list[cnt]->l_global == 0) + ++to_add; + + /* The symbols of the new objects and its dependencies are to be + introduced into the global scope that will be used to resolve + references from other dynamically-loaded objects. + + The global scope is the searchlist in the main link map. We + extend this list if necessary. There is one problem though: + since this structure was allocated very early (before the libc + is loaded) the memory it uses is allocated by the malloc()-stub + in the ld.so. When we come here these functions are not used + anymore. Instead the malloc() implementation of the libc is + used. But this means the block from the main map cannot be used + in an realloc() call. Therefore we allocate a completely new + array the first time we have to add something to the locale scope. */ + + if (_dl_global_scope_alloc == 0) + { + /* This is the first dynamic object given global scope. */ + _dl_global_scope_alloc = _dl_main_searchlist->r_nlist + to_add + 8; + new_global = (struct link_map **) + malloc (_dl_global_scope_alloc * sizeof (struct link_map *)); + if (new_global == NULL) + { + _dl_global_scope_alloc = 0; + nomem: + _dl_signal_error (ENOMEM, map->l_libname->name, + "cannot extend global scope"); + return 0; + } + + /* Copy over the old entries. */ + memcpy (new_global, _dl_main_searchlist->r_list, + (_dl_main_searchlist->r_nlist * sizeof (struct link_map *))); + + _dl_main_searchlist->r_list = new_global; + } + else if (_dl_main_searchlist->r_nlist + to_add > _dl_global_scope_alloc) + { + /* We have to extend the existing array of link maps in the + main map. */ + new_global = (struct link_map **) + realloc (_dl_main_searchlist->r_list, + ((_dl_global_scope_alloc + to_add + 8) + * sizeof (struct link_map *))); + if (new_global == NULL) + goto nomem; + + _dl_global_scope_alloc += to_add + 8; + _dl_main_searchlist->r_list = new_global; + } + + /* Now add the new entries. */ + to_add = 0; + for (cnt = 0; cnt < nlist; ++cnt) + if (map->l_searchlist.r_list[cnt]->l_global == 0) + { + map->l_searchlist.r_list[cnt]->l_global = 1; + _dl_main_searchlist->r_list[_dl_main_searchlist->r_nlist + to_add] + = map->l_searchlist.r_list[cnt]; + ++to_add; + } + + /* XXX Do we have to add something to r_dupsearchlist??? --drepper */ + + return to_add; + } + + return 0; } diff --git a/elf/dl-object.c b/elf/dl-object.c index 297f30e..ec05abd 100644 --- a/elf/dl-object.c +++ b/elf/dl-object.c @@ -48,6 +48,7 @@ _dl_new_object (char *realname, const char *libname, int type, new->l_libname = newname; new->l_type = type; new->l_loader = loader; + new->l_global = 0; /* Counter for the scopes we have to handle. */ idx = 0; diff --git a/elf/dl-open.c b/elf/dl-open.c index 83e6424..9bbbee8 100644 --- a/elf/dl-open.c +++ b/elf/dl-open.c @@ -42,11 +42,6 @@ extern char **__libc_argv; extern char **__environ; -/* 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; - /* During the program run we must not modify the global data of loaded shared object simultanously in two threads. Therefore we @@ -77,6 +72,7 @@ dl_open_worker (void *a) struct link_map *new, *l; ElfW(Addr) init; struct r_debug *r; + unsigned int global_add; /* Load the named object. */ args->map = new = _dl_map_object (NULL, file, 0, lt_loaded, 0); @@ -85,7 +81,7 @@ dl_open_worker (void *a) return; /* Load that object's dependencies. */ - _dl_map_object_deps (new, NULL, 0, 0); + global_add = _dl_map_object_deps (new, NULL, 0, 0, mode & RTLD_GLOBAL); /* So far, so good. Now check the versions. */ (void) _dl_check_all_versions (new, 0); @@ -127,66 +123,6 @@ dl_open_worker (void *a) l = l->l_prev; } - new->l_global = (mode & RTLD_GLOBAL) ? 1 : 0; - if (new->l_global) - { - struct link_map **new_global; - - /* The symbols of the new object and its dependencies are to be - introduced into the global scope that will be used to resolve - references from other dynamically-loaded objects. - - The global scope is the searchlist in the main link map. We - extend this list if necessary. There is one problem though: - since this structure was allocated very early (before the libc - is loaded) the memory it uses is allocated by the malloc()-stub - in the ld.so. When we come here these functions are not used - anymore. Instead the malloc() implementation of the libc is - used. But this means the block from the main map cannot be used - in an realloc() call. Therefore we allocate a completely new - array the first time we have to add something to the locale scope. */ - if (_dl_global_scope_alloc == 0) - { - /* This is the first dynamic object given global scope. */ - _dl_global_scope_alloc = _dl_main_searchlist->r_nlist + 8; - new_global = (struct link_map **) - malloc (_dl_global_scope_alloc * sizeof (struct link_map *)); - if (new_global == NULL) - { - _dl_global_scope_alloc = 0; - nomem: - new->l_global = 0; - _dl_signal_error (ENOMEM, file, "cannot extend global scope"); - } - - /* Copy over the old entries. */ - memcpy (new_global, _dl_main_searchlist->r_list, - (_dl_main_searchlist->r_nlist * sizeof (struct link_map *))); - - _dl_main_searchlist->r_list = new_global; - } - else if (_dl_main_searchlist->r_nlist == _dl_global_scope_alloc) - { - /* We have to extend the existing array of link maps in the - main map. */ - new_global = (struct link_map **) - realloc (_dl_main_searchlist->r_list, - ((_dl_global_scope_alloc + 8) - * sizeof (struct link_map *))); - if (new_global == NULL) - goto nomem; - - _dl_global_scope_alloc += 8; - _dl_main_searchlist->r_list = new_global; - } - - /* Now add the new entry. */ - _dl_main_searchlist->r_list[_dl_main_searchlist->r_nlist] = new; - - /* XXX Do we have to add something to r_dupsearchlist??? --drepper */ - } - - /* Notify the debugger we have added some objects. We need to call _dl_debug_initialize in a static program in case dynamic linking has not been used before. */ @@ -201,7 +137,7 @@ dl_open_worker (void *a) if (new->l_global) /* Now we can make the new map available in the global scope. */ - ++_dl_main_searchlist->r_nlist; + _dl_main_searchlist->r_nlist += global_add; if (_dl_sysdep_start == NULL) /* We must be the static _dl_open in libc.a. A static program that diff --git a/elf/ldsodefs.h b/elf/ldsodefs.h index 7d0bdda..97ab955 100644 --- a/elf/ldsodefs.h +++ b/elf/ldsodefs.h @@ -249,9 +249,10 @@ extern struct link_map *_dl_map_object (struct link_map *loader, MAP->l_searchlist. PRELOADS points to a vector of NPRELOADS previously loaded objects that will be inserted into MAP->l_searchlist after MAP but before its dependencies. */ -extern void _dl_map_object_deps (struct link_map *map, - struct link_map **preloads, - unsigned int npreloads, int trace_mode) +extern unsigned int _dl_map_object_deps (struct link_map *map, + struct link_map **preloads, + unsigned int npreloads, + int trace_mode, int global_scope) internal_function; /* Cache the locations of MAP's hash table. */ @@ -667,7 +667,11 @@ of this helper program; chances are you did not intend to run this program.\n\ /* Load all the libraries specified by DT_NEEDED entries. If LD_PRELOAD specified some libraries to load, these are inserted before the actual dependencies in the executable's searchlist for symbol resolution. */ - _dl_map_object_deps (_dl_loaded, preloads, npreloads, mode == trace); + _dl_map_object_deps (_dl_loaded, preloads, npreloads, mode == trace, 0); + + /* Mark all objects as being in the global scope. */ + for (i = _dl_loaded->l_searchlist.r_nlist; i > 0; ) + _dl_loaded->l_searchlist.r_list[--i]->l_global = 1; #ifndef MAP_ANON /* We are done mapping things, so close the zero-fill descriptor. */ diff --git a/posix/glob.h b/posix/glob.h index 55208e1..bf0759c 100644 --- a/posix/glob.h +++ b/posix/glob.h @@ -150,7 +150,7 @@ typedef struct Otherwise, `glob' returns zero. */ #if _FILE_OFFSET_BITS != 64 extern int glob __P ((__const char *__pattern, int __flags, - int (*__errfunc) __P ((__const char *, int)), + int (*__errfunc) (__const char *, int), glob_t *__pglob)); /* Free storage allocated in PGLOB by a previous `glob' call. */ @@ -158,7 +158,7 @@ extern void globfree __P ((glob_t *__pglob)); #else # if __GNUC__ >= 2 extern int glob __P ((__const char *__pattern, int __flags, - int (*__errfunc) __P ((__const char *, int)), + int (*__errfunc) (__const char *, int), glob_t *__pglob)) __asm__ ("glob64"); extern void globfree __P ((glob_t *__pglob)) __asm__ ("globfree64"); @@ -170,7 +170,7 @@ extern void globfree __P ((glob_t *__pglob)) __asm__ ("globfree64"); #ifdef _LARGEFILE64_SOURCE extern int glob64 __P ((__const char *__pattern, int __flags, - int (*__errfunc) __P ((__const char *, int)), + int (*__errfunc) (__const char *, int), glob64_t *__pglob)); extern void globfree64 __P ((glob64_t *__pglob)); diff --git a/posix/ptestcases.h b/posix/ptestcases.h index e025ab8..2f41178 100644 --- a/posix/ptestcases.h +++ b/posix/ptestcases.h @@ -43,6 +43,7 @@ { -1, -1, "\\(^*b\\)", "a*b", }, { -1, -1, "\\(^*b\\)", "^*b", }, { 0, 0, "GA113(2)", NULL, }, + { -1, -1, "\\(^*ab\\)", "*ab", }, { -1, -1, "\\(^*ab\\)", "^*ab", }, { 1, 1, "\\(^*b\\)", "b", }, { 1, 3, "\\(^*b\\)", "^^b", }, @@ -66,7 +67,7 @@ { 1, 2, "\\$a", "$a", }, { 3, 3, "\\$$", "ab$", }, { 2, 6, "A\\([34]$[34]\\)B", "XA4$3BY", }, - { 0, 0, "2.8.3.1.3 Periods in BREs", NULL, }, + { 0, 0, "2.8.3.1.3 Perios in BREs", NULL, }, { 0, 0, "GA116", NULL, }, { 1, 1, ".", "abc", }, { -1, -1, ".ab", "abc", }, diff --git a/sysdeps/generic/bits/types.h b/sysdeps/generic/bits/types.h index 8bb6c78..e34ad72 100644 --- a/sysdeps/generic/bits/types.h +++ b/sysdeps/generic/bits/types.h @@ -109,6 +109,9 @@ typedef struct #endif } __fd_set; +/* XXX Used in `struct shmid_ds'. */ +typedef unsigned short int __ipc_pid_t; + /* Types from the Large File Support interface. */ diff --git a/sysdeps/unix/sysv/linux/bits/sockunion.h b/sysdeps/unix/sysv/linux/bits/sockunion.h index 1645e6e..c65cf84 100644 --- a/sysdeps/unix/sysv/linux/bits/sockunion.h +++ b/sysdeps/unix/sysv/linux/bits/sockunion.h @@ -24,6 +24,7 @@ #include <netash/ash.h> #include <netatalk/at.h> #include <netax25/ax25.h> +#include <neteconet/ec.h> #include <netinet/in.h> #include <netipx/ipx.h> #include <netrose/rose.h> @@ -37,6 +38,7 @@ union sockaddr_union struct sockaddr_ash sash; struct sockaddr_at sat; struct sockaddr_ax25 sax25; + struct sockaddr_ec sec; struct sockaddr_in sin; struct sockaddr_in6 sin6; struct sockaddr_ipx sipx; diff --git a/sysdeps/unix/sysv/linux/i386/sysdep.h b/sysdeps/unix/sysv/linux/i386/sysdep.h index 910cf3f..a6971ff 100644 --- a/sysdeps/unix/sysv/linux/i386/sysdep.h +++ b/sysdeps/unix/sysv/linux/i386/sysdep.h @@ -202,14 +202,14 @@ /* We need some help from the assembler to generate optimal code. We define some macros here which later will be used. */ -asm ("__X'%ebx = 1\n\t" - "__X'%ecx = 2\n\t" - "__X'%edx = 2\n\t" - "__X'%eax = 3\n\t" - "__X'%esi = 3\n\t" - "__X'%edi = 3\n\t" - "__X'%ebp = 3\n\t" - "__X'%esp = 3\n\t" +asm (".L__X'%ebx = 1\n\t" + ".L__X'%ecx = 2\n\t" + ".L__X'%edx = 2\n\t" + ".L__X'%eax = 3\n\t" + ".L__X'%esi = 3\n\t" + ".L__X'%edi = 3\n\t" + ".L__X'%ebp = 3\n\t" + ".L__X'%esp = 3\n\t" ".macro bpushl name reg\n\t" ".if 1 - \\name\n\t" ".if 2 - \\name\n\t" @@ -243,11 +243,11 @@ asm ("__X'%ebx = 1\n\t" ({ \ unsigned int resultvar; \ asm volatile ( \ - "bpushl __X'%k2, %k2\n\t" \ - "bmovl __X'%k2, %k2\n\t" \ + "bpushl .L__X'%k2, %k2\n\t" \ + "bmovl .L__X'%k2, %k2\n\t" \ "movl %1, %%eax\n\t" \ "int $0x80\n\t" \ - "bpopl __X'%k2, %k2\n\t" \ + "bpopl .L__X'%k2, %k2\n\t" \ : "=a" (resultvar) \ : "i" (__NR_##name) ASMFMT_##nr(args) : "memory", "cc"); \ if (resultvar >= 0xfffff001) \ diff --git a/sysdeps/unix/sysv/linux/netatalk/at.h b/sysdeps/unix/sysv/linux/netatalk/at.h index 4c58610..83a94f3 100644 --- a/sysdeps/unix/sysv/linux/netatalk/at.h +++ b/sysdeps/unix/sysv/linux/netatalk/at.h @@ -20,8 +20,8 @@ #define _NETATALK_AT_H 1 #include <asm/types.h> -#include <sys/socket.h> #include <linux/atalk.h> +#include <sys/socket.h> #define SOL_ATALK 258 /* sockopt level for atalk */ diff --git a/time/tzset.c b/time/tzset.c index 92e2208..60188c2 100644 --- a/time/tzset.c +++ b/time/tzset.c @@ -84,7 +84,7 @@ static tz_rule tz_rules[2]; static int compute_change __P ((tz_rule *rule, int year)) internal_function; -static int tz_compute __P ((time_t timer, const struct tm *tm)) +static int tz_compute __P ((const struct tm *tm)) internal_function; static void tzset_internal __P ((int always)) internal_function; @@ -508,13 +508,12 @@ compute_change (rule, year) } -/* Figure out the correct timezone for *TIMER and TM (which must be the same) - and set `__tzname', `__timezone', and `__daylight' accordingly. - Return nonzero on success, zero on failure. */ +/* Figure out the correct timezone for TM and set `__tzname', + `__timezone', and `__daylight' accordingly. Return nonzero on + success, zero on failure. */ static int internal_function -tz_compute (timer, tm) - time_t timer; +tz_compute (tm) const struct tm *tm; { if (! compute_change (&tz_rules[0], 1900 + tm->tm_year) @@ -597,7 +596,7 @@ __tz_convert (const time_t *timer, int use_localtime, struct tm *tp) } else { - if (! (__offtime (timer, 0, tp) && tz_compute (*timer, tp))) + if (! (__offtime (timer, 0, tp) && tz_compute (tp))) tp = NULL; leap_correction = 0L; leap_extra_secs = 0; |