chore: update runner shim and linker flags for mips atomics
Some checks failed
Build MIPS Binary / build (push) Failing after 3m52s
Some checks failed
Build MIPS Binary / build (push) Failing after 3m52s
This commit is contained in:
@@ -34,7 +34,9 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
# Ensure we are building a fully static binary
|
# Ensure we are building a fully static binary
|
||||||
# -C link-self-contained=no: Let Zig (the linker) handle CRT objects (crt1.o, etc.)
|
# -C link-self-contained=no: Let Zig (the linker) handle CRT objects (crt1.o, etc.)
|
||||||
RUSTFLAGS: "-C target-feature=+crt-static -C link-self-contained=no"
|
# --defsym=__atomic_is_lock_free=... Maps the missing symbol to our shim
|
||||||
|
RUSTFLAGS: "-C target-feature=+crt-static -C link-self-contained=no -C link-arg=-msoft-float -C link-arg=-Wl,--defsym=__atomic_is_lock_free=__atomic_is_lock_free_shim"
|
||||||
|
CFLAGS_mips_unknown_linux_musl: "-msoft-float"
|
||||||
run: |
|
run: |
|
||||||
cd backend
|
cd backend
|
||||||
cargo zigbuild --target mips-unknown-linux-musl --release -Z build-std=std,panic_abort
|
cargo zigbuild --target mips-unknown-linux-musl --release -Z build-std=std,panic_abort
|
||||||
|
|||||||
@@ -46,7 +46,22 @@ RUN ARCH=$(dpkg --print-architecture) && \
|
|||||||
mv "zig-linux-$ZIG_ARCH-$ZIG_VER" /root/zig && \
|
mv "zig-linux-$ZIG_ARCH-$ZIG_VER" /root/zig && \
|
||||||
rm zig.tar.xz
|
rm zig.tar.xz
|
||||||
|
|
||||||
# 5. Install Tools (Trunk, cargo-zigbuild, wasm-bindgen protocol aligned)
|
# 5. Fix: Create libatomic.a shim for MIPS
|
||||||
|
# MIPS musl static build often misses __atomic_is_lock_free.
|
||||||
|
# We create a minimal implementation to satisfy the linker.
|
||||||
|
# We rename the function to avoid builtin conflict and alias it via linker flags later.
|
||||||
|
RUN . "$HOME/.cargo/env" && \
|
||||||
|
echo '#include <stdbool.h>' > atomic.c && \
|
||||||
|
echo 'bool __atomic_is_lock_free_shim(unsigned int size, const volatile void *ptr) { return size <= 4; }' >> atomic.c && \
|
||||||
|
/root/zig/zig cc -target mips-linux-musl -msoft-float -c -o atomic.o atomic.c && \
|
||||||
|
/root/zig/zig ar rcs libatomic.a atomic.o && \
|
||||||
|
RUST_SYSROOT=$(rustc --print sysroot) && \
|
||||||
|
TARGET_LIB_DIR="$RUST_SYSROOT/lib/rustlib/mips-unknown-linux-musl/lib" && \
|
||||||
|
mkdir -p "$TARGET_LIB_DIR" && \
|
||||||
|
cp libatomic.a "$TARGET_LIB_DIR/" && \
|
||||||
|
rm atomic.c atomic.o libatomic.a
|
||||||
|
|
||||||
|
# 6. Install Tools (Trunk, cargo-zigbuild, wasm-bindgen protocol aligned)
|
||||||
# We install trunk binary to save time, others via cargo
|
# We install trunk binary to save time, others via cargo
|
||||||
RUN . "$HOME/.cargo/env" && \
|
RUN . "$HOME/.cargo/env" && \
|
||||||
# Install cargo-zigbuild
|
# Install cargo-zigbuild
|
||||||
|
|||||||
Reference in New Issue
Block a user