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.
This commit is contained in:
parent
a61011761d
commit
536011d929
2 changed files with 6 additions and 6 deletions
|
@ -129,7 +129,7 @@ fn main() {
|
||||||
// should be good to go!
|
// should be good to go!
|
||||||
cmd.arg("--with-jemalloc-prefix=je_");
|
cmd.arg("--with-jemalloc-prefix=je_");
|
||||||
cmd.arg("--disable-tls");
|
cmd.arg("--disable-tls");
|
||||||
} else if target.contains("dragonfly") {
|
} else if target.contains("dragonfly") || target.contains("musl") {
|
||||||
cmd.arg("--with-jemalloc-prefix=je_");
|
cmd.arg("--with-jemalloc-prefix=je_");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -35,23 +35,23 @@ mod imp {
|
||||||
// request it as unprefixing cause segfaults (mismatches in allocators).
|
// request it as unprefixing cause segfaults (mismatches in allocators).
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#[cfg_attr(any(target_os = "macos", target_os = "android", target_os = "ios",
|
#[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")]
|
link_name = "je_mallocx")]
|
||||||
fn mallocx(size: size_t, flags: c_int) -> *mut c_void;
|
fn mallocx(size: size_t, flags: c_int) -> *mut c_void;
|
||||||
#[cfg_attr(any(target_os = "macos", target_os = "android", target_os = "ios",
|
#[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")]
|
link_name = "je_rallocx")]
|
||||||
fn rallocx(ptr: *mut c_void, size: size_t, flags: c_int) -> *mut c_void;
|
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",
|
#[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")]
|
link_name = "je_xallocx")]
|
||||||
fn xallocx(ptr: *mut c_void, size: size_t, extra: size_t, flags: c_int) -> size_t;
|
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",
|
#[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")]
|
link_name = "je_sdallocx")]
|
||||||
fn sdallocx(ptr: *mut c_void, size: size_t, flags: c_int);
|
fn sdallocx(ptr: *mut c_void, size: size_t, flags: c_int);
|
||||||
#[cfg_attr(any(target_os = "macos", target_os = "android", target_os = "ios",
|
#[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")]
|
link_name = "je_nallocx")]
|
||||||
fn nallocx(size: size_t, flags: c_int) -> size_t;
|
fn nallocx(size: size_t, flags: c_int) -> size_t;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue