diff options
author | Jakub Jirutka <jakub@jirutka.cz> | 2017-04-08 20:58:17 +0200 |
---|---|---|
committer | Jakub Jirutka <jakub@jirutka.cz> | 2017-04-09 15:41:28 +0200 |
commit | 2a232275cdf5d5974211cca01d02c76cb31d0931 (patch) | |
tree | 7bf7288876d15f454fcfb7eb88c678741a13ddec /testing | |
parent | 2e440a2067add072c4c1936e9496b06b1b403b4c (diff) | |
download | aports-2a232275cdf5d5974211cca01d02c76cb31d0931.tar.bz2 aports-2a232275cdf5d5974211cca01d02c76cb31d0931.tar.xz |
testing/rust: build with vendored jemalloc
Diffstat (limited to 'testing')
-rw-r--r-- | testing/rust/APKBUILD | 18 | ||||
-rw-r--r-- | testing/rust/fix-jemalloc-musl.patch | 61 |
2 files changed, 67 insertions, 12 deletions
diff --git a/testing/rust/APKBUILD b/testing/rust/APKBUILD index 3ae2222d33..962a392629 100644 --- a/testing/rust/APKBUILD +++ b/testing/rust/APKBUILD @@ -35,6 +35,7 @@ source="https://static.rust-lang.org/dist/rustc-$pkgver-src.tar.gz llvm-with-ffi.patch move-py-scripts-to-share.patch change-rpath-to-rustlib.patch + fix-jemalloc-musl.patch " # TODO: strip gently (see Fedora pkg for inspiration) options="!strip !check" @@ -56,14 +57,8 @@ prepare() { # invoking make. sed -i /LD_LIBRARY_PATH/d src/bootstrap/bootstrap.py - # Remove some bundled dependencies. - rm -Rf src/llvm/ src/jemalloc/ - - # These tests assume that alloc_jemalloc is present, disable them. - sed -i "1i // ignore-test jemalloc is disabled" \ - src/test/compile-fail/allocator-dylib-is-system.rs \ - src/test/compile-fail/allocator-rust-dylib-is-jemalloc.rs \ - src/test/run-pass/allocator-default.rs + # Remove bundled dependency + rm -Rf src/llvm/ # Prepare our stage0 for bootstrapping. mkdir -p "$_stage0dir" @@ -76,7 +71,6 @@ prepare() { build() { cd "$builddir" - # Note: rustc doesn't work well with jemalloc on musl (yet) ./configure \ --enable-rustbuild \ --build="$_ctarget" \ @@ -90,8 +84,7 @@ build() { --musl-root="/usr" \ --enable-vendor \ --enable-llvm-link-shared \ - --disable-docs \ - --disable-jemalloc + --disable-docs # Set LD_LIBRARY_PATH, so rustc in stage0 can find correct libs. make \ @@ -182,4 +175,5 @@ a87ffe129debcb9fa958c6d007ffa4a87927890030e0694ee5ab1929ea0c5a48dad86b4e8b71550d f436fddf7ab70ca5f1424081f5b75450270b200b3d997231323863e11addf76e1d65831a7ca09e3a5b7904ce828766c1f70b08326a175890298f28e5bc8646ef fix-linux_musl_base.patch 37416e1fa0bc0c8651cd060a645d6245ff7e2082279ab5e13495c5ee412c71915469019cfbec95a0fd9a7fc144475079a3ad16f0eba7a2f5c8dd99e0002f3225 llvm-with-ffi.patch 19cc2725d68db3e359e0e3016028374e5818a97fdba24d0103f7d1706601c8b17c4dd95a3152e64f982f98e95ad3e949acddbea8a39ed0ba8dd4f702acc2704d move-py-scripts-to-share.patch -8d6206f8c50856724cf7b4c1854ec82547f040358a1c7d44abeacc27a5c205a963b1fec51e58ec06c68d85bd2f68a9e6e27ebe457f39e8dd043de17758f5063f change-rpath-to-rustlib.patch" +8d6206f8c50856724cf7b4c1854ec82547f040358a1c7d44abeacc27a5c205a963b1fec51e58ec06c68d85bd2f68a9e6e27ebe457f39e8dd043de17758f5063f change-rpath-to-rustlib.patch +a330fa913faeadb98cb95e644f434ddef4fbbea32bcd11b6621fb9e08f7b0d8c71fae702207465489af3cf793eade0af694a8c515fc1bed49624da25103a4862 fix-jemalloc-musl.patch" diff --git a/testing/rust/fix-jemalloc-musl.patch b/testing/rust/fix-jemalloc-musl.patch new file mode 100644 index 0000000000..d832ad255b --- /dev/null +++ b/testing/rust/fix-jemalloc-musl.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 +@@ -129,7 +129,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 +@@ -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; + } |