Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/proc-macro-srv/src/dylib.rs')
-rw-r--r--crates/proc-macro-srv/src/dylib.rs11
1 files changed, 8 insertions, 3 deletions
diff --git a/crates/proc-macro-srv/src/dylib.rs b/crates/proc-macro-srv/src/dylib.rs
index fe15d42b4e..cbf7a277bf 100644
--- a/crates/proc-macro-srv/src/dylib.rs
+++ b/crates/proc-macro-srv/src/dylib.rs
@@ -28,11 +28,16 @@ fn load_library(file: &Utf8Path) -> Result<Library, libloading::Error> {
#[cfg(unix)]
fn load_library(file: &Utf8Path) -> Result<Library, libloading::Error> {
+ // not defined by POSIX, different values on mips vs other targets
+ #[cfg(target_env = "gnu")]
+ use libc::RTLD_DEEPBIND;
use libloading::os::unix::Library as UnixLibrary;
- use std::os::raw::c_int;
+ // defined by POSIX
+ use libloading::os::unix::RTLD_NOW;
- const RTLD_NOW: c_int = 0x00002;
- const RTLD_DEEPBIND: c_int = 0x00008;
+ // MUSL and bionic don't have it..
+ #[cfg(not(target_env = "gnu"))]
+ const RTLD_DEEPBIND: std::os::raw::c_int = 0x0;
unsafe { UnixLibrary::open(Some(file), RTLD_NOW | RTLD_DEEPBIND).map(|lib| lib.into()) }
}