aboutsummaryrefslogtreecommitdiff
path: root/elf/rtld.c
diff options
context:
space:
mode:
Diffstat (limited to 'elf/rtld.c')
-rw-r--r--elf/rtld.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/elf/rtld.c b/elf/rtld.c
index 3af8ee6..f889f01 100644
--- a/elf/rtld.c
+++ b/elf/rtld.c
@@ -428,7 +428,6 @@ static ElfW(Addr) _dl_start_final (void *arg,
/* These are defined magically by the linker. */
extern const ElfW(Ehdr) __ehdr_start attribute_hidden;
-extern char _etext[] attribute_hidden;
extern char _end[] attribute_hidden;
@@ -477,8 +476,10 @@ _dl_start_final (void *arg, struct dl_start_final_info *info)
#endif
_dl_setup_hash (&_dl_rtld_map);
_dl_rtld_map.l_real = &_dl_rtld_map;
- _dl_rtld_map.l_map_start = (ElfW(Addr)) &__ehdr_start;
- _dl_rtld_map.l_map_end = (ElfW(Addr)) _end;
+ _dl_rtld_map.l_map_start
+ = (ElfW(Addr)) DL_ADDRESS_WITHOUT_RELOC (&__ehdr_start);
+ _dl_rtld_map.l_map_end
+ = (ElfW(Addr)) DL_ADDRESS_WITHOUT_RELOC (_end);
/* Copy the TLS related data if necessary. */
#ifndef DONT_USE_BOOTSTRAP_MAP
# if NO_TLS_OFFSET != 0
@@ -1777,8 +1778,7 @@ dl_main (const ElfW(Phdr) *phdr,
elf_setup_debug_entry (main_map, r);
/* We start adding objects. */
- r->r_state = RT_ADD;
- _dl_debug_state ();
+ _dl_debug_change_state (r, RT_ADD);
LIBC_PROBE (init_start, 2, LM_ID_BASE, r);
/* Auditing checkpoint: we are ready to signal that the initial map
@@ -2313,6 +2313,9 @@ dl_main (const ElfW(Phdr) *phdr,
__rtld_mutex_init ();
__rtld_malloc_init_real (main_map);
+
+ /* Update copy-relocated _r_debug if necessary. */
+ _dl_debug_post_relocate (main_map);
}
/* All ld.so initialization is complete. Apply RELRO. */
@@ -2333,8 +2336,7 @@ dl_main (const ElfW(Phdr) *phdr,
/* Notify the debugger all new objects are now ready to go. We must re-get
the address since by now the variable might be in another object. */
r = _dl_debug_update (LM_ID_BASE);
- r->r_state = RT_CONSISTENT;
- _dl_debug_state ();
+ _dl_debug_change_state (r, RT_CONSISTENT);
LIBC_PROBE (init_complete, 2, LM_ID_BASE, r);
/* Auditing checkpoint: we have added all objects. */