1 // RUN: %libomptarget-compile-aarch64-unknown-linux-gnu -DSHARED -fPIC -shared -o %t.so && %clang %flags %s -o %t-aarch64-unknown-linux-gnu -ldl && %libomptarget-run-aarch64-unknown-linux-gnu %t.so 2>&1 | %fcheck-aarch64-unknown-linux-gnu 2 // RUN: %libomptarget-compile-powerpc64-ibm-linux-gnu -DSHARED -fPIC -shared -o %t.so && %clang %flags %s -o %t-powerpc64-ibm-linux-gnu -ldl && %libomptarget-run-powerpc64-ibm-linux-gnu %t.so 2>&1 | %fcheck-powerpc64-ibm-linux-gnu 3 // RUN: %libomptarget-compile-powerpc64le-ibm-linux-gnu -DSHARED -fPIC -shared -o %t.so && %clang %flags %s -o %t-powerpc64le-ibm-linux-gnu -ldl && %libomptarget-run-powerpc64le-ibm-linux-gnu %t.so 2>&1 | %fcheck-powerpc64le-ibm-linux-gnu 4 // RUN: %libomptarget-compile-x86_64-pc-linux-gnu -DSHARED -fPIC -shared -o %t.so && %clang %flags %s -o %t-x86_64-pc-linux-gnu -ldl && %libomptarget-run-x86_64-pc-linux-gnu %t.so 2>&1 | %fcheck-x86_64-pc-linux-gnu 5 // RUN: %libomptarget-compile-nvptx64-nvidia-cuda -DSHARED -fPIC -shared -o %t.so && %clang %flags %s -o %t-nvptx64-nvidia-cuda -ldl && %libomptarget-run-nvptx64-nvidia-cuda %t.so 2>&1 | %fcheck-nvptx64-nvidia-cuda 6 7 #ifdef SHARED 8 #include <stdio.h> 9 int foo() { 10 #pragma omp target 11 ; 12 printf("%s\n", "DONE."); 13 return 0; 14 } 15 #else 16 #include <dlfcn.h> 17 #include <stdio.h> 18 int main(int argc, char **argv) { 19 void *Handle = dlopen(argv[1], RTLD_NOW); 20 int (*Foo)(void); 21 22 if (Handle == NULL) { 23 printf("dlopen() failed: %s\n", dlerror()); 24 return 1; 25 } 26 Foo = (int (*)(void)) dlsym(Handle, "foo"); 27 if (Handle == NULL) { 28 printf("dlsym() failed: %s\n", dlerror()); 29 return 1; 30 } 31 // CHECK: DONE. 32 // CHECK-NOT: {{abort|fault}} 33 return Foo(); 34 } 35 #endif 36