[OpenMP] Handle function calls from `libomp` to `libomptarget` correctly
authorShilei Tian <i@tianshilei.me>
Mon, 1 May 2023 22:16:32 +0000 (18:16 -0400)
committerShilei Tian <i@tianshilei.me>
Mon, 1 May 2023 22:19:16 +0000 (18:19 -0400)
commit479e335fc37c06767654141358ea076ac066de11
tree78860dcd6d60b6adbe61d4b2e6587085a8da4f3b
parentc9d14b23292979a9b3846cd55e2fc4d96b20f33f
[OpenMP] Handle function calls from `libomp` to `libomptarget` correctly

D132005 introduced function calls from `libomp` to `libomptarget` if offloading
is enabled. However, the external function declaration may not always work. For
example, it causes a link error on macOS. Currently it is guarded properly by
a macro, but in order to get OpenMP target offloading working on macOS, it has
to be handled correctly. This patch applies the same idea of how we support
target memory extension by using function pointer indirect call for that function.

Reviewed By: jdoerfert

Differential Revision: https://reviews.llvm.org/D149557
openmp/runtime/src/kmp.h
openmp/runtime/src/kmp_runtime.cpp
openmp/runtime/src/kmp_tasking.cpp