summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2022-10-28 15:07:26 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2022-10-28 15:07:26 +0000
commit1806d1aa95630f4062f022e475802bad19ae1ac8 (patch)
treee74433dd66eaadaf781217495136a0146775528c
parentad35fae8373b3bc2388bd738542f9c92c7631597 (diff)
Implement support for DT_MIPS_RLD_MAP_REL.
ok deraadt@
-rw-r--r--libexec/ld.so/loader.c7
-rw-r--r--sys/arch/mips64/include/exec.h5
2 files changed, 8 insertions, 4 deletions
diff --git a/libexec/ld.so/loader.c b/libexec/ld.so/loader.c
index 37aee92e602..4ed2527618e 100644
--- a/libexec/ld.so/loader.c
+++ b/libexec/ld.so/loader.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: loader.c,v 1.195 2022/01/08 06:49:41 guenther Exp $ */
+/* $OpenBSD: loader.c,v 1.196 2022/10/28 15:07:25 kettenis Exp $ */
/*
* Copyright (c) 1998 Per Fogelstrom, Opsycon AB
@@ -616,7 +616,10 @@ _dl_boot(const char **argv, char **envp, const long dyn_loff, long *dl_data)
*/
map_link = NULL;
#ifdef __mips__
- if (exe_obj->Dyn.info[DT_MIPS_RLD_MAP - DT_LOPROC + DT_NUM] != 0)
+ if (exe_obj->Dyn.info[DT_MIPS_RLD_MAP_REL - DT_LOPROC + DT_NUM] != 0)
+ map_link = (struct r_debug **)(exe_obj->Dyn.info[
+ DT_MIPS_RLD_MAP_REL - DT_LOPROC + DT_NUM] + exe_loff);
+ else if (exe_obj->Dyn.info[DT_MIPS_RLD_MAP - DT_LOPROC + DT_NUM] != 0)
map_link = (struct r_debug **)(exe_obj->Dyn.info[
DT_MIPS_RLD_MAP - DT_LOPROC + DT_NUM] + exe_loff);
#endif
diff --git a/sys/arch/mips64/include/exec.h b/sys/arch/mips64/include/exec.h
index 1c513bd4ab2..e7d18d1a48e 100644
--- a/sys/arch/mips64/include/exec.h
+++ b/sys/arch/mips64/include/exec.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: exec.h,v 1.9 2017/08/13 14:56:09 visa Exp $ */
+/* $OpenBSD: exec.h,v 1.10 2022/10/28 15:07:25 kettenis Exp $ */
/*
* Copyright (c) 1996-2004 Per Fogelstrom, Opsycon AB
@@ -63,8 +63,9 @@
#define DT_MIPS_GOTSYM 0x70000013 /* First GOT entry in .dynsym */
#define DT_MIPS_HIPAGENO 0x70000014 /* Number of GOT page table entries */
#define DT_MIPS_RLD_MAP 0x70000016 /* Address of debug map pointer */
+#define DT_MIPS_RLD_MAP_REL 0x70000035 /* Relative address of debug map ptr */
-#define DT_PROCNUM (DT_MIPS_RLD_MAP - DT_LOPROC + 1)
+#define DT_PROCNUM (DT_MIPS_RLD_MAP_REL - DT_LOPROC + 1)
/*
* Legal values for e_flags field of Elf32_Ehdr.