From 3a5332e31de779fdc719ea99e3ac536abff4dabc Mon Sep 17 00:00:00 2001 From: "Sijie.Sun" Date: Sat, 4 May 2024 00:26:57 +0800 Subject: [PATCH] use mimalloc for mips/mipsel (#71) --- .cargo/config | 6 ++++-- .github/workflows/rust.yml | 6 ++++++ .gitignore | 2 ++ easytier/Cargo.toml | 2 +- 4 files changed, 13 insertions(+), 3 deletions(-) diff --git a/.cargo/config b/.cargo/config index 6224081..74438e7 100644 --- a/.cargo/config +++ b/.cargo/config @@ -11,7 +11,8 @@ linker = "mipsel-linux-muslsf-gcc" rustflags = ["-C", "target-feature=+crt-static", "-L", "./musl_gcc/mipsel-linux-muslsf-cross/mipsel-linux-muslsf/lib", "-L", "./musl_gcc/mipsel-linux-muslsf-cross/lib/gcc/mipsel-linux-muslsf/11.2.1", - "-l", "atomic" + "-l", "atomic", + "-l", "ctz" ] [target.mips-unknown-linux-musl] @@ -19,5 +20,6 @@ linker = "mips-linux-muslsf-gcc" rustflags = ["-C", "target-feature=+crt-static", "-L", "./musl_gcc/mips-linux-muslsf-cross/mips-linux-muslsf/lib", "-L", "./musl_gcc/mips-linux-muslsf-cross/lib/gcc/mips-linux-muslsf/11.2.1", - "-l", "atomic" + "-l", "atomic", + "-l", "ctz" ] \ No newline at end of file diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index c7dd6c1..4e347c3 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -119,7 +119,13 @@ jobs: # mips/mipsel cannot add target from rustup, need compile by ourselves if [[ $OS =~ ^ubuntu.*$ && $TARGET =~ ^mips.*$ ]]; then cd "$PWD/musl_gcc/${MUSL_URI}-cross/lib/gcc/${MUSL_URI}/11.2.1" || exit 255 + # for panic-abort cp libgcc_eh.a libunwind.a + + # for mimalloc + ar x libgcc.a _ctzsi2.o _clz.o + ar rcs libctz.a _ctzsi2.o _clz.o + rustup toolchain install nightly-x86_64-unknown-linux-gnu rustup component add rust-src --toolchain nightly-x86_64-unknown-linux-gnu cd - diff --git a/.gitignore b/.gitignore index a0e18b9..fb2d30c 100644 --- a/.gitignore +++ b/.gitignore @@ -24,3 +24,5 @@ nohup.out .DS_Store components.d.ts + +musl_gcc diff --git a/easytier/Cargo.toml b/easytier/Cargo.toml index 73874ea..88fc478 100644 --- a/easytier/Cargo.toml +++ b/easytier/Cargo.toml @@ -168,7 +168,7 @@ defguard_wireguard_rs = "0.4.2" [features] default = ["wireguard", "quic", "mimalloc"] -mips = ["aes-gcm"] +mips = ["aes-gcm", "mimalloc"] wireguard = ["dep:boringtun", "dep:ring"] quic = ["dep:quinn", "dep:rustls", "dep:rcgen"] mimalloc = ["dep:mimalloc-rust"]