[Openmp-commits] [PATCH] D59451: Fix gettid warnings and one test on FreeBSD
Dimitry Andric via Phabricator via Openmp-commits
openmp-commits at lists.llvm.org
Sun Mar 24 08:01:49 PDT 2019
dim updated this revision to Diff 192032.
dim added a comment.
Readdress the issue in a different way: add `-pthread` in the
`OpenMPTesting.cmake` file instead. The top-level LLVM `config-ix.cmake` file
mangles the value of the needed `CMAKE_THREAD_LIBS_INIT` variable, so derive the
flag from this, instead of directly using it.
While here, adjust `LibompHandleFlags.cmake` to add `-lm` for FreeBSD too, and
add a check for the correct `libm.so.5` to `LibompMicroTests.cmake`.
Finally, remove all the manual pthread flags from the test cases. They can all
just use the `%libomp-compile-and-run` variable now.
Repository:
rOMP OpenMP
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D59451/new/
https://reviews.llvm.org/D59451
Files:
cmake/OpenMPTesting.cmake
runtime/cmake/LibompHandleFlags.cmake
runtime/cmake/LibompMicroTests.cmake
runtime/test/misc_bugs/omp_foreign_thread_team_reuse.c
runtime/test/tasking/bug_nested_proxy_task.c
runtime/test/tasking/bug_proxy_task_dep_waiting.c
Index: runtime/test/tasking/bug_proxy_task_dep_waiting.c
===================================================================
--- runtime/test/tasking/bug_proxy_task_dep_waiting.c
+++ runtime/test/tasking/bug_proxy_task_dep_waiting.c
@@ -1,4 +1,4 @@
-// RUN: %libomp-compile -lpthread && %libomp-run
+// RUN: %libomp-compile-and-run
// REQUIRES: openmp-4.5
// The runtime currently does not get dependency information from GCC.
// UNSUPPORTED: gcc
Index: runtime/test/tasking/bug_nested_proxy_task.c
===================================================================
--- runtime/test/tasking/bug_nested_proxy_task.c
+++ runtime/test/tasking/bug_nested_proxy_task.c
@@ -1,4 +1,4 @@
-// RUN: %libomp-compile -lpthread && %libomp-run
+// RUN: %libomp-compile-and-run
// REQUIRES: openmp-4.5
// The runtime currently does not get dependency information from GCC.
// UNSUPPORTED: gcc
Index: runtime/test/misc_bugs/omp_foreign_thread_team_reuse.c
===================================================================
--- runtime/test/misc_bugs/omp_foreign_thread_team_reuse.c
+++ runtime/test/misc_bugs/omp_foreign_thread_team_reuse.c
@@ -1,4 +1,4 @@
-// RUN: %libomp-compile -lpthread && %libomp-run
+// RUN: %libomp-compile-and-run
#include <stdio.h>
#include "omp_testsuite.h"
Index: runtime/cmake/LibompMicroTests.cmake
===================================================================
--- runtime/cmake/LibompMicroTests.cmake
+++ runtime/cmake/LibompMicroTests.cmake
@@ -170,7 +170,7 @@
add_custom_target(libomp-test-deps DEPENDS test-deps/.success)
set(libomp_expected_library_deps)
if(CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
- set(libomp_expected_library_deps libc.so.7 libthr.so.3)
+ set(libomp_expected_library_deps libc.so.7 libthr.so.3 libm.so.5)
libomp_append(libomp_expected_library_deps libhwloc.so.5 LIBOMP_USE_HWLOC)
elseif(CMAKE_SYSTEM_NAME MATCHES "NetBSD")
set(libomp_expected_library_deps libc.so.12 libpthread.so.1 libm.so.0)
Index: runtime/cmake/LibompHandleFlags.cmake
===================================================================
--- runtime/cmake/LibompHandleFlags.cmake
+++ runtime/cmake/LibompHandleFlags.cmake
@@ -158,14 +158,13 @@
if(${IA32})
libomp_append(libflags_local -lirc_pic LIBOMP_HAVE_IRC_PIC_LIBRARY)
endif()
- IF(${CMAKE_SYSTEM_NAME} MATCHES "DragonFly")
+ if(${CMAKE_SYSTEM_NAME} MATCHES "DragonFly")
libomp_append(libflags_local "-Wl,--no-as-needed" LIBOMP_HAVE_AS_NEEDED_FLAG)
libomp_append(libflags_local "-lm")
libomp_append(libflags_local "-Wl,--as-needed" LIBOMP_HAVE_AS_NEEDED_FLAG)
- ENDIF(${CMAKE_SYSTEM_NAME} MATCHES "DragonFly")
- IF(${CMAKE_SYSTEM_NAME} MATCHES "NetBSD")
+ elseif(${CMAKE_SYSTEM_NAME} MATCHES "(Free|Net)BSD")
libomp_append(libflags_local -lm)
- ENDIF(${CMAKE_SYSTEM_NAME} MATCHES "NetBSD")
+ endif()
set(libflags_local ${libflags_local} ${LIBOMP_LIBFLAGS})
libomp_setup_flags(libflags_local)
set(${libflags} ${libflags_local} PARENT_SCOPE)
Index: cmake/OpenMPTesting.cmake
===================================================================
--- cmake/OpenMPTesting.cmake
+++ cmake/OpenMPTesting.cmake
@@ -122,6 +122,12 @@
set(OPENMP_TEST_COMPILER_VERSION_MAJOR_MINOR "${LLVM_MAJOR_VERSION}.${LLVM_MINOR_VERSION}")
# TODO: Implement blockaddress in GlobalISel and remove this flag!
set(OPENMP_TEST_COMPILER_OPENMP_FLAGS "-fopenmp -fno-experimental-isel")
+ # Unfortunately the top-level cmake/config-ix.cmake file mangles CMake's
+ # CMAKE_THREAD_LIBS_INIT variable from the FindThreads package, so work
+ # around that, until it is fixed there.
+ if(${CMAKE_THREAD_LIBS_INIT} STREQUAL "-lpthread")
+ set(OPENMP_TEST_COMPILER_OPENMP_FLAGS "${OPENMP_TEST_COMPILER_OPENMP_FLAGS} -pthread")
+ endif()
endif()
# Function to set compiler features for use in lit.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D59451.192032.patch
Type: text/x-patch
Size: 3815 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20190324/da81644d/attachment.bin>
More information about the Openmp-commits
mailing list