zig-bootstrap
zig-bootstrap copied to clipboard
mipsel-linux-musl
/home/andy/dev/bootstrap-zig/out/host/bin/zig c++ -target mipsel-linux-musl -DHAVE_CXX_ATOMICS64_WITHOUT_LIB -std=c++11 -Werror=unguarded-availability-new -static CMakeFiles/cmTC_52428.dir/src.cxx.o -o cmTC_52428 -lm
#include <atomic>
#include <cstdint>
std::atomic<uint64_t> x (0);
int main() {
uint64_t i = x.load(std::memory_order_relaxed);
return 0;
}
lld: error: undefined symbol: __atomic_load_8
>>> referenced by src.cxx
>>> CMakeFiles/cmTC_52428.dir/src.cxx.o:(unsigned long long std::__1::__cxx_atomic_load<unsigned long long>(std::__1::__cxx_atomic_base_impl<unsigned long long> const*, std::__1::memory_order))
>>> referenced by src.cxx
>>> CMakeFiles/cmTC_52428.dir/src.cxx.o:(unsigned long long std::__1::__cxx_atomic_load<unsigned long long>(std::__1::__cxx_atomic_base_impl<unsigned long long> const*, std::__1::memory_order))
Looks like a missing compiler-rt function.
Upstream issue: https://github.com/ziglang/zig/issues/4887
With https://github.com/ziglang/zig/pull/4924 applied, the next issue is:
lld: error: can't create dynamic relocation R_MIPS_32 against symbol: DW.ref.__gxx_personality_v0 in readonly segment; recompile object files with -fPIC or pass '-Wl,-z,notext' to allow text relocations in the output
>>> defined in /home/andy/.cache/zig/stage1/o/T5tckQUc2lhBpJlpVGSxm8lBZ7i8OXPFEBCqlYa8FxB6Me_v4XEhobskf4rQdx8x/libc++.a(/home/andy/.cache/zig/stage1/o/qUmHtY3lH7PA5isys1yCe37lU_DsOWv1RszG5ES7L8qrmRfFKqz_W_nE_pVbhPrT/new.o)
>>> referenced by new.cpp
>>> /home/andy/.cache/zig/stage1/o/qUmHtY3lH7PA5isys1yCe37lU_DsOWv1RszG5ES7L8qrmRfFKqz_W_nE_pVbhPrT/new.o:(.eh_frame+0x357F) in archive /home/andy/.cache/zig/stage1/o/T5tckQUc2lhBpJlpVGSxm8lBZ7i8OXPFEBCqlYa8FxB6Me_v4XEhobskf4rQdx8x/libc++.a
Upstream issue: https://github.com/ziglang/zig/issues/4925
I'm able to compile/run the C++ example and the zig init-exe bin on my OpenWRT router using a toolchain built by zig-bootstrap. I've yet to run the toolchain on the device, but I'll get on that soon.
Looks like the toolchain binaries will not run, as they all fail with illegal instruction. This is with a baseline cpu.