Add DT_MIPS_RLD_MAP_REL support to the in-tree GDB.
authorkettenis <kettenis@openbsd.org>
Fri, 28 Oct 2022 15:09:39 +0000 (15:09 +0000)
committerkettenis <kettenis@openbsd.org>
Fri, 28 Oct 2022 15:09:39 +0000 (15:09 +0000)
ok deraadt@

gnu/usr.bin/binutils/gdb/solib-svr4.c
gnu/usr.bin/binutils/include/elf/mips.h

index 4a961e3..83a761c 100644 (file)
@@ -395,7 +395,8 @@ elf_locate_base (void)
                                      (bfd_byte *) x_dynp->d_un.d_ptr);
              return dyn_ptr;
            }
-         else if (dyn_tag == DT_MIPS_RLD_MAP)
+         else if (dyn_tag == DT_MIPS_RLD_MAP ||
+                  dyn_tag == DT_MIPS_RLD_MAP_REL)
            {
              char *pbuf;
              int pbuf_size = TARGET_PTR_BIT / HOST_CHAR_BIT;
@@ -405,6 +406,8 @@ elf_locate_base (void)
                 of the dynamic link structure.  */
              dyn_ptr = bfd_h_get_64 (exec_bfd, 
                                      (bfd_byte *) x_dynp->d_un.d_ptr);
+             if (dyn_tag == DT_MIPS_RLD_MAP_REL)
+               dyn_ptr += (entry_addr - bfd_get_start_address(exec_bfd));
              if (target_read_memory (dyn_ptr, pbuf, pbuf_size))
                return 0;
              return extract_unsigned_integer (pbuf, pbuf_size);
index ce43158..eecd6d5 100644 (file)
@@ -632,6 +632,9 @@ extern void bfd_mips_elf32_swap_reginfo_out
 
 /* Address of auxiliary .dynamic.  */
 #define DT_MIPS_AUX_DYNAMIC    0x70000031
+
+/* Relative address of run time loader map, used for debugging.  */
+#define DT_MIPS_RLD_MAP_REL    0x70000035
 \f
 /* Flags which may appear in a DT_MIPS_FLAGS entry.  */