[Openmp-commits] [PATCH] D110706: Protect calls to KMP_DLSYM in kmp_alloc.cpp

Alban Bridonneau via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Wed Sep 29 05:57:57 PDT 2021

alban.bridonneau created this revision.
alban.bridonneau requested review of this revision.
Herald added a reviewer: jdoerfert.
Herald added subscribers: openmp-commits, sstefan1.
Herald added a project: OpenMP.

This fixes static builds of openmp. They currently
fail at runtime because of an "undefined symbol"
error. dlsym is only available for dynamic builds.

  rG LLVM Github Monorepo



Index: openmp/runtime/src/kmp_alloc.cpp
--- openmp/runtime/src/kmp_alloc.cpp
+++ openmp/runtime/src/kmp_alloc.cpp
@@ -1354,6 +1354,7 @@
 // Preview of target memory support
 void __kmp_init_target_mem() {
   *(void **)(&kmp_target_alloc_host) = KMP_DLSYM("llvm_omp_target_alloc_host");
   *(void **)(&kmp_target_alloc_shared) =
@@ -1363,6 +1364,7 @@
   __kmp_target_mem_available = kmp_target_alloc_host &&
                                kmp_target_alloc_shared &&
                                kmp_target_alloc_device && kmp_target_free;
 omp_allocator_handle_t __kmpc_init_allocator(int gtid, omp_memspace_handle_t ms,

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D110706.375849.patch
Type: text/x-patch
Size: 779 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20210929/a67b59cb/attachment.bin>

More information about the Openmp-commits mailing list