Skip to content

Commit e8cbcef

Browse files
committed
Fix alloc_jemalloc on windows gnu targets
jemalloc prefixes the symbols by default on Windows so we need to account for that to avoid link errors such as: `undefined reference to `mallocx'` when using alloc_jemalloc.
1 parent 2a815a2 commit e8cbcef

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/liballoc_jemalloc/lib.rs

+8-8
Original file line numberDiff line numberDiff line change
@@ -41,28 +41,28 @@ use libc::{c_int, c_void, size_t};
4141
#[cfg(not(cargobuild))]
4242
extern {}
4343

44-
// Note that the symbols here are prefixed by default on OSX (we don't
45-
// explicitly request it), and on Android and DragonFly we explicitly request
46-
// it as unprefixing cause segfaults (mismatches in allocators).
44+
// Note that the symbols here are prefixed by default on OSX and Windows (we
45+
// don't explicitly request it), and on Android and DragonFly we explicitly
46+
// request it as unprefixing cause segfaults (mismatches in allocators).
4747
extern {
4848
#[cfg_attr(any(target_os = "macos", target_os = "android", target_os = "ios",
49-
target_os = "dragonfly"),
49+
target_os = "dragonfly", target_os = "windows"),
5050
link_name = "je_mallocx")]
5151
fn mallocx(size: size_t, flags: c_int) -> *mut c_void;
5252
#[cfg_attr(any(target_os = "macos", target_os = "android", target_os = "ios",
53-
target_os = "dragonfly"),
53+
target_os = "dragonfly", target_os = "windows"),
5454
link_name = "je_rallocx")]
5555
fn rallocx(ptr: *mut c_void, size: size_t, flags: c_int) -> *mut c_void;
5656
#[cfg_attr(any(target_os = "macos", target_os = "android", target_os = "ios",
57-
target_os = "dragonfly"),
57+
target_os = "dragonfly", target_os = "windows"),
5858
link_name = "je_xallocx")]
5959
fn xallocx(ptr: *mut c_void, size: size_t, extra: size_t, flags: c_int) -> size_t;
6060
#[cfg_attr(any(target_os = "macos", target_os = "android", target_os = "ios",
61-
target_os = "dragonfly"),
61+
target_os = "dragonfly", target_os = "windows"),
6262
link_name = "je_sdallocx")]
6363
fn sdallocx(ptr: *mut c_void, size: size_t, flags: c_int);
6464
#[cfg_attr(any(target_os = "macos", target_os = "android", target_os = "ios",
65-
target_os = "dragonfly"),
65+
target_os = "dragonfly", target_os = "windows"),
6666
link_name = "je_nallocx")]
6767
fn nallocx(size: size_t, flags: c_int) -> size_t;
6868
}

0 commit comments

Comments
 (0)