Description
error: make failed
status: exit code: 2
command: "make"
stdout:
------------------------------------------
LD_LIBRARY_PATH="/home/draganm/work/rust/build/mips64el-unknown-linux-gnuabi64/test/run-make/relocation-model.stage2-mips64el-unknown-linux-gnuabi64:/home/draganm/work/rust/build/mips64el-unknown-linux-gnuabi64/stage2/lib:/home/draganm/work/rust/build/mips64el-unknown-linux-gnuabi64/stage0-tools/mips64el-unknown-linux-gnuabi64/release/deps:/home/draganm/work/rust/build/mips64el-unknown-linux-gnuabi64/stage0-sysroot/lib/rustlib/mips64el-unknown-linux-gnuabi64/lib:" '/home/draganm/work/rust/build/mips64el-unknown-linux-gnuabi64/stage2/bin/rustc' --out-dir /home/draganm/work/rust/build/mips64el-unknown-linux-gnuabi64/test/run-make/relocation-model.stage2-mips64el-unknown-linux-gnuabi64 -L /home/draganm/work/rust/build/mips64el-unknown-linux-gnuabi64/test/run-make/relocation-model.stage2-mips64el-unknown-linux-gnuabi64 -C relocation-model=static foo.rs
Makefile:17: recipe for target 'others' failed
------------------------------------------
stderr:
------------------------------------------
error: linking with `cc` failed: exit code: 1
|
= note: "cc" "-Wl,--as-needed" "-Wl,-z,noexecstack" "-L" "/home/draganm/work/rust/build/mips64el-unknown-linux-gnuabi64/stage2/lib/rustlib/mips64el-unknown-linux-gnuabi64/lib" "/home/draganm/work/rust/build/mips64el-unknown-linux-gnuabi64/test/run-make/relocation-model.stage2-mips64el-unknown-linux-gnuabi64/foo.foo0.rcgu.o" "/home/draganm/work/rust/build/mips64el-unknown-linux-gnuabi64/test/run-make/relocation-model.stage2-mips64el-unknown-linux-gnuabi64/foo.foo1.rcgu.o" "/home/draganm/work/rust/build/mips64el-unknown-linux-gnuabi64/test/run-make/relocation-model.stage2-mips64el-unknown-linux-gnuabi64/foo.foo2.rcgu.o" "-o" "/home/draganm/work/rust/build/mips64el-unknown-linux-gnuabi64/test/run-make/relocation-model.stage2-mips64el-unknown-linux-gnuabi64/foo" "/home/draganm/work/rust/build/mips64el-unknown-linux-gnuabi64/test/run-make/relocation-model.stage2-mips64el-unknown-linux-gnuabi64/foo.crate.allocator.rcgu.o" "-Wl,--gc-sections" "-no-pie" "-Wl,-z,relro,-z,now" "-nodefaultlibs" "-L" "/home/draganm/work/rust/build/mips64el-unknown-linux-gnuabi64/test/run-make/relocation-model.stage2-mips64el-unknown-linux-gnuabi64" "-L" "/home/draganm/work/rust/build/mips64el-unknown-linux-gnuabi64/stage2/lib/rustlib/mips64el-unknown-linux-gnuabi64/lib" "-Wl,-Bstatic" "/home/draganm/work/rust/build/mips64el-unknown-linux-gnuabi64/stage2/lib/rustlib/mips64el-unknown-linux-gnuabi64/lib/libstd-bf7adc3a3386a805.rlib" "/home/draganm/work/rust/build/mips64el-unknown-linux-gnuabi64/stage2/lib/rustlib/mips64el-unknown-linux-gnuabi64/lib/libpanic_unwind-d6c1d0be350f8447.rlib" "/home/draganm/work/rust/build/mips64el-unknown-linux-gnuabi64/stage2/lib/rustlib/mips64el-unknown-linux-gnuabi64/lib/libunwind-020f3ddad3c2aecc.rlib" "/home/draganm/work/rust/build/mips64el-unknown-linux-gnuabi64/stage2/lib/rustlib/mips64el-unknown-linux-gnuabi64/lib/liballoc_system-e7e2db07f1320e68.rlib" "/home/draganm/work/rust/build/mips64el-unknown-linux-gnuabi64/stage2/lib/rustlib/mips64el-unknown-linux-gnuabi64/lib/liblibc-ee093779b659c145.rlib" "/home/draganm/work/rust/build/mips64el-unknown-linux-gnuabi64/stage2/lib/rustlib/mips64el-unknown-linux-gnuabi64/lib/liballoc-9f2b8d7122a962b4.rlib" "/home/draganm/work/rust/build/mips64el-unknown-linux-gnuabi64/stage2/lib/rustlib/mips64el-unknown-linux-gnuabi64/lib/libstd_unicode-dbcf6d09120f0b05.rlib" "/home/draganm/work/rust/build/mips64el-unknown-linux-gnuabi64/stage2/lib/rustlib/mips64el-unknown-linux-gnuabi64/lib/libcore-a84829a54242b6cf.rlib" "/home/draganm/work/rust/build/mips64el-unknown-linux-gnuabi64/stage2/lib/rustlib/mips64el-unknown-linux-gnuabi64/lib/libcompiler_builtins-57fb30de8d4f53bc.rlib" "-Wl,-Bdynamic" "-l" "dl" "-l" "rt" "-l" "pthread" "-l" "gcc_s" "-l" "c" "-l" "m" "-l" "rt" "-l" "pthread" "-l" "util"
= note: /usr/bin/ld: BFD (GNU Binutils for Debian) 2.30 assertion fail ../../bfd/elfxx-mips.c:11237
collect2: error: ld returned 1 exit status
error: aborting due to previous error
make: *** [others] Error 101
After D23652 (LLVM 5.0.0) mips64 backend respects relocation-model=static option. Unfortunately this does not work well with libc dynamic linking. The GNU LD allows creation of .plt stubs in this case only if whole application (more important .rel.plt section) lies in in lower 32-bits of address space. The default linker script for mips64 n64 abi puts __executable-start at 0x120000000 which results in a assert (see log above). Historically GCC would usually generate pic-like code for mips64 n64 even when static linking and fno-pic is involved except when "-msym32" (use 32-bit symbols) option is provided. That option seems primarily targeted for bare-metal targets and stock LD does not provide suitable linker script for it, as far I know. So static relocation model can only be used for full static linking w/o messing with linker script.
I'm not sure if relocation-model=static is used commonly on non musl targets. If so then on mips64 targets it probably should be silently ignored, at least on linux-gnu targets.