1 // RUN: %libomptarget-compile-aarch64-unknown-linux-gnu -DSHARED -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 -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 -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 -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 6 #ifdef SHARED 7 #include <stdio.h> 8 int foo() { 9 #pragma omp target 10 ; 11 printf("%s\n", "DONE."); 12 return 0; 13 } 14 #else 15 #include <dlfcn.h> 16 #include <stdio.h> 17 int main(int argc, char **argv) { 18 void *Handle = dlopen(argv[1], RTLD_NOW); 19 int (*Foo)(void); 20 21 if (Handle == NULL) { 22 printf("dlopen() failed: %s\n", dlerror()); 23 return 1; 24 } 25 Foo = (int (*)(void)) dlsym(Handle, "foo"); 26 if (Handle == NULL) { 27 printf("dlsym() failed: %s\n", dlerror()); 28 return 1; 29 } 30 // CHECK: DONE. 31 // CHECK-NOT: {{abort|fault}} 32 return Foo(); 33 } 34 #endif 35