From 9c9b61df7e37bc1832b225c0c26123031727c8ef Mon Sep 17 00:00:00 2001 From: Joachim Protze Date: Fri, 22 Dec 2017 16:40:32 +0000 Subject: [PATCH] [OMPT] Fix failing test cases for gcc on Ubuntu 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 | 1 + openmp/runtime/test/ompt/loadtool/tool_available.c | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/openmp/runtime/test/ompt/callback.h b/openmp/runtime/test/ompt/callback.h index 6dc8834..3befe7c 100755 --- a/openmp/runtime/test/ompt/callback.h +++ b/openmp/runtime/test/ompt/callback.h @@ -1,4 +1,5 @@ #define _BSD_SOURCE +#define _DEFAULT_SOURCE #include #include #include diff --git a/openmp/runtime/test/ompt/loadtool/tool_available.c b/openmp/runtime/test/ompt/loadtool/tool_available.c index a6a79fe..dc00b03 100644 --- a/openmp/runtime/test/ompt/loadtool/tool_available.c +++ b/openmp/runtime/test/ompt/loadtool/tool_available.c @@ -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 -- 2.7.4