https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=87816a9327dcb13b51ac01b74b09aabea4a719d0
commit 87816a9327dcb13b51ac01b74b09aabea4a719d0
Author: Paul Floyd <pj...@wa...>
Date: Mon Apr 14 22:05:57 2025 +0200
Illumos readelf: patch for detection of DTrace .data sections
Taken from
https://github.com/oracle/solaris-userland/blob/master/components/valgrind/patches/03-dtrace-section.patch
Diff:
---
coregrind/m_debuginfo/readelf.c | 21 ++++++++++++++-------
1 file changed, 14 insertions(+), 7 deletions(-)
diff --git a/coregrind/m_debuginfo/readelf.c b/coregrind/m_debuginfo/readelf.c
index 0c37ea1009..61a39af2af 100644
--- a/coregrind/m_debuginfo/readelf.c
+++ b/coregrind/m_debuginfo/readelf.c
@@ -2200,17 +2200,24 @@ Bool ML_(read_elf_object) ( struct _DebugInfo* di )
}
}
}
- if (!loaded) {
-# if defined(SOLARIS_PT_SUNDWTRACE_THRP)
- if ((a_phdr.p_memsz == VKI_PT_SUNWDTRACE_SIZE)
- && ((a_phdr.p_flags & (PF_R | PF_W | PF_X)) == PF_R)) {
+# if defined(SOLARIS_PT_SUNDWTRACE_THRP)
+ if ((a_phdr.p_memsz == VKI_PT_SUNWDTRACE_SIZE)
+ && ((a_phdr.p_flags & (PF_R | PF_W | PF_X)) == PF_R)) {
+ if (dtrace_data_vaddr != 0) {
+ ML_(symerr)(di, True, "Multiple dtrace_data headers detected");
+ goto out;
+ }
+ dtrace_data_vaddr = a_phdr.p_vaddr;
+
+ /* DTrace related section might be outside all mapped regions. */
+ if (!loaded) {
TRACE_SYMTAB("PT_LOAD[%ld]: ignore dtrace_data program "
"header\n", i);
- dtrace_data_vaddr = a_phdr.p_vaddr;
continue;
}
-# endif /* SOLARIS_PT_SUNDWTRACE_THRP */
-
+ }
+# endif /* SOLARIS_PT_SUNDWTRACE_THRP */
+ if (!loaded) {
ML_(symerr)(di, False,
"ELF section outside all mapped regions");
/* This problem might be solved by further memory mappings.
|