[OMPT] Fix failing test cases for gcc on Ubuntu
authorJoachim Protze <protze@itc.rwth-aachen.de>
Fri, 22 Dec 2017 16:40:32 +0000 (16:40 +0000)
committerJoachim Protze <protze@itc.rwth-aachen.de>
Fri, 22 Dec 2017 16:40:32 +0000 (16:40 +0000)
The compiler warns that _BSD_SOURCE is deprecated and _DEFAULT_SOURCE should
be used instead. We keep _BSD_SOURCE for older compilers, that don't know
about _DEFAULT_SOURCE.

The linker drops the tool when linking, since there is no visible need for
the library. So we need to tell the linker, that the tool should be linked
anyway.

Differential Revision: https://reviews.llvm.org/D41499

llvm-svn: 321362

openmp/runtime/test/ompt/callback.h
openmp/runtime/test/ompt/loadtool/tool_available.c

index 6dc8834..3befe7c 100755 (executable)
@@ -1,4 +1,5 @@
 #define _BSD_SOURCE
+#define _DEFAULT_SOURCE
 #include <stdio.h>
 #include <inttypes.h>
 #include <omp.h>
index a6a79fe..dc00b03 100644 (file)
@@ -7,9 +7,9 @@
 // RUN: %clang %flags -DTOOL -shared -fPIC %s -o %T/tool.so
 // 2. "introducing a dynamically-linked library that includes the tool’s definition of ompt_start_tool into the application’s address space"
 // 2.1 Link with tool during compilation
-// RUN: %libomp-compile -DCODE %T/tool.so && %libomp-run | FileCheck %s
+// RUN: %libomp-compile -DCODE -Wl,--no-as-needed %T/tool.so && %libomp-run | FileCheck %s
 // 2.2 Link with tool during compilation, but AFTER the runtime
-// RUN: %libomp-compile -DCODE -lomp %T/tool.so && %libomp-run | FileCheck %s
+// RUN: %libomp-compile -DCODE -lomp -Wl,--no-as-needed %T/tool.so && %libomp-run | FileCheck %s
 // 2.3 Inject tool via the dynamic loader
 // RUN: %libomp-compile -DCODE && %preload-tool %libomp-run | FileCheck %s