summaryrefslogtreecommitdiff
path: root/src/pal
diff options
context:
space:
mode:
authorPeter Jas <necmon@yahoo.com>2016-06-12 05:00:54 +0300
committerJan Kotas <jkotas@microsoft.com>2016-06-11 19:00:54 -0700
commitaf687f4600df72a103b1e0bb83d2b26a1d26a499 (patch)
tree5b4361a0e269c10d6aae256f94c4946a6168e066 /src/pal
parentd85c8560b06a5df27aef342a9f94fa33c2ec03b8 (diff)
downloadcoreclr-af687f4600df72a103b1e0bb83d2b26a1d26a499.tar.gz
coreclr-af687f4600df72a103b1e0bb83d2b26a1d26a499.tar.bz2
coreclr-af687f4600df72a103b1e0bb83d2b26a1d26a499.zip
Add check for gnu/lib-names.h (#5727)
The header `<gnu/lib-names.h>` is not present on musl-libc based OSes. Those names are not listed in any system header and this is deemed irrelevant to have such a header in musl according to: http://www.openwall.com/lists/musl/2013/11/09/1
Diffstat (limited to 'src/pal')
-rw-r--r--src/pal/src/config.h.in2
-rw-r--r--src/pal/src/configure.cmake6
-rw-r--r--src/pal/src/loader/module.cpp8
3 files changed, 14 insertions, 2 deletions
diff --git a/src/pal/src/config.h.in b/src/pal/src/config.h.in
index fd0c4221e7..73a79b845b 100644
--- a/src/pal/src/config.h.in
+++ b/src/pal/src/config.h.in
@@ -19,6 +19,7 @@
#cmakedefine01 HAVE_BSD_UUID_H
#cmakedefine01 HAVE_RUNETYPE_H
#cmakedefine01 HAVE_SYS_SYSCTL_H
+#cmakedefine01 HAVE_GNU_LIBNAMES_H
#cmakedefine01 HAVE_KQUEUE
#cmakedefine01 HAVE_GETPWUID_R
@@ -136,6 +137,7 @@
#cmakedefine01 HAVE_FULLY_FEATURED_PTHREAD_MUTEXES
#cmakedefine BSD_REGS_STYLE(reg, RR, rr) @BSD_REGS_STYLE@
#cmakedefine FREEBSD_LIBC "@FREEBSD_LIBC@"
+#cmakedefine MUSL_LIBC_SO "@MUSL_LIBC_SO@"
#cmakedefine01 HAVE_SCHED_OTHER_ASSIGNABLE
#define CHECK_TRACE_SPECIFIERS 0
diff --git a/src/pal/src/configure.cmake b/src/pal/src/configure.cmake
index 3889d72133..7e95a776e7 100644
--- a/src/pal/src/configure.cmake
+++ b/src/pal/src/configure.cmake
@@ -36,6 +36,7 @@ check_include_files(runetype.h HAVE_RUNETYPE_H)
check_include_files(lttng/tracepoint.h HAVE_LTTNG_TRACEPOINT_H)
check_include_files(uuid/uuid.h HAVE_LIBUUID_H)
check_include_files(sys/sysctl.h HAVE_SYS_SYSCTL_H)
+check_include_files(gnu/lib-names.h HAVE_GNU_LIBNAMES_H)
check_function_exists(kqueue HAVE_KQUEUE)
check_function_exists(getpwuid_r HAVE_GETPWUID_R)
@@ -1113,6 +1114,11 @@ else() # Anything else is Linux
unset(HAVE_LIBUUID_H CACHE)
message(FATAL_ERROR "Cannot find libuuid. Try installing uuid-dev or the appropriate packages for your platform")
endif()
+ if(NOT HAVE_GNU_LIBNAMES_H)
+ if(EXISTS /lib/libc.musl-x86_64.so.1)
+ set(MUSL_LIBC_SO "/lib/libc.musl-x86_64.so.1")
+ endif()
+ endif()
set(DEADLOCK_WHEN_THREAD_IS_SUSPENDED_WHILE_BLOCKED_ON_MUTEX 0)
set(PAL_PTRACE "ptrace((cmd), (pid), (void*)(addr), (data))")
set(PAL_PT_ATTACH PTRACE_ATTACH)
diff --git a/src/pal/src/loader/module.cpp b/src/pal/src/loader/module.cpp
index c7fe727c70..006d1bf933 100644
--- a/src/pal/src/loader/module.cpp
+++ b/src/pal/src/loader/module.cpp
@@ -54,7 +54,7 @@ Abstract:
#include <sys/types.h>
#include <sys/mman.h>
-#if defined(__linux__)
+#if HAVE_GNU_LIBNAMES_H
#include <gnu/lib-names.h>
#endif
@@ -1620,8 +1620,12 @@ static HMODULE LOADLoadLibrary(LPCSTR shortAsciiName, BOOL fDynamic)
shortAsciiName = FREEBSD_LIBC;
#elif defined(__NetBSD__)
shortAsciiName = "libc.so";
-#else
+#elif defined(LIBC_SO)
shortAsciiName = LIBC_SO;
+#elif defined(MUSL_LIBC_SO)
+ shortAsciiName = MUSL_LIBC_SO;
+#else
+#error Don't know how to get libc name on this platform
#endif
}