Skip to content

Commit 57aca28

Browse files
rkennkeclaude
andcommitted
fix(build): link vmStructs inline definitions in assertion-enabled builds
crashProtectionActive() and cast_to() are declared inline in vmStructs.h (where the VMNMethod / cast accessors odr-use them inside assert(...)) but defined only in vmStructs.inline.h. TUs that include the light vmStructs.h without the .inline.h counterpart therefore odr-use those inline functions with no visible definition. In NDEBUG builds the asserts compile out, so the main release .so links; but the gtest targets keep assertions on, leaving crashProtectionActive() unresolved at link time. It surfaced first on hotspotStackFrame_aarch64.o (x86_64 optimizes the reference away, so CI stayed green), breaking every aarch64 gtest link. Include vmStructs.inline.h in the TUs that odr-use the accessors (hotspotStackFrame_{aarch64,x64}.cpp, vmEntry.cpp), matching the codebase's .h / .inline.h split. vmEntry.cpp's redundant direct vmStructs.h include is dropped since the .inline.h pulls it in. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 23ca07d commit 57aca28

3 files changed

Lines changed: 11 additions & 1 deletion

File tree

ddprof-lib/src/main/cpp/hotspot/hotspotStackFrame_aarch64.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@
88

99
#include <string.h>
1010
#include "hotspot/hotspotStackFrame.h"
11+
// The VMNMethod accessors used below are inline in vmStructs.h and assert via crashProtectionActive()
12+
// / cast_to(), both of which are defined in vmStructs.inline.h. Without this include, assertion-enabled
13+
// builds (the gtest targets) leave those symbols unresolved at link time.
14+
#include "hotspot/vmStructs.inline.h"
1115

1216
static inline bool isSTP(instruction_t insn) {
1317
// stp xn, xm, [sp, #-imm]!

ddprof-lib/src/main/cpp/hotspot/hotspotStackFrame_x64.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88

99
#include <string.h>
1010
#include "hotspot/hotspotStackFrame.h"
11+
// See the note in hotspotStackFrame_aarch64.cpp: the VMNMethod accessors need vmStructs.inline.h
12+
// for crashProtectionActive() / cast_to() so assertion-enabled builds link.
13+
#include "hotspot/vmStructs.inline.h"
1114

1215
__attribute__((no_sanitize("address"))) bool HotspotStackFrame::unwindStub(instruction_t* entry, const char* name, uintptr_t& pc, uintptr_t& sp, uintptr_t& fp) {
1316
instruction_t* ip = (instruction_t*)pc;

ddprof-lib/src/main/cpp/vmEntry.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,10 @@
1818
#include "os.h"
1919
#include "profiler.h"
2020
#include "safeAccess.h"
21-
#include "hotspot/vmStructs.h"
21+
// Pulls in vmStructs.h plus the definitions of crashProtectionActive()/cast_to() that its inline
22+
// accessors odr-use here; the light vmStructs.h alone leaves those unresolved in assertion-enabled
23+
// builds (see the note in hotspotStackFrame_aarch64.cpp).
24+
#include "hotspot/vmStructs.inline.h"
2225
#include "hotspot/jitCodeCache.h"
2326
#include <atomic>
2427
#include <dlfcn.h>

0 commit comments

Comments
 (0)