about summary refs log tree commit diff
path: root/src/liballoc_jemalloc/lib.rs
diff options
context:
space:
mode:
authorShiz <hi@shiz.me>2017-04-08 20:36:00 +0200
committerShiz <hi@shiz.me>2017-04-08 22:28:32 +0200
commit536011d929ecbd1170baf34e09580e567c971f95 (patch)
tree7e93c8534833baa58f6baa6399d0b8bca61e666f /src/liballoc_jemalloc/lib.rs
parenta61011761deeab9e308e6d103b1dc7aaf334f6e3 (diff)
downloadrust-536011d929ecbd1170baf34e09580e567c971f95.tar.gz
rust-536011d929ecbd1170baf34e09580e567c971f95.zip
Fix jemalloc support for musl
Just like DragonFlyBSD, using the same symbols as the system allocator will
result in a segmentation fault at runtime due to allocator mismatches.
As such, prefix the jemalloc symbols instead.
Diffstat (limited to 'src/liballoc_jemalloc/lib.rs')
-rw-r--r--src/liballoc_jemalloc/lib.rs10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/liballoc_jemalloc/lib.rs b/src/liballoc_jemalloc/lib.rs
index a7a67ef76d4..83cc1ef09c2 100644
--- a/src/liballoc_jemalloc/lib.rs
+++ b/src/liballoc_jemalloc/lib.rs
@@ -35,23 +35,23 @@ mod imp {
     // request it as unprefixing cause segfaults (mismatches in allocators).
     extern "C" {
         #[cfg_attr(any(target_os = "macos", target_os = "android", target_os = "ios",
-                       target_os = "dragonfly", target_os = "windows"),
+                       target_os = "dragonfly", target_os = "windows", target_env = "musl"),
                    link_name = "je_mallocx")]
         fn mallocx(size: size_t, flags: c_int) -> *mut c_void;
         #[cfg_attr(any(target_os = "macos", target_os = "android", target_os = "ios",
-                       target_os = "dragonfly", target_os = "windows"),
+                       target_os = "dragonfly", target_os = "windows", target_env = "musl"),
                    link_name = "je_rallocx")]
         fn rallocx(ptr: *mut c_void, size: size_t, flags: c_int) -> *mut c_void;
         #[cfg_attr(any(target_os = "macos", target_os = "android", target_os = "ios",
-                       target_os = "dragonfly", target_os = "windows"),
+                       target_os = "dragonfly", target_os = "windows", target_env = "musl"),
                    link_name = "je_xallocx")]
         fn xallocx(ptr: *mut c_void, size: size_t, extra: size_t, flags: c_int) -> size_t;
         #[cfg_attr(any(target_os = "macos", target_os = "android", target_os = "ios",
-                       target_os = "dragonfly", target_os = "windows"),
+                       target_os = "dragonfly", target_os = "windows", target_env = "musl"),
                    link_name = "je_sdallocx")]
         fn sdallocx(ptr: *mut c_void, size: size_t, flags: c_int);
         #[cfg_attr(any(target_os = "macos", target_os = "android", target_os = "ios",
-                       target_os = "dragonfly", target_os = "windows"),
+                       target_os = "dragonfly", target_os = "windows", target_env = "musl"),
                    link_name = "je_nallocx")]
         fn nallocx(size: size_t, flags: c_int) -> size_t;
     }