summaryrefslogtreecommitdiff
path: root/src/coreclr/hosts/unixcorerun
diff options
context:
space:
mode:
authorJan Vorlicek <janvorli@microsoft.com>2015-09-01 13:25:55 +0200
committerJan Vorlicek <janvorli@microsoft.com>2015-09-01 15:17:36 +0200
commitc1f78205448365fc47dd5b802b6812bd78b109a8 (patch)
tree118b1ff188af8c9775bc34aecf1b07417746d937 /src/coreclr/hosts/unixcorerun
parent7b5e558e092b0afef8c2cdba0ba32e0e45308b90 (diff)
downloadcoreclr-c1f78205448365fc47dd5b802b6812bd78b109a8.tar.gz
coreclr-c1f78205448365fc47dd5b802b6812bd78b109a8.tar.bz2
coreclr-c1f78205448365fc47dd5b802b6812bd78b109a8.zip
Fix pthread locks initialization issue
This change fixes a problem on Linux when pinvoke loads a shared library and that library transitively uses pthread locks. In that case, the locks may not be initialized yet and behave as nops, causing the thread synchronization to not to work. Linking corerun / coreconsole with pthreads ensures that the locks are always properly initialized.
Diffstat (limited to 'src/coreclr/hosts/unixcorerun')
-rw-r--r--src/coreclr/hosts/unixcorerun/CMakeLists.txt11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/coreclr/hosts/unixcorerun/CMakeLists.txt b/src/coreclr/hosts/unixcorerun/CMakeLists.txt
index 5ffc1db81c..3d5d4d8cc8 100644
--- a/src/coreclr/hosts/unixcorerun/CMakeLists.txt
+++ b/src/coreclr/hosts/unixcorerun/CMakeLists.txt
@@ -18,12 +18,11 @@ if(NOT CMAKE_SYSTEM_NAME STREQUAL FreeBSD)
)
endif(NOT CMAKE_SYSTEM_NAME STREQUAL FreeBSD)
-# FreeBSD requires pthread to be loaded by the executable process
-if(CMAKE_SYSTEM_NAME STREQUAL FreeBSD)
- target_link_libraries(corerun
- pthread
- )
-endif(CMAKE_SYSTEM_NAME STREQUAL FreeBSD)
+# Libc turns locks into no-ops if pthread was not loaded into process yet. Loading
+# pthread by the process executable ensures that all locks are initialized properly.
+target_link_libraries(corerun
+ pthread
+)
add_dependencies(corerun
coreclr