diff options
| author | Ulrich Drepper <drepper@redhat.com> | 1999-01-16 17:09:04 +0000 |
|---|---|---|
| committer | Ulrich Drepper <drepper@redhat.com> | 1999-01-16 17:09:04 +0000 |
| commit | 482eec0d1188823ad93247f79bf965886e8bd4f7 (patch) | |
| tree | 5a3157c41a1310f5440de77f841753a32bb1444d | |
| parent | 37a87f834a459f6136ff44c7887b013d1ae0f6be (diff) | |
| download | glibc-482eec0d1188823ad93247f79bf965886e8bd4f7.tar.xz glibc-482eec0d1188823ad93247f79bf965886e8bd4f7.zip | |
Update.
1999-01-16 Ulrich Drepper <drepper@cygnus.com>
* elf/Makefile (tests): Add loadtest.
Add rules to generate test modules.
* Makeconfig (+link): Add $(LDFLAGS-$(@F)) to command line.
* elf/loadtest.c: New file.
* elf/testobj1.c: New file.
* elf/testobj2.c: New file.
* elf/testobj3.c: New file.
* elf/dl-close.c: Correct removing module from global list.
* elf/dl-open.c: Add debugging code.
* include/string.h: Add __rawmemchr prototype.
* string/Makefile (routines): Add rawmemchr.
* string/Versions [GLIBC_2.1]: Add __rawmemchr and rawmemchr.
* string/string.h: Add prototype for rawmemchr.
* string/bits/string2.h: Optimize strchr with rawmemchr.
* sysdeps/generic/rawmemchr.c: New file.
* sysdeps/i386/rawmemchr.c: New file.
* sysdeps/i386/i486/bits/string.h: Add rawmemchr inline code.
Optimize strchr with rawmemchr.
* sysdeps/unix/sysv/linux/bits/posix_opt.h: Define _LFS_LARGEFILE,
_LFS64_LARGEFILE, and _LFS64_STDIO for Unix98.
1999-01-14 Andreas Jaeger <aj@arthur.rhein-neckar.de>
* nis/nis_error.c (nis_errlist): Fix capitilasation.
| -rw-r--r-- | .cvsignore | 1 | ||||
| -rw-r--r-- | ChangeLog | 31 | ||||
| -rw-r--r-- | Makeconfig | 4 | ||||
| -rw-r--r-- | elf/Makefile | 30 | ||||
| -rw-r--r-- | elf/dl-close.c | 13 | ||||
| -rw-r--r-- | elf/dl-open.c | 42 | ||||
| -rw-r--r-- | elf/loadtest.c | 114 | ||||
| -rw-r--r-- | elf/testobj1.c | 11 | ||||
| -rw-r--r-- | elf/testobj2.c | 11 | ||||
| -rw-r--r-- | elf/testobj3.c | 11 | ||||
| -rw-r--r-- | include/string.h | 2 | ||||
| -rw-r--r-- | linuxthreads/ChangeLog | 5 | ||||
| -rw-r--r-- | linuxthreads/sysdeps/unix/sysv/linux/bits/posix_opt.h | 12 | ||||
| -rw-r--r-- | nis/nis_error.c | 16 | ||||
| -rw-r--r-- | string/Makefile | 4 | ||||
| -rw-r--r-- | string/Versions | 7 | ||||
| -rw-r--r-- | string/bits/string2.h | 12 | ||||
| -rw-r--r-- | string/string.h | 8 | ||||
| -rw-r--r-- | sysdeps/generic/rawmemchr.c | 182 | ||||
| -rw-r--r-- | sysdeps/i386/i486/bits/string.h | 30 | ||||
| -rw-r--r-- | sysdeps/i386/rawmemchr.S | 218 | ||||
| -rw-r--r-- | sysdeps/unix/sysv/linux/bits/posix_opt.h | 7 |
22 files changed, 742 insertions, 29 deletions
diff --git a/.cvsignore b/.cvsignore index 9140e6d68e..e823a79689 100644 --- a/.cvsignore +++ b/.cvsignore @@ -23,3 +23,4 @@ crypt linuxthreads libc.prj .libc.prcs_aux +libc.proj .snprj @@ -1,3 +1,34 @@ +1999-01-16 Ulrich Drepper <drepper@cygnus.com> + + * elf/Makefile (tests): Add loadtest. + Add rules to generate test modules. + * Makeconfig (+link): Add $(LDFLAGS-$(@F)) to command line. + * elf/loadtest.c: New file. + * elf/testobj1.c: New file. + * elf/testobj2.c: New file. + * elf/testobj3.c: New file. + + * elf/dl-close.c: Correct removing module from global list. + + * elf/dl-open.c: Add debugging code. + + * include/string.h: Add __rawmemchr prototype. + * string/Makefile (routines): Add rawmemchr. + * string/Versions [GLIBC_2.1]: Add __rawmemchr and rawmemchr. + * string/string.h: Add prototype for rawmemchr. + * string/bits/string2.h: Optimize strchr with rawmemchr. + * sysdeps/generic/rawmemchr.c: New file. + * sysdeps/i386/rawmemchr.c: New file. + * sysdeps/i386/i486/bits/string.h: Add rawmemchr inline code. + Optimize strchr with rawmemchr. + + * sysdeps/unix/sysv/linux/bits/posix_opt.h: Define _LFS_LARGEFILE, + _LFS64_LARGEFILE, and _LFS64_STDIO for Unix98. + +1999-01-14 Andreas Jaeger <aj@arthur.rhein-neckar.de> + + * nis/nis_error.c (nis_errlist): Fix capitilasation. + 1999-01-15 Ulrich Drepper <drepper@cygnus.com> * posix/Makefile (tests): Add test-vfork. diff --git a/Makeconfig b/Makeconfig index dd7a566d49..9cf9fd4c07 100644 --- a/Makeconfig +++ b/Makeconfig @@ -1,4 +1,4 @@ -# Copyright (C) 1991, 92, 93, 94, 95, 96, 97, 98 Free Software Foundation, Inc. +# Copyright (C) 1991,92,93,94,95,96,97,98,99 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 @@ -369,7 +369,7 @@ endif # Command for linking programs with the C library. ifndef +link +link = $(CC) -nostdlib -nostartfiles -o $@ \ - $(sysdep-LDFLAGS) $(config-LDFLAGS) $(LDFLAGS) \ + $(sysdep-LDFLAGS) $(config-LDFLAGS) $(LDFLAGS) $(LDFLAGS-$(@F)) \ $(addprefix $(csu-objpfx),$(start-installed-name)) \ $(+preinit) $(+prector) \ $(filter-out $(addprefix $(csu-objpfx),start.o \ diff --git a/elf/Makefile b/elf/Makefile index 81aa217e3d..e029fbafd0 100644 --- a/elf/Makefile +++ b/elf/Makefile @@ -1,4 +1,4 @@ -# Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc. +# Copyright (C) 1995, 1996, 1997, 1998, 1999 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 @@ -75,6 +75,8 @@ others += ldconfig install-rootsbin += ldconfig endif +tests = loadtest + include ../Rules @@ -200,6 +202,32 @@ else $(objpfx)sprof: $(objpfx)libdl.a endif +# This macro is similar to build-shlib but it does not define a soname +# and it does not depend on the destination name to start with `lib'. +define build-module +$(LINK.o) -shared -o $@ $(sysdep-LDFLAGS) $(config-LDFLAGS) \ + -B$(csu-objpfx) $(load-map-file) \ + $(LDFLAGS.so) $(LDFLAGS-$(@F:%.so=%).so) \ + -L$(subst :, -L,$(rpath-link)) -Wl,-rpath-link=$(rpath-link) \ + -Wl,--whole-archive -Wl,-soname,$(@F) \ + $(filter-out $(map-file) $(+preinit) $(+postinit),$^) \ + $(no-whole-archive) $(LDLIBS-$(@F:%.so=%).so) +endef + +modules-names = testobj1 testobj2 testobj3 +test-modules = $(addprefix $(objpfx),$(addsuffix .so,$(modules-names))) + +$(objpfx)testobj2.so: $(objpfx)testobj1.so +LDLIBS-testobj2.so = $(objpfx)testobj1.so + +$(test-modules): $(objpfx)%.so: %.c + $(build-module) + +$(objpfx)loadtest: $(objpfx)libdl.so +LDFLAGS-loadtest = -rdynamic + +$(objpfx)loadtest.out: $(test-modules) + # muwahaha LDFLAGS-dl.so = -Wl,-dynamic-linker,$(slibdir)/$(rtld-installed-name) diff --git a/elf/dl-close.c b/elf/dl-close.c index 0fbeecc4cd..6a68651d22 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 Free Software Foundation, Inc. + Copyright (C) 1996, 1997, 1998, 1999 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 @@ -108,12 +108,11 @@ _dl_close (struct link_map *map) do --cnt; while (_dl_main_searchlist->r_list[cnt] != imap); - while (cnt < _dl_main_searchlist->r_nlist) - { - _dl_main_searchlist->r_list[0] - = _dl_main_searchlist->r_list[1]; - ++cnt; - } + + while (++cnt < _dl_main_searchlist->r_nlist) + _dl_main_searchlist->r_list[cnt - 1] + = _dl_main_searchlist->r_list[cnt]; + --_dl_main_searchlist->r_nlist; if (_dl_main_searchlist->r_nlist == _dl_initial_searchlist.r_nlist) diff --git a/elf/dl-open.c b/elf/dl-open.c index 8cf1084a94..3db2b0e9f7 100644 --- a/elf/dl-open.c +++ b/elf/dl-open.c @@ -1,5 +1,5 @@ /* Load a shared object at runtime, relocate it, and run its initializer. - Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc. + Copyright (C) 1996, 1997, 1998, 1999 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 @@ -42,6 +42,11 @@ extern char **__libc_argv; extern char **__environ; +/* Undefine the following for debugging. */ +/* #define SCOPE_DEBUG 1 */ +#ifdef SCOPE_DEBUG +static void show_scope (struct link_map *new); +#endif /* During the program run we must not modify the global data of loaded shared object simultanously in two threads. Therefore we @@ -86,6 +91,10 @@ dl_open_worker (void *a) /* So far, so good. Now check the versions. */ (void) _dl_check_all_versions (new, 0); +#ifdef SCOPE_DEBUG + show_scope (new); +#endif + /* Relocate the objects loaded. We do this in reverse order so that copy relocs of earlier objects overwrite the data written by later objects. */ @@ -195,3 +204,34 @@ _dl_open (const char *file, int mode) return args.map; } + + +#ifdef SCOPE_DEBUG +#include <unistd.h> + +static void +show_scope (struct link_map *new) +{ + int scope_cnt; + + for (scope_cnt = 0; new->l_scope[scope_cnt] != NULL; ++scope_cnt) + { + char numbuf[2]; + unsigned int cnt; + + numbuf[0] = '0' + scope_cnt; + numbuf[1] = '\0'; + _dl_sysdep_message ("scope ", numbuf, ":", NULL); + + for (cnt = 0; cnt < new->l_scope[scope_cnt]->r_nlist; ++cnt) + if (*new->l_scope[scope_cnt]->r_list[cnt]->l_name) + _dl_sysdep_message (" ", + new->l_scope[scope_cnt]->r_list[cnt]->l_name, + NULL); + else + _dl_sysdep_message (" <main>", NULL); + + _dl_sysdep_message ("\n", NULL); + } +} +#endif diff --git a/elf/loadtest.c b/elf/loadtest.c new file mode 100644 index 0000000000..209f420141 --- /dev/null +++ b/elf/loadtest.c @@ -0,0 +1,114 @@ +#include <assert.h> +#include <dlfcn.h> +#include <errno.h> +#include <error.h> +#include <stdio.h> +#include <stdlib.h> + + +/* How many load/unload operations do we do. */ +#define TEST_ROUNDS 100 + + +static struct +{ + /* Name of the module. */ + const char *name; + /* The handle. */ + void *handle; +} testobjs[] = +{ + { "testobj1.so", NULL }, + { "testobj2.so", NULL }, + { "testobj3.so", NULL }, +}; +#define NOBJS (sizeof (testobjs) / sizeof (testobjs[0])) + + +static const struct +{ + /* Name of a function to call. */ + const char *fname; + /* Index in status and handle array. */ + int index; + /* Options while loading the module. */ + int options; +} tests[] = +{ + { "obj1func2", 0, RTLD_LAZY }, + { "obj1func1", 0, RTLD_LAZY | RTLD_GLOBAL }, + { "obj1func1", 0, RTLD_NOW, }, + { "obj1func2", 0, RTLD_NOW | RTLD_GLOBAL }, + { "obj2func2", 1, RTLD_LAZY }, + { "obj2func1", 1, RTLD_LAZY | RTLD_GLOBAL, }, + { "obj2func1", 1, RTLD_NOW, }, + { "obj2func2", 1, RTLD_NOW | RTLD_GLOBAL }, + { "obj3func2", 2, RTLD_LAZY }, + { "obj3func1", 2, RTLD_LAZY | RTLD_GLOBAL }, + { "obj3func1", 2, RTLD_NOW }, + { "obj3func2", 2, RTLD_NOW | RTLD_GLOBAL }, +}; +#define NTESTS (sizeof (tests) / sizeof (tests[0])) + + +int +main (void) +{ + int count = TEST_ROUNDS; + + /* Just a seed. */ + srandom (TEST_ROUNDS); + + while (count--) + { + int nr = random () % NTESTS; + int index = tests[nr].index; + + printf ("%4d: %4d: ", count + 1, nr); + fflush (stdout); + + if (testobjs[index].handle == NULL) + { + int (*fct) (int); + + /* Load the object. */ + testobjs[index].handle = dlopen (testobjs[index].name, + tests[nr].options); + if (testobjs[index].handle == NULL) + error (EXIT_FAILURE, 0, "cannot load `%s': %s", + testobjs[index].name, dlerror ()); + + /* Test the function call. */ + fct = dlsym (testobjs[index].handle, tests[nr].fname); + if (fct == NULL) + error (EXIT_FAILURE, 0, + "cannot get function `%s' from shared object `%s': %s", + tests[nr].fname, testobjs[index].name, dlerror ()); + + fct (10); + + printf ("successfully loaded `%s'\n", testobjs[index].name); + } + else + { + dlclose (testobjs[index].handle); + testobjs[index].handle = NULL; + + printf ("successfully unloaded `%s'\n", testobjs[index].name); + } + } + + /* Unload all loaded modules. */ + for (count = 0; count < NOBJS; ++count) + if (testobjs[count].handle != NULL) + dlclose (testobjs[count].handle); + + return 0; +} + + +int +foo (int a) +{ + return a - 1; +} diff --git a/elf/testobj1.c b/elf/testobj1.c new file mode 100644 index 0000000000..9f64d675c4 --- /dev/null +++ b/elf/testobj1.c @@ -0,0 +1,11 @@ +int +obj1func1 (int a __attribute__ ((unused))) +{ + return 42; +} + +int +obj1func2 (int a) +{ + return foo (a) + 10; +} diff --git a/elf/testobj2.c b/elf/testobj2.c new file mode 100644 index 0000000000..5c89d33c8c --- /dev/null +++ b/elf/testobj2.c @@ -0,0 +1,11 @@ +int +obj2func1 (int a __attribute__ ((unused))) +{ + return 43; +} + +int +obj2func2 (int a) +{ + return obj1func1 (a) + 10; +} diff --git a/elf/testobj3.c b/elf/testobj3.c new file mode 100644 index 0000000000..8e3d8865f7 --- /dev/null +++ b/elf/testobj3.c @@ -0,0 +1,11 @@ +int +obj3func1 (int a __attribute__ ((unused))) +{ + return 44; +} + +int +obj3func2 (int a) +{ + return foo (a) + 42; +} diff --git a/include/string.h b/include/string.h index da3ac8f275..c225d65b31 100644 --- a/include/string.h +++ b/include/string.h @@ -16,4 +16,6 @@ extern int __strncasecmp __P ((__const char *__s1, __const char *__s2, extern char *__strndup __P ((__const char *__string, size_t __n)); +extern __ptr_t __rawmemchr __P ((__const __ptr_t __s, int __c)); + #endif diff --git a/linuxthreads/ChangeLog b/linuxthreads/ChangeLog index e390dc6a94..7eac05fee1 100644 --- a/linuxthreads/ChangeLog +++ b/linuxthreads/ChangeLog @@ -1,3 +1,8 @@ +1999-01-16 Ulrich Drepper <drepper@cygnus.com> + + * sysdeps/unix/sysv/linux/bits/posix_opt.h: Add _LFS_ASYNCHRONOUS_IO, + _LFS_LARGEFILE, _LFS64_LARGEFILE, and _LFS64_STDIO from Unix98. + 1999-01-07 Xavier Leroy <Xavier.Leroy@inria.fr> * pthread.c: Use a third signal __pthread_sig_debug distinct diff --git a/linuxthreads/sysdeps/unix/sysv/linux/bits/posix_opt.h b/linuxthreads/sysdeps/unix/sysv/linux/bits/posix_opt.h index fe68ab7183..15683b77e4 100644 --- a/linuxthreads/sysdeps/unix/sysv/linux/bits/posix_opt.h +++ b/linuxthreads/sysdeps/unix/sysv/linux/bits/posix_opt.h @@ -1,5 +1,5 @@ /* Define POSIX options for Linux. - Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc. + Copyright (C) 1996, 1997, 1998, 1999 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,5 +96,15 @@ /* We support asynchronous I/O. */ #define _POSIX_ASYNCHRONOUS_IO 1 +/* Alternative name for Unix98. */ +#define _LFS_ASYNCHRONOUS_IO 1 + +/* The LFS support in asynchronous I/O is also available. */ +#define _LFS64_ASYNCHRONOUS_IO 1 + +/* The rest of the LFS is also available. */ +#define _LFS_LARGEFILE 1 +#define _LFS64_LARGEFILE 1 +#define _LFS64_STDIO 1 #endif /* posix_opt.h */ diff --git a/nis/nis_error.c b/nis/nis_error.c index 4d7d863379..f5fe0f631d 100644 --- a/nis/nis_error.c +++ b/nis/nis_error.c @@ -34,25 +34,25 @@ static const char *nis_errlist[] = N_("Unknown object"), N_("Server busy, try again"), N_("Generic system error"), - N_("First/Next chain broken"), + N_("First/next chain broken"), N_("Permission denied"), N_("Not owner"), N_("Name not served by this server"), N_("Server out of memory"), N_("Object with same name exists"), N_("Not master server for this domain"), - N_("Invalid Object for operation"), - N_("Malformed Name, or illegal name"), + N_("Invalid object for operation"), + N_("Malformed name, or illegal name"), N_("Unable to create callback"), N_("Results sent to callback proc"), - N_("Not Found, no such name"), + N_("Not found, no such name"), N_("Name/entry isn't unique"), N_("Modification failed"), N_("Database for table does not exist"), - N_("Entry/Table type mismatch"), - N_("Link Points to illegal name"), - N_("Partial Success"), - N_("Too many Attributes"), + N_("Entry/table type mismatch"), + N_("Link points to illegal name"), + N_("Partial success"), + N_("Too many attributes"), N_("Error in RPC subsystem"), N_("Missing or malformed attribute"), N_("Named object is not searchable"), diff --git a/string/Makefile b/string/Makefile index ca823f42dc..ebdaad85ba 100644 --- a/string/Makefile +++ b/string/Makefile @@ -1,4 +1,4 @@ -# Copyright (C) 1991, 92, 93, 94, 95, 96, 97, 98 Free Software Foundation, Inc. +# Copyright (C) 1991,92,93,94,95,96,97,98,99 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 @@ routines := strcat strchr strcmp strcoll strcpy strcspn \ mempcpy bcopy bzero ffs ffsll stpcpy stpncpy \ strcasecmp strncase strcasecmp_l strncase_l \ memccpy memcpy wordcopy strsep strcasestr \ - swab strfry memfrob memmem \ + swab strfry memfrob memmem rawmemchr \ $(addprefix argz-,append count create ctsep next \ delete extract insert stringify \ addsep replace) \ diff --git a/string/Versions b/string/Versions index 32d0123e40..b3fba757c7 100644 --- a/string/Versions +++ b/string/Versions @@ -41,8 +41,8 @@ libc { strsignal; strspn; strstr; strtok; strtok_r; strxfrm; swab; } GLIBC_2.1 { - # functions used in other libraries - __strcasestr; + # functions used in macros and other libraries + __rawmemchr; __strcasestr; # f* ffsl; ffsll; @@ -50,6 +50,9 @@ libc { # m* mempcpy; + # r* + rawmemchr; + # s* strcasestr; strverscmp; } diff --git a/string/bits/string2.h b/string/bits/string2. |
