From da8324650d7e867028d1d5e9bcaed962bc6b2322 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Wed, 18 Feb 1998 11:00:24 +0000 Subject: Update. 1998-02-17 Andreas Schwab * elf/dl-load.c (add_name_to_object): Don't translate strings. * elf/dl-minimal.c (_strerror_internal): Define it here to avoid pulling in the whole error list. (__dcgettext, dcgettext): Removed. * libc.map: Export _strerror_internal. 1998-02-18 10:50 Ulrich Drepper * sysdeps/i386/fpu/t_exp.c: New file. 1998-02-18 Andreas Jaeger * nis/libnss_nisplus.map: NIS+ support is new in glibc 2.1, add everything with version GLIBC_2.1. * hesiod/libnss_hesiod.map: Likewise. 1998-02-18 Andreas Jaeger * manual/arith.texi (Old-style number conversion): This node is a section, not a subsection. 1998-02-17 Andreas Schwab * elf/dl-lookup.c (make_string): Use __stpcpy instead of stpcpy. 1998-02-17 Andreas Schwab * elf/rtld.c (dl_main): Make sure that the library search paths have been initialized before the first call to _dl_map_object. 1998-02-17 Andreas Schwab * Makerules (common-generated): Add libc_pic.os. 1998-02-17 Andreas Schwab * elf/rtld.c (dl_main): Use PT_PHDR to figure out the load address of the executable. 1998-02-18 10:28 Andreas Schwab --- ChangeLog | 43 ++++++++++++++++++++++++++++++++++++++++++- elf/dl-load.c | 22 +++++++++++----------- elf/dl-lookup.c | 4 ++-- elf/dl-minimal.c | 43 ++++++++++++++++++++++++++++++++++++++----- elf/rtld.c | 20 +++++++++++++++----- hesiod/libnss_hesiod.map | 2 +- libc.map | 2 +- manual/arith.texi | 2 +- nis/libnss_nisplus.map | 2 +- sysdeps/i386/fpu/t_exp.c | 1 + 10 files changed, 113 insertions(+), 28 deletions(-) create mode 100644 sysdeps/i386/fpu/t_exp.c diff --git a/ChangeLog b/ChangeLog index cb27cb11d4..1c3497efe6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,45 @@ -Wed Feb 18 10:28:58 1998 Andreas Schwab +1998-02-17 Andreas Schwab + + * elf/dl-load.c (add_name_to_object): Don't translate strings. + * elf/dl-minimal.c (_strerror_internal): Define it here to avoid + pulling in the whole error list. + (__dcgettext, dcgettext): Removed. + * libc.map: Export _strerror_internal. + +1998-02-18 10:50 Ulrich Drepper + + * sysdeps/i386/fpu/t_exp.c: New file. + +1998-02-18 Andreas Jaeger + + * nis/libnss_nisplus.map: NIS+ support is new in glibc 2.1, add + everything with version GLIBC_2.1. + * hesiod/libnss_hesiod.map: Likewise. + +1998-02-18 Andreas Jaeger + + * manual/arith.texi (Old-style number conversion): This node is a + section, not a subsection. + +1998-02-17 Andreas Schwab + + * elf/dl-lookup.c (make_string): Use __stpcpy instead of stpcpy. + +1998-02-17 Andreas Schwab + + * elf/rtld.c (dl_main): Make sure that the library search paths + have been initialized before the first call to _dl_map_object. + +1998-02-17 Andreas Schwab + + * Makerules (common-generated): Add libc_pic.os. + +1998-02-17 Andreas Schwab + + * elf/rtld.c (dl_main): Use PT_PHDR to figure out the load address + of the executable. + +1998-02-18 10:28 Andreas Schwab * sysdeps/m68k/fpu/t_exp.c: New file. diff --git a/elf/dl-load.c b/elf/dl-load.c index cc94d7b510..c93446a737 100644 --- a/elf/dl-load.c +++ b/elf/dl-load.c @@ -123,11 +123,11 @@ add_name_to_object (struct link_map *l, char *name) struct libname_list *newname; if (name == NULL) - { - /* No more memory. */ - _dl_signal_error (ENOMEM, NULL, _("could not allocate name string")); - return 0; - } + { + /* No more memory. */ + _dl_signal_error (ENOMEM, NULL, "could not allocate name string"); + return 0; + } lastp = NULL; for (lnp = l->l_libname; lnp != NULL; lastp = lnp, lnp = lnp->next) @@ -139,12 +139,12 @@ add_name_to_object (struct link_map *l, char *name) newname = malloc (sizeof *newname); if (newname == NULL) - { - /* No more memory. */ - _dl_signal_error (ENOMEM, name, _("cannot allocate name record")); - free(name); - return 0; - } + { + /* No more memory. */ + _dl_signal_error (ENOMEM, name, "cannot allocate name record"); + free (name); + return 0; + } /* The object should have a libname set from _dl_new_object. */ assert (lastp != NULL); diff --git a/elf/dl-lookup.c b/elf/dl-lookup.c index 6da708109e..6c1c04b5f5 100644 --- a/elf/dl-lookup.c +++ b/elf/dl-lookup.c @@ -1,5 +1,5 @@ /* Look up a symbol in the loaded objects. - Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc. + Copyright (C) 1995, 1996, 1997, 1998 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 @@ -51,7 +51,7 @@ struct sym_val \ cp = result = alloca (len); \ for (cnt = 0; cnt < sizeof (all) / sizeof (all[0]); ++cnt) \ - cp = stpcpy (cp, all[cnt]); \ + cp = __stpcpy (cp, all[cnt]); \ \ result; \ }) diff --git a/elf/dl-minimal.c b/elf/dl-minimal.c index 088c2331f6..da9c33f099 100644 --- a/elf/dl-minimal.c +++ b/elf/dl-minimal.c @@ -24,6 +24,7 @@ #include #include #include +#include /* Minimal `malloc' allocator for use while loading shared libraries. Only small blocks are allocated, and none are ever freed. */ @@ -123,15 +124,47 @@ longjmp (jmp_buf env, int val) __longjmp (env[0].__jmpbuf, val); } -/* Define our own stub for the localization function used by strerror. - English-only in the dynamic linker keeps it smaller. */ +/* Define our own version of the internal function used by strerror. We + only provide the messages for some common errors. This avoids pulling + in the whole error list. */ char * weak_function -__dcgettext (const char *domainname, const char *msgid, int category) +_strerror_internal (int errnum, char *buf, size_t buflen) { - return (char *) msgid; + char *msg; + + switch (errnum) + { + case ENOMEM: + msg = (char *) "Cannot allocate memory"; + break; + case EINVAL: + msg = (char *) "Invalid argument"; + break; + case ENOENT: + msg = (char *) "No such file or directory"; + break; + case EPERM: + msg = (char *) "Operation not permitted"; + break; + case EIO: + msg = (char *) "Input/output error"; + break; + case EACCES: + msg = (char *) "Permission denied"; + break; + default: + /* No need to check buffer size, all calls in the dynamic linker + provide enough space. */ + buf[buflen - 1] = '\0'; + msg = _itoa_word (errnum, buf + buflen - 1, 10, 0); + msg = memcpy (msg - (sizeof ("Error ") - 1), "Error ", + sizeof ("Error ") - 1); + break; + } + + return msg; } -weak_alias (__dcgettext, dcgettext) #ifndef NDEBUG diff --git a/elf/rtld.c b/elf/rtld.c index 2ca1692584..dd79a81124 100644 --- a/elf/rtld.c +++ b/elf/rtld.c @@ -264,7 +264,6 @@ dl_main (const ElfW(Phdr) *phdr, size_t file_size; char *file; int has_interp = 0; - const char *library_path = NULL; /* Overwrites LD_LIBRARY_PATH if given. */ /* Test whether we want to see the content of the auxiliary array passed up from the kernel. */ @@ -323,6 +322,9 @@ dl_main (const ElfW(Phdr) *phdr, ourselves). This is an easy way to test a new ld.so before installing it. */ + /* Overwrites LD_LIBRARY_PATH if given. */ + const char *library_path = NULL; + /* Note the place where the dynamic linker actually came from. */ _dl_rtld_map.l_name = _dl_argv[0]; @@ -378,6 +380,10 @@ of this helper program; chances are you did not intend to run this program.\n", --_dl_argc; ++_dl_argv; + /* Initialize the data structures for the search paths for shared + objects. */ + _dl_init_paths (library_path); + if (mode == verify) { char *err_str = NULL; @@ -412,12 +418,20 @@ of this helper program; chances are you did not intend to run this program.\n", main_map->l_phnum = phent; main_map->l_entry = *user_entry; main_map->l_opencount = 1; + + /* Initialize the data structures for the search paths for shared + objects. */ + _dl_init_paths (NULL); } /* Scan the program header table for the dynamic section. */ for (ph = phdr; ph < &phdr[phent]; ++ph) switch (ph->p_type) { + case PT_PHDR: + /* Find out the load address. */ + main_map->l_addr = (ElfW(Addr)) phdr - ph->p_vaddr; + break; case PT_DYNAMIC: /* This tells us where to find the dynamic section, which tells us everything we need to do. */ @@ -492,10 +506,6 @@ of this helper program; chances are you did not intend to run this program.\n", preloads = NULL; npreloads = 0; - /* Initialize the data structures for the search paths for shared - objects. */ - _dl_init_paths (library_path); - preloadlist = getenv ("LD_PRELOAD"); if (preloadlist) { diff --git a/hesiod/libnss_hesiod.map b/hesiod/libnss_hesiod.map index 6c1fd5eba9..d05ad373a8 100644 --- a/hesiod/libnss_hesiod.map +++ b/hesiod/libnss_hesiod.map @@ -1,4 +1,4 @@ -GLIBC_2.0 { +GLIBC_2.1 { global: _nss_hesiod_setpwent; _nss_hesiod_endpwent; _nss_hesiod_getpwnam_r; _nss_hesiod_getpwuid; diff --git a/libc.map b/libc.map index 473755b6a1..1d4354e433 100644 --- a/libc.map +++ b/libc.map @@ -100,7 +100,7 @@ GLIBC_2.0 { __vsscanf; __vfscanf; __vsnprintf; _rpc_dtablesize; _null_auth; _seterr_reply; __res_randomid; __syscall_rt_sigqueueinfo; __getpid; __pread64; __pwrite64; - __strcasecmp; __write; + __strcasecmp; __write; _strerror_internal; # Exception handling support functions from libgcc __register_frame; __register_frame_table; __deregister_frame; diff --git a/manual/arith.texi b/manual/arith.texi index 22819b12f4..1e3b2f5318 100644 --- a/manual/arith.texi +++ b/manual/arith.texi @@ -1328,7 +1328,7 @@ is provided mostly for compatibility with existing code; using @node Old-style number conversion -@subsection Old-style way of converting numbers to strings +@section Old-style way of converting numbers to strings The @w{System V} library provided three functions to convert numbers to strings which have a unusual and hard-to-be-used semantic. The GNU C diff --git a/nis/libnss_nisplus.map b/nis/libnss_nisplus.map index b178c02552..07f4660758 100644 --- a/nis/libnss_nisplus.map +++ b/nis/libnss_nisplus.map @@ -1,4 +1,4 @@ -GLIBC_2.0 { +GLIBC_2.1 { global: _nss_nisplus_endaliasent; _nss_nisplus_endetherent; _nss_nisplus_endgrent; _nss_nisplus_endhostent; _nss_nisplus_endnetent; _nss_nisplus_endnetgrent; diff --git a/sysdeps/i386/fpu/t_exp.c b/sysdeps/i386/fpu/t_exp.c new file mode 100644 index 0000000000..fd37963b05 --- /dev/null +++ b/sysdeps/i386/fpu/t_exp.c @@ -0,0 +1 @@ +/* Empty. Not needed. */ -- cgit v1.2.3