aboutsummaryrefslogtreecommitdiffstats
path: root/testing/rust/musl-fix-jemalloc.patch
diff options
context:
space:
mode:
authorShiz <hi@shiz.me>2017-04-16 15:56:18 +0000
committerJakub Jirutka <jakub@jirutka.cz>2017-04-21 01:44:33 +0200
commit3db351aa5647eb4a482e9e008bedcf1a5be51302 (patch)
treefe64ea58b55936fc2da3f78eaa48c1703ec6bcf6 /testing/rust/musl-fix-jemalloc.patch
parente4cc4b79b548e043d635ff35c3e9f2e832be1202 (diff)
testing/rust: reorganize patches
This divides up the patches in three logical categories: - musl-*.patch: musl support patches intended for upstreaming; - alpine-*.patch: Alpine-specific patches that are likely not upstreamable; - *.patch: functionality patch that may make it upstream.
Diffstat (limited to 'testing/rust/musl-fix-jemalloc.patch')
-rw-r--r--testing/rust/musl-fix-jemalloc.patch61
1 files changed, 61 insertions, 0 deletions
diff --git a/testing/rust/musl-fix-jemalloc.patch b/testing/rust/musl-fix-jemalloc.patch
new file mode 100644
index 00000000000..345398a3018
--- /dev/null
+++ b/testing/rust/musl-fix-jemalloc.patch
@@ -0,0 +1,61 @@
+From 536011d929ecbd1170baf34e09580e567c971f95 Mon Sep 17 00:00:00 2001
+From: Shiz <hi@shiz.me>
+Date: Sat, 8 Apr 2017 20:36:00 +0200
+Subject: [PATCH] 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.
+
+Upstream-Issue: https://github.com/rust-lang/rust/pull/41168
+---
+ src/liballoc_jemalloc/build.rs | 2 +-
+ src/liballoc_jemalloc/lib.rs | 10 +++++-----
+ 2 files changed, 6 insertions(+), 6 deletions(-)
+
+diff --git a/src/liballoc_jemalloc/build.rs b/src/liballoc_jemalloc/build.rs
+index ae040a2..f3a0eeb 100644
+--- a/src/liballoc_jemalloc/build.rs
++++ b/src/liballoc_jemalloc/build.rs
+@@ -138,7 +138,7 @@ fn main() {
+ // should be good to go!
+ cmd.arg("--with-jemalloc-prefix=je_");
+ cmd.arg("--disable-tls");
+- } else if target.contains("dragonfly") {
++ } else if target.contains("dragonfly") || target.contains("musl") {
+ cmd.arg("--with-jemalloc-prefix=je_");
+ }
+
+diff --git a/src/liballoc_jemalloc/lib.rs b/src/liballoc_jemalloc/lib.rs
+index a7a67ef..83cc1ef 100644
+--- a/src/liballoc_jemalloc/lib.rs
++++ b/src/liballoc_jemalloc/lib.rs
+@@ -51,23 +51,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;
+ }