summaryrefslogtreecommitdiff
path: root/absl/debugging/internal/vdso_support.cc
diff options
context:
space:
mode:
authorGravatar Thomas Klausner <tk@giga.or.at>2022-03-08 22:01:16 +0100
committerGravatar GitHub <noreply@github.com>2022-03-08 16:01:16 -0500
commitc5a424a2a21005660b182516eb7a079cd8021699 (patch)
treecdae460da858ad3460a6a3dd48ceb358096d5702 /absl/debugging/internal/vdso_support.cc
parentf9b99adeddbe71208e65cead5f349add7aa9c9b5 (diff)
Add NetBSD support (#1121)
Diffstat (limited to 'absl/debugging/internal/vdso_support.cc')
-rw-r--r--absl/debugging/internal/vdso_support.cc9
1 files changed, 9 insertions, 0 deletions
diff --git a/absl/debugging/internal/vdso_support.cc b/absl/debugging/internal/vdso_support.cc
index 8a015d55..c655cf45 100644
--- a/absl/debugging/internal/vdso_support.cc
+++ b/absl/debugging/internal/vdso_support.cc
@@ -50,6 +50,10 @@
#define AT_SYSINFO_EHDR 33 // for crosstoolv10
#endif
+#if defined(__NetBSD__)
+using Elf32_auxv_t = Aux32Info;
+using Elf64_auxv_t = Aux64Info;
+#endif
#if defined(__FreeBSD__)
#if defined(__ELF_WORD_SIZE) && __ELF_WORD_SIZE == 64
using Elf64_auxv_t = Elf64_Auxinfo;
@@ -106,8 +110,13 @@ const void *VDSOSupport::Init() {
ElfW(auxv_t) aux;
while (read(fd, &aux, sizeof(aux)) == sizeof(aux)) {
if (aux.a_type == AT_SYSINFO_EHDR) {
+#if defined(__NetBSD__)
+ vdso_base_.store(reinterpret_cast<void *>(aux.a_v),
+ std::memory_order_relaxed);
+#else
vdso_base_.store(reinterpret_cast<void *>(aux.a_un.a_val),
std::memory_order_relaxed);
+#endif
break;
}
}