[llvm] [offload][omp] link libomptarget against liboffload (PR #221730)

Alex Duran via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 21 06:12:04 PDT 2026


================
@@ -29,9 +29,9 @@
 #ifdef OMPT_SUPPORT
 namespace llvm::omp::target {
 namespace ompt {
-bool Initialized = false;
-ompt_get_callback_t lookupCallbackByCode = nullptr;
-ompt_function_lookup_t lookupCallbackByName = nullptr;
+LLVM_ATTRIBUTE_WEAK bool Initialized = false;
----------------
adurang wrote:

Right now they need to be week because:
* When liboffload (alone) links the plugins to avoid duplicated symbols.
* When libomptarget+liboffload link the plugins they would be duplicated.

#221726 is gonna remove this in any case. So this change might be shortlived (or if it merges first then not needed at all).

We could also make them weak in libomptarget but that seem worst to me as it's the "real" definition.

Alternatively we could pull this out into separate file that is only compiled in the shared version of liboffload. Then they wouldn't need to be weak. But given #221726 should go in soon seems too much effort for very little gain.

https://github.com/llvm/llvm-project/pull/221730


More information about the llvm-commits mailing list