diff --git a/ddprof-lib/src/main/cpp/hotspot/hotspotStackFrame_aarch64.cpp b/ddprof-lib/src/main/cpp/hotspot/hotspotStackFrame_aarch64.cpp index d848cc6550..70d05a1da4 100644 --- a/ddprof-lib/src/main/cpp/hotspot/hotspotStackFrame_aarch64.cpp +++ b/ddprof-lib/src/main/cpp/hotspot/hotspotStackFrame_aarch64.cpp @@ -8,6 +8,10 @@ #include #include "hotspot/hotspotStackFrame.h" +// The VMNMethod accessors used below are inline in vmStructs.h and assert via crashProtectionActive() +// / cast_to(), both of which are defined in vmStructs.inline.h. Without this include, assertion-enabled +// builds (the gtest targets) leave those symbols unresolved at link time. +#include "hotspot/vmStructs.inline.h" static inline bool isSTP(instruction_t insn) { // stp xn, xm, [sp, #-imm]! diff --git a/ddprof-lib/src/main/cpp/hotspot/hotspotStackFrame_x64.cpp b/ddprof-lib/src/main/cpp/hotspot/hotspotStackFrame_x64.cpp index 24ab30b112..dad23b0dac 100644 --- a/ddprof-lib/src/main/cpp/hotspot/hotspotStackFrame_x64.cpp +++ b/ddprof-lib/src/main/cpp/hotspot/hotspotStackFrame_x64.cpp @@ -8,6 +8,9 @@ #include #include "hotspot/hotspotStackFrame.h" +// See the note in hotspotStackFrame_aarch64.cpp: the VMNMethod accessors need vmStructs.inline.h +// for crashProtectionActive() / cast_to() so assertion-enabled builds link. +#include "hotspot/vmStructs.inline.h" __attribute__((no_sanitize("address"))) bool HotspotStackFrame::unwindStub(instruction_t* entry, const char* name, uintptr_t& pc, uintptr_t& sp, uintptr_t& fp) { instruction_t* ip = (instruction_t*)pc; diff --git a/ddprof-lib/src/main/cpp/vmEntry.cpp b/ddprof-lib/src/main/cpp/vmEntry.cpp index 346511f14e..bcea72d07f 100644 --- a/ddprof-lib/src/main/cpp/vmEntry.cpp +++ b/ddprof-lib/src/main/cpp/vmEntry.cpp @@ -18,7 +18,10 @@ #include "os.h" #include "profiler.h" #include "safeAccess.h" -#include "hotspot/vmStructs.h" +// Pulls in vmStructs.h plus the definitions of crashProtectionActive()/cast_to() that its inline +// accessors odr-use here; the light vmStructs.h alone leaves those unresolved in assertion-enabled +// builds (see the note in hotspotStackFrame_aarch64.cpp). +#include "hotspot/vmStructs.inline.h" #include "hotspot/jitCodeCache.h" #include #include