about summary refs log tree commit diff
path: root/elf/dl-reloc-static-pie.c
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2021-12-09 18:24:37 -0800
committerH.J. Lu <hjl.tools@gmail.com>2022-01-03 05:16:03 -0800
commit9288c92d0037745b940a90d59cbe102d4c218c26 (patch)
tree4edc09f879a504a05bdef6a473982023b8c06e25 /elf/dl-reloc-static-pie.c
parentbd1616c6bee625a2726d0f8b477881b4b25697d8 (diff)
downloadglibc-9288c92d0037745b940a90d59cbe102d4c218c26.tar.gz
glibc-9288c92d0037745b940a90d59cbe102d4c218c26.tar.xz
glibc-9288c92d0037745b940a90d59cbe102d4c218c26.zip
elf: Add <dl-debug.h>
Add <dl-debug.h> to setup debugging entry in PT_DYNAMIC segment to support
DT_DEBUG, DT_MIPS_RLD_MAP_REL and DT_MIPS_RLD_MAP.

Tested on x86-64, x32 and i686 as well as with build-many-glibcs.py.
Diffstat (limited to 'elf/dl-reloc-static-pie.c')
-rw-r--r--elf/dl-reloc-static-pie.c11
1 files changed, 2 insertions, 9 deletions
diff --git a/elf/dl-reloc-static-pie.c b/elf/dl-reloc-static-pie.c
index 261bdd6352..bf895e5dd0 100644
--- a/elf/dl-reloc-static-pie.c
+++ b/elf/dl-reloc-static-pie.c
@@ -24,6 +24,7 @@
 #include <ldsodefs.h>
 
 #include <dl-machine.h>
+#include <dl-debug.h>
 
 #define RESOLVE_MAP(map, scope, sym, version, flags) map
 #include "dynamic-link.h"
@@ -68,14 +69,6 @@ _dl_relocate_static_pie (void)
 
   /* Set up debugging before the debugger is notified for the first
      time.  */
-# ifdef ELF_MACHINE_DEBUG_SETUP
-  /* Some machines (e.g. MIPS) don't use DT_DEBUG in this way.  */
-  ELF_MACHINE_DEBUG_SETUP (main_map, r);
-# else
-  if (main_map->l_info[DT_DEBUG] != NULL)
-    /* There is a DT_DEBUG entry in the dynamic section.  Fill it in
-       with the run-time address of the r_debug structure  */
-    main_map->l_info[DT_DEBUG]->d_un.d_ptr = (ElfW(Addr)) r;
-# endif
+  elf_setup_debug_entry (main_map, r);
 }
 #endif