[OpenMP] Handle function calls from `libomp` to `libomptarget` correctly
authorShilei Tian <i@tianshilei.me>
Mon, 1 May 2023 22:25:11 +0000 (18:25 -0400)
committerShilei Tian <i@tianshilei.me>
Mon, 1 May 2023 22:49:21 +0000 (18:49 -0400)
commitc3efd7ec575cac19fe204bc5560fad28d16e9a72
tree39b37b2c5dbf3dd8247c03b38cb5c88cdeb1ed28
parentd572cd1b067f1177a981a4711bf2e501eaa8117b
[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