Commit 2a232275 authored by Jakub Jirutka's avatar Jakub Jirutka

testing/rust: build with vendored jemalloc

parent 2e440a20
......@@ -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"
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;
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment