From 6c048723f83fad6c96c2e19d6dfa1db547371c11 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Tue, 21 Apr 2015 15:56:55 -0700 Subject: std: Prepare for linking to musl This commit modifies the standard library and its dependencies to link correctly when built against MUSL. This primarily ensures that the right libraries are linked against and when they're linked against they're linked against statically. --- src/libstd/sys/unix/time.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/libstd/sys') diff --git a/src/libstd/sys/unix/time.rs b/src/libstd/sys/unix/time.rs index d2f51678d49..f59eb2c0301 100644 --- a/src/libstd/sys/unix/time.rs +++ b/src/libstd/sys/unix/time.rs @@ -82,7 +82,8 @@ mod inner { // OpenBSD provide it via libc #[cfg(not(any(target_os = "android", target_os = "bitrig", - target_os = "openbsd")))] + target_os = "openbsd", + target_env = "musl")))] #[link(name = "rt")] extern {} -- cgit 1.4.1-3-g733a5 From 7dd62155d85e9556c2b2b70c03acce9910896696 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Tue, 21 Apr 2015 20:01:34 -0700 Subject: std: Don't assume dlopen() works on yourself Statically linked executables do not succeed (aka MUSL-based executables). --- src/libstd/sys/unix/thread.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/libstd/sys') diff --git a/src/libstd/sys/unix/thread.rs b/src/libstd/sys/unix/thread.rs index 281ac37e671..cfab9d1c51a 100644 --- a/src/libstd/sys/unix/thread.rs +++ b/src/libstd/sys/unix/thread.rs @@ -342,7 +342,10 @@ fn min_stack_size(attr: *const libc::pthread_attr_t) -> usize { static mut __pthread_get_minstack: Option = None; INIT.call_once(|| { - let lib = DynamicLibrary::open(None).unwrap(); + let lib = match DynamicLibrary::open(None) { + Ok(l) => l, + Err(..) => return, + }; unsafe { if let Ok(f) = lib.symbol("__pthread_get_minstack") { __pthread_get_minstack = Some(mem::transmute::<*const (), F>(f)); -- cgit 1.4.1-3-g733a5