fix(common): Fix jemalloc (#4794)

This commit is contained in:
LongYinan 2022-05-25 22:51:36 +08:00 committed by GitHub
parent f4a60e2eda
commit adf70f6c07
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 2 deletions

View File

@ -85,6 +85,7 @@ jobs:
rustup target add aarch64-unknown-linux-gnu &&
RUSTFLAGS='-Z new-llvm-pass-manager=no' cargo build -p swc_cli --release --features plugin --target aarch64-unknown-linux-gnu &&
cp ./target/aarch64-unknown-linux-gnu/release/swc . && chmod +x ./swc &&
export CC_aarch64_unknown_linux_gnu=/usr/aarch64-unknown-linux-gnu/bin/aarch64-unknown-linux-gnu-gcc &&
yarn build --target aarch64-unknown-linux-gnu &&
llvm-strip -x swc.linux-arm64-gnu.node
- host: ubuntu-18.04

View File

@ -16,5 +16,5 @@ bench = false
[target.'cfg(not(target_os = "linux"))'.dependencies]
mimalloc-rust = { version = "0.1" }
[target.'cfg(target_os = "linux")'.dependencies]
[target.'cfg(all(target_os = "linux", target_env = "gnu", any(target_arch = "x86_64", target_arch = "aarch64")))'.dependencies]
tikv-jemallocator = { version = "0.4", features = ["disable_initial_exec_tls"] }

View File

@ -6,6 +6,10 @@
#[global_allocator]
static GLOBAL: mimalloc_rust::GlobalMiMalloc = mimalloc_rust::GlobalMiMalloc;
#[cfg(target_os = "linux")]
#[cfg(all(
target_os = "linux",
target_env = "gnu",
any(target_arch = "x86_64", target_arch = "aarch64")
))]
#[global_allocator]
static GLOBAL: tikv_jemallocator::Jemalloc = tikv_jemallocator::Jemalloc;