summaryrefslogtreecommitdiff
path: root/elf/rtld.c
diff options
context:
space:
mode:
Diffstat (limited to 'elf/rtld.c')
-rw-r--r--elf/rtld.c25
1 files changed, 24 insertions, 1 deletions
diff --git a/elf/rtld.c b/elf/rtld.c
index 878e6480f4..2dc3f210e4 100644
--- a/elf/rtld.c
+++ b/elf/rtld.c
@@ -499,9 +499,26 @@ _dl_start_final (void *arg, struct dl_start_final_info *info)
return start_addr;
}
+#ifndef NESTING
+#ifdef DONT_USE_BOOTSTRAP_MAP
+# define bootstrap_map GL(dl_rtld_map)
+#else
+# define bootstrap_map info.l
+#endif
+
+ /* This #define produces dynamic linking inline functions for
+ bootstrap relocation instead of general-purpose relocation.
+ Since ld.so must not have any undefined symbols the result
+ is trivial: always the map of ld.so itself. */
+#define RTLD_BOOTSTRAP
+#define RESOLVE_MAP(sym, version, flags) (&bootstrap_map)
+#include "dynamic-link.h"
+#endif /* n NESTING */
+
static ElfW(Addr) __attribute_used__
_dl_start (void *arg)
{
+#ifdef NESTING
#ifdef DONT_USE_BOOTSTRAP_MAP
# define bootstrap_map GL(dl_rtld_map)
#else
@@ -517,10 +534,12 @@ _dl_start (void *arg)
#define BOOTSTRAP_MAP (&bootstrap_map)
#define RESOLVE_MAP(sym, version, flags) BOOTSTRAP_MAP
#include "dynamic-link.h"
+#endif /* NESTING */
#ifdef DONT_USE_BOOTSTRAP_MAP
rtld_timer_start (&start_time);
#else
+ struct dl_start_final_info info;
rtld_timer_start (&info.start_time);
#endif
@@ -561,7 +580,11 @@ _dl_start (void *arg)
/* Relocate ourselves so we can do normal function calls and
data access using the global offset table. */
- ELF_DYNAMIC_RELOCATE (&bootstrap_map, 0, 0, 0);
+ ELF_DYNAMIC_RELOCATE (&bootstrap_map, 0, 0, 0
+#ifndef NESTING
+ , &bootstrap_map
+#endif
+ );
}
bootstrap_map.l_relocated = 1;