Repository: rust
Issue: run-make/relocation-model fails on mips{el}-unknown-linux-gnu
Labels: O-linux,O-MIPS,T-compiler,T-bootstrap,C-bug

```
error: make failed
status: exit code: 2
command: "make"
stdout:
------------------------------------------
LD_LIBRARY_PATH="/home/draganm/rust1/rust/build/mipsel-unknown-linux-gnu/test/run-make-fulldeps/relocation-model.stage2-mipsel-unknown-linux-gnu:/home/draganm/rust1/rust/build/mipsel-unknown-linux-gnu/stage2/lib:/home/draganm/rust1/rust/build/mipsel-unknown-linux-gnu/stage0-tools/mipsel-unknown-linux-gnu/release/deps:/home/draganm/rust1/rust/build/mipsel-unknown-linux-gnu/stage0-sysroot/lib/rustlib/mipsel-unknown-linux-gnu/lib:" '/home/draganm/rust1/rust/build/mipsel-unknown-linux-gnu/stage2/bin/rustc' --out-dir /home/draganm/rust1/rust/build/mipsel-unknown-linux-gnu/test/run-make-fulldeps/relocation-model.stage2-mipsel-unknown-linux-gnu -L /home/draganm/rust1/rust/build/mipsel-unknown-linux-gnu/test/run-make-fulldeps/relocation-model.stage2-mipsel-unknown-linux-gnu  -Clinker=gcc -C relocation-model=static foo.rs
LD_LIBRARY_PATH="/home/draganm/rust1/rust/build/mipsel-unknown-linux-gnu/test/run-make-fulldeps/relocation-model.stage2-mipsel-unknown-linux-gnu:/home/draganm/rust1/rust/build/mipsel-unknown-linux-gnu/stage2/lib/rustlib/mipsel-unknown-linux-gnu/lib:/home/draganm/rust1/rust/build/mipsel-unknown-linux-gnu/stage0-tools/mipsel-unknown-linux-gnu/release/deps:/home/draganm/rust1/rust/build/mipsel-unknown-linux-gnu/stage0-sysroot/lib/rustlib/mipsel-unknown-linux-gnu/lib:" /home/draganm/rust1/rust/build/mipsel-unknown-linux-gnu/test/run-make-fulldeps/relocation-model.stage2-mipsel-unknown-linux-gnu/foo
LD_LIBRARY_PATH="/home/draganm/rust1/rust/build/mipsel-unknown-linux-gnu/test/run-make-fulldeps/relocation-model.stage2-mipsel-unknown-linux-gnu:/home/draganm/rust1/rust/build/mipsel-unknown-linux-gnu/stage2/lib:/home/draganm/rust1/rust/build/mipsel-unknown-linux-gnu/stage0-tools/mipsel-unknown-linux-gnu/release/deps:/home/draganm/rust1/rust/build/mipsel-unknown-linux-gnu/stage0-sysroot/lib/rustlib/mipsel-unknown-linux-gnu/lib:" '/home/draganm/rust1/rust/build/mipsel-unknown-linux-gnu/stage2/bin/rustc' --out-dir /home/draganm/rust1/rust/build/mipsel-unknown-linux-gnu/test/run-make-fulldeps/relocation-model.stage2-mipsel-unknown-linux-gnu -L /home/draganm/rust1/rust/build/mipsel-unknown-linux-gnu/test/run-make-fulldeps/relocation-model.stage2-mipsel-unknown-linux-gnu  -Clinker=gcc -C relocation-model=dynamic-no-pic foo.rs
LD_LIBRARY_PATH="/home/draganm/rust1/rust/build/mipsel-unknown-linux-gnu/test/run-make-fulldeps/relocation-model.stage2-mipsel-unknown-linux-gnu:/home/draganm/rust1/rust/build/mipsel-unknown-linux-gnu/stage2/lib/rustlib/mipsel-unknown-linux-gnu/lib:/home/draganm/rust1/rust/build/mipsel-unknown-linux-gnu/stage0-tools/mipsel-unknown-linux-gnu/release/deps:/home/draganm/rust1/rust/build/mipsel-unknown-linux-gnu/stage0-sysroot/lib/rustlib/mipsel-unknown-linux-gnu/lib:" /home/draganm/rust1/rust/build/mipsel-unknown-linux-gnu/test/run-make-fulldeps/relocation-model.stage2-mipsel-unknown-linux-gnu/foo
LD_LIBRARY_PATH="/home/draganm/rust1/rust/build/mipsel-unknown-linux-gnu/test/run-make-fulldeps/relocation-model.stage2-mipsel-unknown-linux-gnu:/home/draganm/rust1/rust/build/mipsel-unknown-linux-gnu/stage2/lib:/home/draganm/rust1/rust/build/mipsel-unknown-linux-gnu/stage0-tools/mipsel-unknown-linux-gnu/release/deps:/home/draganm/rust1/rust/build/mipsel-unknown-linux-gnu/stage0-sysroot/lib/rustlib/mipsel-unknown-linux-gnu/lib:" '/home/draganm/rust1/rust/build/mipsel-unknown-linux-gnu/stage2/bin/rustc' --out-dir /home/draganm/rust1/rust/build/mipsel-unknown-linux-gnu/test/run-make-fulldeps/relocation-model.stage2-mipsel-unknown-linux-gnu -L /home/draganm/rust1/rust/build/mipsel-unknown-linux-gnu/test/run-make-fulldeps/relocation-model.stage2-mipsel-unknown-linux-gnu  -Clinker=gcc -C relocation-model=default foo.rs
LD_LIBRARY_PATH="/home/draganm/rust1/rust/build/mipsel-unknown-linux-gnu/test/run-make-fulldeps/relocation-model.stage2-mipsel-unknown-linux-gnu:/home/draganm/rust1/rust/build/mipsel-unknown-linux-gnu/stage2/lib/rustlib/mipsel-unknown-linux-gnu/lib:/home/draganm/rust1/rust/build/mipsel-unknown-linux-gnu/stage0-tools/mipsel-unknown-linux-gnu/release/deps:/home/draganm/rust1/rust/build/mipsel-unknown-linux-gnu/stage0-sysroot/lib/rustlib/mipsel-unknown-linux-gnu/lib:" /home/draganm/rust1/rust/build/mipsel-unknown-linux-gnu/test/run-make-fulldeps/relocation-model.stage2-mipsel-unknown-linux-gnu/foo
LD_LIBRARY_PATH="/home/draganm/rust1/rust/build/mipsel-unknown-linux-gnu/test/run-make-fulldeps/relocation-model.stage2-mipsel-unknown-linux-gnu:/home/draganm/rust1/rust/build/mipsel-unknown-linux-gnu/stage2/lib:/home/draganm/rust1/rust/build/mipsel-unknown-linux-gnu/stage0-tools/mipsel-unknown-linux-gnu/release/deps:/home/draganm/rust1/rust/build/mipsel-unknown-linux-gnu/stage0-sysroot/lib/rustlib/mipsel-unknown-linux-gnu/lib:" '/home/draganm/rust1/rust/build/mipsel-unknown-linux-gnu/stage2/bin/rustc' --out-dir /home/draganm/rust1/rust/build/mipsel-unknown-linux-gnu/test/run-make-fulldeps/relocation-model.stage2-mipsel-unknown-linux-gnu -L /home/draganm/rust1/rust/build/mipsel-unknown-linux-gnu/test/run-make-fulldeps/relocation-model.stage2-mipsel-unknown-linux-gnu  -Clinker=gcc -C relocation-model=dynamic-no-pic --crate-type=dylib foo.rs --emit=link,obj
Makefile:4: recipe for target 'all' failed

------------------------------------------
stderr:
------------------------------------------
error: linking with `gcc` failed: exit code: 1
  |
  = note: "gcc" "-Wl,--as-needed" "-Wl,-z,noexecstack" "-L" "/home/draganm/rust1/rust/build/mipsel-unknown-linux-gnu/stage2/lib/rustlib/mipsel-unknown-linux-gnu/lib" "/home/draganm/rust1/rust/build/mipsel-unknown-linux-gnu/test/run-make-fulldeps/relocation-model.stage2-mipsel-unknown-linux-gnu/foo.foo0.rcgu.o" "-o" "/home/draganm/rust1/rust/build/mipsel-unknown-linux-gnu/test/run-make-fulldeps/relocation-model.stage2-mipsel-unknown-linux-gnu/libfoo.so" "/home/draganm/rust1/rust/build/mipsel-unknown-linux-gnu/test/run-make-fulldeps/relocation-model.stage2-mipsel-unknown-linux-gnu/foo.crate.metadata.rcgu.o" "/home/draganm/rust1/rust/build/mipsel-unknown-linux-gnu/test/run-make-fulldeps/relocation-model.stage2-mipsel-unknown-linux-gnu/foo.crate.allocator.rcgu.o" "-Wl,-z,relro,-z,now" "-nodefaultlibs" "-L" "/home/draganm/rust1/rust/build/mipsel-unknown-linux-gnu/test/run-make-fulldeps/relocation-model.stage2-mipsel-unknown-linux-gnu" "-L" "/home/draganm/rust1/rust/build/mipsel-unknown-linux-gnu/stage2/lib/rustlib/mipsel-unknown-linux-gnu/lib" "-Wl,--start-group" "-Wl,-Bstatic" "-Wl,--whole-archive" "/home/draganm/rust1/rust/build/mipsel-unknown-linux-gnu/test/run-make-fulldeps/relocation-model.stage2-mipsel-unknown-linux-gnu/rustc.7Ndt3AnBrnar/libstd-40c425b776fadd4b.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/home/draganm/rust1/rust/build/mipsel-unknown-linux-gnu/test/run-make-fulldeps/relocation-model.stage2-mipsel-unknown-linux-gnu/rustc.7Ndt3AnBrnar/libpanic_unwind-8dcd6188e6a17652.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/home/draganm/rust1/rust/build/mipsel-unknown-linux-gnu/test/run-make-fulldeps/relocation-model.stage2-mipsel-unknown-linux-gnu/rustc.7Ndt3AnBrnar/libunwind-9cbe08a673e59763.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/home/draganm/rust1/rust/build/mipsel-unknown-linux-gnu/test/run-make-fulldeps/relocation-model.stage2-mipsel-unknown-linux-gnu/rustc.7Ndt3AnBrnar/liballoc_system-09b8c28e82ce8959.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/home/draganm/rust1/rust/build/mipsel-unknown-linux-gnu/test/run-make-fulldeps/relocation-model.stage2-mipsel-unknown-linux-gnu/rustc.7Ndt3AnBrnar/liblibc-6564eda3124d9d78.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/home/draganm/rust1/rust/build/mipsel-unknown-linux-gnu/test/run-make-fulldeps/relocation-model.stage2-mipsel-unknown-linux-gnu/rustc.7Ndt3AnBrnar/liballoc-12610f5c8bd6d62d.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/home/draganm/rust1/rust/build/mipsel-unknown-linux-gnu/test/run-make-fulldeps/relocation-model.stage2-mipsel-unknown-linux-gnu/rustc.7Ndt3AnBrnar/libstd_unicode-0ecffe7df08180c9.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/home/draganm/rust1/rust/build/mipsel-unknown-linux-gnu/test/run-make-fulldeps/relocation-model.stage2-mipsel-unknown-linux-gnu/rustc.7Ndt3AnBrnar/libcore-ecdb2c8a330fb142.rlib" "-Wl,--no-whole-archive" "-Wl,--end-group" "/home/draganm/rust1/rust/build/mipsel-unknown-linux-gnu/test/run-make-fulldeps/relocation-model.stage2-mipsel-unknown-linux-gnu/rustc.7Ndt3AnBrnar/libcompiler_builtins-b6c0cc1595c95da2.rlib" "-Wl,-Bdynamic" "-l" "dl" "-l" "rt" "-l" "pthread" "-l" "gcc_s" "-l" "c" "-l" "m" "-l" "rt" "-l" "pthread" "-l" "util" "-shared"
  = note: /usr/bin/ld: /home/draganm/rust1/rust/build/mipsel-unknown-linux-gnu/test/run-make-fulldeps/relocation-model.stage2-mipsel-unknown-linux-gnu/foo.crate.allocator.rcgu.o: relocation R_MIPS_26 against `__rdl_alloc' can not be used when making a shared object; recompile with -fPIC
          collect2: error: ld returned 1 exit status
```
The issue is that you cannot use non-pic (dynamic-no-pic) code to produce .so on MIPS. You might get away on other platforms that use same call sequence/relocations for pic/no-pic local calls. Is Windows platform original reason for using dynamic-no-pic for shlib target? Is it ok to change this test to not set relocation-model for shlib case or use pic for Linux ?