[Openmp-commits] [openmp] 0753286 - [OpenMP] Add default stub for virtual methods (#174594)

via Openmp-commits openmp-commits at lists.llvm.org
Tue Jan 6 06:44:06 PST 2026


Author: Joseph Huber
Date: 2026-01-06T08:44:02-06:00
New Revision: 0753286b8e27f995d25b33a4cbd8d07ca0346aa7

URL: https://github.com/llvm/llvm-project/commit/0753286b8e27f995d25b33a4cbd8d07ca0346aa7
DIFF: https://github.com/llvm/llvm-project/commit/0753286b8e27f995d25b33a4cbd8d07ca0346aa7.diff

LOG: [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.

Added: 
    

Modified: 
    openmp/device/src/Misc.cpp

Removed: 
    


################################################################################
diff  --git a/openmp/device/src/Misc.cpp b/openmp/device/src/Misc.cpp
index a53fb4302fdb5..5d5a2a383f2b2 100644
--- a/openmp/device/src/Misc.cpp
+++ b/openmp/device/src/Misc.cpp
@@ -136,4 +136,10 @@ unsigned long long __llvm_omp_host_call(void *fn, void *data, size_t size) {
 }
 }
 
+// C++ ABI helpers.
+extern "C" {
+[[gnu::weak]] void __cxa_pure_virtual(void) { __builtin_trap(); }
+[[gnu::weak]] void __cxa_deleted_virtual(void) { __builtin_trap(); }
+}
+
 ///}


        


More information about the Openmp-commits mailing list