summaryrefslogtreecommitdiff
path: root/elf
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>1996-07-14 13:20:46 +0000
committerRoland McGrath <roland@gnu.org>1996-07-14 13:20:46 +0000
commitb1dbbaa48c188f78fa78f25cf405b8d95575de08 (patch)
treec99907d3157107dbcb1cde8fe9eb10b7614bf67e /elf
parentf51d1dfd35f793488ee32c8226cb8955ed75acbe (diff)
* elf/rtld.c (RESOLVE): Use the dl's load address, not a constant zero!
(_dl_start): Move RESOLVE defn inside this function and #include "dynamic-link.h" a second time there. [RTLD_START]: Move use of this after _dl_start function.
Diffstat (limited to 'elf')
-rw-r--r--elf/rtld.c25
1 files changed, 13 insertions, 12 deletions
diff --git a/elf/rtld.c b/elf/rtld.c
index 1058d87150..6a4742b0ab 100644
--- a/elf/rtld.c
+++ b/elf/rtld.c
@@ -24,21 +24,10 @@ Cambridge, MA 02139, USA. */
#include <unistd.h>
#include <sys/mman.h> /* Check if MAP_ANON is defined. */
#include "../stdio-common/_itoa.h"
-
-
-/* This #define produces dynamic linking inline functions for
- bootstrap relocation instead of general-purpose relocation. */
-#define RTLD_BOOTSTRAP
-#define RESOLVE(sym, reloc_addr, noplt) 0
+#include <assert.h>
#include "dynamic-link.h"
-#ifdef RTLD_START
-RTLD_START
-#else
-#error "sysdeps/MACHINE/dl-machine.h fails to define RTLD_START"
-#endif
-
/* System-specific function to do initial startup for the dynamic linker.
After this, file access calls and getenv must work. This is responsible
for setting _dl_secure if we need to be secure (e.g. setuid),
@@ -60,11 +49,23 @@ static void dl_main (const ElfW(Phdr) *phdr,
struct link_map _dl_rtld_map;
+#ifdef RTLD_START
+RTLD_START
+#else
+#error "sysdeps/MACHINE/dl-machine.h fails to define RTLD_START"
+#endif
+
ElfW(Addr)
_dl_start (void *arg)
{
struct link_map bootstrap_map;
+ /* This #define produces dynamic linking inline functions for
+ bootstrap relocation instead of general-purpose relocation. */
+#define RTLD_BOOTSTRAP
+#define RESOLVE(sym, reloc_addr, noplt) bootstrap_map.l_addr
+#include "dynamic-link.h"
+
/* Figure out the run-time load address of the dynamic linker itself. */
bootstrap_map.l_addr = elf_machine_load_address ();