summaryrefslogtreecommitdiff
path: root/elf
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1997-02-27 06:01:16 +0000
committerUlrich Drepper <drepper@redhat.com>1997-02-27 06:01:16 +0000
commitceb2d9aaa86cc3d3d4accc294751c98d49bdc5c2 (patch)
tree977724555bd3c1007b415b88ed3994e6290f4451 /elf
parent867a8743a42f28c5a50de893c82db66ae215f69c (diff)
update from main archive 970226cvs/libc-970301cvs/libc-970228cvs/libc-970227
1997-02-27 05:12 Ulrich Drepper <drepper@cygnus.com> * manual/Makefile: Add rules to run and distribute xtract-typefun. * manual/xtract-typefun.awk: New file. Script to extract function, variable, macro anchor to put into the `dir' file. * manual/signal.texi: Document difference between SysV and BSD signal(3) function and add documentation for sysv_signal. * sysdeps/libm-i387/e_acoshl.c: Clear upper half of word containing exponent before comparing. 1997-02-27 01:13 Ulrich Drepper <drepper@cygnus.com> * sysdeps/generic/netinet/in.h (htonl, htons, ntohl, ntohs): Change prototypes to use types with explicit width. `unsigned long' is different on 64 bit systems. * sysdeps/unix/sysv/linux/netinet/in.h: Likewise. * sysdeps/generic/htonl.c: Likewise. * sysdeps/generic/htons.c: Likewise. * sysdeps/generic/ntohl.c: Likewise. * sysdeps/generic/ntohs.c: Likewise. Suggested by a sun <asun@zoology.washington.edu>. 1997-02-26 08:30 Andreas Jaeger <aj@arthur.pfalz.de> * math/math.h: Include <__math.h> if __NO_MATH_INLINES is not defined and we want optimization. 1997-02-27 01:13 Ulrich Drepper <drepper@cygnus.com> * sysdeps/generic/netinet/in.h (htonl, htons, ntohl, ntohs): Change prototypes to use types with explicit width. `unsigned long' is different on 64 bit systems. Suggested by a sun <asun@zoology.washington.edu>. 1997-02-02 19:53 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> * misc/getpass.c: Don't disable canonical input. Reverted patch of Mon Jan 6 01:35:29 1997. 1996-12-14 22:07 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> * libio/libioP.h (_IO_finish_t): Take additional parameter, to match the hidden __in_chrg parameter of the destructor. (_IO_FINISH): Pass zero for it. * libio/genops.c (_IO_default_finish): Add second parameter, which is ignored. * libio/memstream.c (_IO_mem_finish): Likewise. * libio/fileops.c (_IO_mem_finish): Likewise. * libio/strops.c (_IO_str_finish): Likewise. All callers changed. 1997-02-27 00:23 H.J. Lu <hjl@lucon.org> * time/Makefile: Avoid using patterns in dependencies. 1997-02-26 00:56 Miguel de Icaza <miguel@nuclecu.unam.mx> * elf/rtld.c: Make _dl_start static. Otherwise the linker on the SPARC will convert the call _dl_start into a call into the PLT. * elf/rtld.c (_dl_start): On the SPARC we need to adjust the value of arg to make it point to the actual values. * sysdeps/sparc/elf/DEFS.h: New ELF specific version. * sysdeps/sparc/Dist: Mention sysdeps/sparc/elf/DEFS.h. * sysdeps/sparc/bsd-_setjmp.S, sysdeps/sparc/bsd-setjmp.S: Make them PIC aware. * sysdeps/sparc/dl-machine.h (elf_machine_load_address): Implemented. (elf_machine_rela): Make it compile; fix existing relocation types; add unhandled relocation types. (ELF_ADJUST_ARG): Get pointer to arguments at program startup. (RTLD_START): Initial implementation, not yet finished. * sysdeps/sparc/elf/start.S: Fix. * sysdeps/sparc/fpu_control.h: Remove duplicate declaration of __setfpucw. * sysdeps/sparc/divrem.m4: Make compilable under Linux. * sysdeps/sparc/rem.S, sysdeps/sparc/sdiv.S, sysdeps/sparc/udiv.S, sysdeps/sparc/urem.S : Regenerated. * sysdeps/sparc/setjmp.S: Make it PIC aware. * sysdeps/unix/sysv/linux/sparc/__sigtrampoline.S: Define __ASSEMBLY__ before using kernel header. * sysdeps/unix/sysv/linux/sparc/Makefile: Use -mv8 flag to compile rtld.c. * sysdeps/unix/sysv/linux/sparc/brk.c: Implement. * sysdeps/unix/sysv/linux/sparc/profil-counter.h: Remove code to handle old signals. * sysdeps/unix/sysv/linux/sparc/sigaction.c: Implements sigaction for all Linux/SPARC kernels. * sysdeps/unix/sysv/linux/sparc/syscall.S: Add code to store errno using __errno_location. * sysdeps/unix/sysv/linux/sparc/sysdep.h: Add various handler macros for assembler sources. * sysdeps/unix/sysv/linux/sparc/errno.c: Define errno. 1997-02-25 16:02 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> * elf/rtld.c (dl_main): Remove dead code that is never executed. Rename local variable l to main_map where it is used to point to the load_map for the executable. 1997-02-25 15:03 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> * elf/dl-version.c (_dl_check_all_versions): Ignore libraries that could not be found. 1997-02-24 23:18 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> * Makerules: Generate implicit object suffix rules automagically. (o-iterator): Move before first use. * Makeconfig (all-object-suffixes): Add .bo suffix. 1997-02-25 15:11 Ulrich Drepper <drepper@cygnus.com> * sysdeps/libm-i387/e_acoshf.S (__ieee754_acoshf): Test correct word on stack for overflow. C++. Use __exception instead.
Diffstat (limited to 'elf')
-rw-r--r--elf/dl-version.c2
-rw-r--r--elf/rtld.c116
2 files changed, 57 insertions, 61 deletions
diff --git a/elf/dl-version.c b/elf/dl-version.c
index ae1c2f34f7..2a6f1b94df 100644
--- a/elf/dl-version.c
+++ b/elf/dl-version.c
@@ -334,7 +334,7 @@ _dl_check_all_versions (struct link_map *map, int verbose)
int result = 0;
for (l = map; l != NULL; l = l->l_next)
- result |= _dl_check_map_versions (l, verbose);
+ result |= l->l_opencount != 0 && _dl_check_map_versions (l, verbose);
return result;
}
diff --git a/elf/rtld.c b/elf/rtld.c
index eb7b3bec2a..9f18e23b91 100644
--- a/elf/rtld.c
+++ b/elf/rtld.c
@@ -79,7 +79,7 @@ RTLD_START
#error "sysdeps/MACHINE/dl-machine.h fails to define RTLD_START"
#endif
-ElfW(Addr)
+static ElfW(Addr)
_dl_start (void *arg)
{
struct link_map bootstrap_map;
@@ -126,6 +126,10 @@ _dl_start (void *arg)
_dl_rtld_map.l_info[DT_STRTAB]->d_un.d_ptr +
_dl_rtld_map.l_info[DT_RPATH]->d_un.d_val);
+#ifdef ELF_ADJUST_ARG
+ ELF_ADJUST_ARG(arg);
+#endif
+
/* Call the OS-dependent function to set up life so we can do things like
file access. It will call `dl_main' (below) to do all the real work
of the dynamic linker, and then unwind our frame and run the user
@@ -147,7 +151,7 @@ dl_main (const ElfW(Phdr) *phdr,
ElfW(Addr) *user_entry)
{
const ElfW(Phdr) *ph;
- struct link_map *l;
+ struct link_map *main_map;
int lazy;
enum { normal, list, verify, trace } mode;
struct link_map **preloads;
@@ -235,7 +239,7 @@ of this helper program; chances are you did not intend to run this program.\n",
{
void doit (void)
{
- l = _dl_map_object (NULL, _dl_argv[0], lt_library, 0);
+ main_map = _dl_map_object (NULL, _dl_argv[0], lt_library, 0);
}
char *err_str = NULL;
const char *obj_name __attribute__ ((unused));
@@ -248,37 +252,23 @@ of this helper program; chances are you did not intend to run this program.\n",
}
}
else
- l = _dl_map_object (NULL, _dl_argv[0], lt_library, 0);
+ main_map = _dl_map_object (NULL, _dl_argv[0], lt_library, 0);
- phdr = l->l_phdr;
- phent = l->l_phnum;
- l->l_name = (char *) "";
- *user_entry = l->l_entry;
+ phdr = main_map->l_phdr;
+ phent = main_map->l_phnum;
+ main_map->l_name = (char *) "";
+ *user_entry = main_map->l_entry;
}
else
{
/* Create a link_map for the executable itself.
This will be what dlopen on "" returns. */
- l = _dl_new_object ((char *) "", "", lt_executable);
- if (l == NULL)
+ main_map = _dl_new_object ((char *) "", "", lt_executable);
+ if (main_map == NULL)
_dl_sysdep_fatal ("cannot allocate memory for link map", NULL);
- l->l_phdr = phdr;
- l->l_phnum = phent;
- l->l_entry = *user_entry;
- }
-
- if (l != _dl_loaded)
- {
- /* GDB assumes that the first element on the chain is the
- link_map for the executable itself, and always skips it.
- Make sure the first one is indeed that one. */
- l->l_prev->l_next = l->l_next;
- if (l->l_next)
- l->l_next->l_prev = l->l_prev;
- l->l_prev = NULL;
- l->l_next = _dl_loaded;
- _dl_loaded->l_prev = l;
- _dl_loaded = l;
+ main_map->l_phdr = phdr;
+ main_map->l_phnum = phent;
+ main_map->l_entry = *user_entry;
}
/* Scan the program header table for the dynamic section. */
@@ -288,7 +278,7 @@ of this helper program; chances are you did not intend to run this program.\n",
case PT_DYNAMIC:
/* This tells us where to find the dynamic section,
which tells us everything we need to do. */
- l->l_ld = (void *) l->l_addr + ph->p_vaddr;
+ main_map->l_ld = (void *) main_map->l_addr + ph->p_vaddr;
break;
case PT_INTERP:
/* This "interpreter segment" was used by the program loader to
@@ -297,7 +287,7 @@ of this helper program; chances are you did not intend to run this program.\n",
dlopen call or DT_NEEDED entry, for something that wants to link
against the dynamic linker as a shared library, will know that
the shared object is already loaded. */
- _dl_rtld_libname.name = (const char *) l->l_addr + ph->p_vaddr;
+ _dl_rtld_libname.name = (const char *) main_map->l_addr + ph->p_vaddr;
_dl_rtld_libname.next = NULL;
_dl_rtld_map.l_libname = &_dl_rtld_libname;
has_interp = 1;
@@ -317,25 +307,24 @@ of this helper program; chances are you did not intend to run this program.\n",
if (mode == verify)
/* We were called just to verify that this is a dynamic executable
using us as the program interpreter. */
- _exit (l->l_ld == NULL ? 1 : has_interp ? 0 : 2);
+ _exit (main_map->l_ld == NULL ? 1 : has_interp ? 0 : 2);
/* Extract the contents of the dynamic section for easy access. */
- elf_get_dynamic_info (l->l_ld, l->l_info);
- if (l->l_info[DT_HASH])
+ elf_get_dynamic_info (main_map->l_ld, main_map->l_info);
+ if (main_map->l_info[DT_HASH])
/* Set up our cache of pointers into the hash table. */
- _dl_setup_hash (l);
+ _dl_setup_hash (main_map);
/* Put the link_map for ourselves on the chain so it can be found by
- name. */
+ name. Note that at this point the global chain of link maps contains
+ exactly one element, which is pointed to by main_map. */
if (! _dl_rtld_map.l_name)
/* If not invoked directly, the dynamic linker shared object file was
found by the PT_INTERP name. */
_dl_rtld_map.l_name = (char *) _dl_rtld_map.l_libname->name;
_dl_rtld_map.l_type = lt_library;
- while (l->l_next)
- l = l->l_next;
- l->l_next = &_dl_rtld_map;
- _dl_rtld_map.l_prev = l;
+ main_map->l_next = &_dl_rtld_map;
+ _dl_rtld_map.l_prev = main_map;
/* We have two ways to specify objects to preload: via environment
variable and via the file /etc/ld.so.preload. The later can also
@@ -445,7 +434,7 @@ 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 (l, preloads, npreloads, mode == trace);
+ _dl_map_object_deps (main_map, preloads, npreloads, mode == trace);
#ifndef MAP_ANON
/* We are done mapping things, so close the zero-fill descriptor. */
@@ -465,11 +454,11 @@ of this helper program; chances are you did not intend to run this program.\n",
chain in symbol search order because gdb uses the chain's order as
its symbol search order. */
unsigned int i = 1;
- while (l->l_searchlist[i] != &_dl_rtld_map)
+ while (main_map->l_searchlist[i] != &_dl_rtld_map)
++i;
- _dl_rtld_map.l_prev = l->l_searchlist[i - 1];
- _dl_rtld_map.l_next = (i + 1 < l->l_nsearchlist ?
- l->l_searchlist[i + 1] : NULL);
+ _dl_rtld_map.l_prev = main_map->l_searchlist[i - 1];
+ _dl_rtld_map.l_next = (i + 1 < main_map->l_nsearchlist ?
+ main_map->l_searchlist[i + 1] : NULL);
assert (_dl_rtld_map.l_prev->l_next == _dl_rtld_map.l_next);
_dl_rtld_map.l_prev->l_next = &_dl_rtld_map;
if (_dl_rtld_map.l_next)
@@ -484,7 +473,7 @@ of this helper program; chances are you did not intend to run this program.\n",
{
void doit (void)
{
- if (_dl_check_all_versions (l, 1) && mode == normal)
+ if (_dl_check_all_versions (main_map, 1) && mode == normal)
/* We cannot start the application. Abort now. */
_exit (1);
}
@@ -504,22 +493,26 @@ of this helper program; chances are you did not intend to run this program.\n",
if (! _dl_loaded->l_info[DT_NEEDED])
_dl_sysdep_message ("\t", "statically linked\n", NULL);
else
- for (l = _dl_loaded->l_next; l; l = l->l_next)
- if (l->l_opencount == 0)
- /* The library was not found. */
- _dl_sysdep_message ("\t", l->l_libname->name, " => not found\n",
- NULL);
- else
- {
- char buf[20], *bp;
- buf[sizeof buf - 1] = '\0';
- bp = _itoa (l->l_addr, &buf[sizeof buf - 1], 16, 0);
- while ((size_t) (&buf[sizeof buf - 1] - bp)
- < sizeof l->l_addr * 2)
- *--bp = '0';
- _dl_sysdep_message ("\t", l->l_libname->name, " => ", l->l_name,
- " (0x", bp, ")\n", NULL);
- }
+ {
+ struct link_map *l;
+
+ for (l = _dl_loaded->l_next; l; l = l->l_next)
+ if (l->l_opencount == 0)
+ /* The library was not found. */
+ _dl_sysdep_message ("\t", l->l_libname->name, " => not found\n",
+ NULL);
+ else
+ {
+ char buf[20], *bp;
+ buf[sizeof buf - 1] = '\0';
+ bp = _itoa (l->l_addr, &buf[sizeof buf - 1], 16, 0);
+ while ((size_t) (&buf[sizeof buf - 1] - bp)
+ < sizeof l->l_addr * 2)
+ *--bp = '0';
+ _dl_sysdep_message ("\t", l->l_libname->name, " => ",
+ l->l_name, " (0x", bp, ")\n", NULL);
+ }
+ }
if (mode != trace)
for (i = 1; i < _dl_argc; ++i)
@@ -544,6 +537,7 @@ of this helper program; chances are you did not intend to run this program.\n",
else if (lazy >= 0)
{
/* We have to do symbol dependency testing. */
+ struct link_map *l;
void doit (void)
{
_dl_relocate_object (l, _dl_object_relocation_scope (l), lazy);
@@ -576,6 +570,7 @@ of this helper program; chances are you did not intend to run this program.\n",
the dynamic linker out of order because it has no copy relocs (we
know that because it is self-contained). */
+ struct link_map *l;
l = _dl_loaded;
while (l->l_next)
l = l->l_next;
@@ -605,6 +600,7 @@ of this helper program; chances are you did not intend to run this program.\n",
{
/* Initialize _r_debug. */
struct r_debug *r = _dl_debug_initialize (_dl_rtld_map.l_addr);
+ struct link_map *l;
l = _dl_loaded;