Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0753286

Browse files
authored
[OpenMP] Add default stub for virtual methods (#174594)
Summary: Recent OpenMP patches have added real support for virtual functions on the device side. However, we don't provide some of the C++ ABI functions that are emitted when using these. In practice these functions just call `std::terminate` so we can just trap here. These are marked weak so they will be overridden by a more correct implementation if not defined and will also not extract on their own from a static library.
1 parent 7c5eb6a commit 0753286

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

openmp/device/src/Misc.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,4 +136,10 @@ unsigned long long __llvm_omp_host_call(void *fn, void *data, size_t size) {
136136
}
137137
}
138138

139+
// C++ ABI helpers.
140+
extern "C" {
141+
[[gnu::weak]] void __cxa_pure_virtual(void) { __builtin_trap(); }
142+
[[gnu::weak]] void __cxa_deleted_virtual(void) { __builtin_trap(); }
143+
}
144+
139145
///}

0 commit comments

Comments
 (0)