Repository: rust
Issue: File format not recognized when linking rmeta file for sparc-linux-unknown-gnu
Labels: A-linkage,A-codegen,T-compiler,O-SPARC

I am currently trying to build `rustc` for the `sparc-linux-unknown-gnu` target which fails with the linker complaining about not recognizing the file format of the `rmeta` file on the command line:

```
error: linking with `sparc-linux-gnu-gcc` failed: exit status: 1
  |
  = note: LC_ALL="C" PATH="/home/glaubitz/rust/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/bin:/home/glaubitz/rust/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/bin:/home/glaubitz/rust/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/bin:/home/glaubitz/.local/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games" VSLANG="1033" "sparc-linux-gnu-gcc" "-Wl,--version-script=/tmp/rustc9YiYtF/list" "-Wl,--no-undefined-version" "-mcpu=v9" "-m32" "-Wl,-melf32_sparc" "/home/glaubitz/rust/build/x86_64-unknown-linux-gnu/stage1-std/sparc-unknown-linux-gnu/release/deps/std-41da709e9f6744d7.std.a946a352528c9d3a-cgu.00.rcgu.o" "/home/glaubitz/rust/build/x86_64-unknown-linux-gnu/stage1-std/sparc-unknown-linux-gnu/release/deps/std-41da709e9f6744d7.std.a946a352528c9d3a-cgu.01.rcgu.o" "/home/glaubitz/rust/build/x86_64-unknown-linux-gnu/stage1-std/sparc-unknown-linux-gnu/release/deps/std-41da709e9f6744d7.std.a946a352528c9d3a-cgu.02.rcgu.o" "/home/glaubitz/rust/build/x86_64-unknown-linux-gnu/stage1-std/sparc-unknown-linux-gnu/release/deps/std-41da709e9f6744d7.std.a946a352528c9d3a-cgu.03.rcgu.o" "/home/glaubitz/rust/build/x86_64-unknown-linux-gnu/stage1-std/sparc-unknown-linux-gnu/release/deps/std-41da709e9f6744d7.std.a946a352528c9d3a-cgu.04.rcgu.o" "/home/glaubitz/rust/build/x86_64-unknown-linux-gnu/stage1-std/sparc-unknown-linux-gnu/release/deps/std-41da709e9f6744d7.std.a946a352528c9d3a-cgu.05.rcgu.o" "/home/glaubitz/rust/build/x86_64-unknown-linux-gnu/stage1-std/sparc-unknown-linux-gnu/release/deps/std-41da709e9f6744d7.std.a946a352528c9d3a-cgu.06.rcgu.o" "/home/glaubitz/rust/build/x86_64-unknown-linux-gnu/stage1-std/sparc-unknown-linux-gnu/release/deps/std-41da709e9f6744d7.std.a946a352528c9d3a-cgu.07.rcgu.o" "/home/glaubitz/rust/build/x86_64-unknown-linux-gnu/stage1-std/sparc-unknown-linux-gnu/release/deps/std-41da709e9f6744d7.std.a946a352528c9d3a-cgu.08.rcgu.o" "/home/glaubitz/rust/build/x86_64-unknown-linux-gnu/stage1-std/sparc-unknown-linux-gnu/release/deps/std-41da709e9f6744d7.std.a946a352528c9d3a-cgu.09.rcgu.o" "/home/glaubitz/rust/build/x86_64-unknown-linux-gnu/stage1-std/sparc-unknown-linux-gnu/release/deps/std-41da709e9f6744d7.std.a946a352528c9d3a-cgu.10.rcgu.o" "/home/glaubitz/rust/build/x86_64-unknown-linux-gnu/stage1-std/sparc-unknown-linux-gnu/release/deps/std-41da709e9f6744d7.std.a946a352528c9d3a-cgu.11.rcgu.o" "/home/glaubitz/rust/build/x86_64-unknown-linux-gnu/stage1-std/sparc-unknown-linux-gnu/release/deps/std-41da709e9f6744d7.std.a946a352528c9d3a-cgu.12.rcgu.o" "/home/glaubitz/rust/build/x86_64-unknown-linux-gnu/stage1-std/sparc-unknown-linux-gnu/release/deps/std-41da709e9f6744d7.std.a946a352528c9d3a-cgu.13.rcgu.o" "/home/glaubitz/rust/build/x86_64-unknown-linux-gnu/stage1-std/sparc-unknown-linux-gnu/release/deps/std-41da709e9f6744d7.std.a946a352528c9d3a-cgu.14.rcgu.o" "/home/glaubitz/rust/build/x86_64-unknown-linux-gnu/stage1-std/sparc-unknown-linux-gnu/release/deps/std-41da709e9f6744d7.std.a946a352528c9d3a-cgu.15.rcgu.o" "/home/glaubitz/rust/build/x86_64-unknown-linux-gnu/stage1-std/sparc-unknown-linux-gnu/release/deps/std-41da709e9f6744d7.dn0tar95l4w690nusxeqr43d3.rcgu.rmeta" "/home/glaubitz/rust/build/x86_64-unknown-linux-gnu/stage1-std/sparc-unknown-linux-gnu/release/deps/std-41da709e9f6744d7.040sn9hd3kpadxvyhdk75ycx5.rcgu.o" "-Wl,--as-needed" "-L" "/home/glaubitz/rust/build/x86_64-unknown-linux-gnu/stage1-std/sparc-unknown-linux-gnu/release/deps" "-L" "/home/glaubitz/rust/build/x86_64-unknown-linux-gnu/stage1-std/release/deps" "-L" "/home/glaubitz/rust/build/x86_64-unknown-linux-gnu/stage1-std/sparc-unknown-linux-gnu/release/build/compiler_builtins-9cbe5026186c715b/out" "-L" "/home/glaubitz/rust/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/sparc-unknown-linux-gnu/lib" "-Wl,-Bstatic" "/home/glaubitz/rust/build/x86_64-unknown-linux-gnu/stage1-std/sparc-unknown-linux-gnu/release/deps/libpanic_unwind-d6f3e19e347e8e30.rlib" "/home/glaubitz/rust/build/x86_64-unknown-linux-gnu/stage1-std/sparc-unknown-linux-gnu/release/deps/libobject-96ad8f1969790b3e.rlib" "/home/glaubitz/rust/build/x86_64-unknown-linux-gnu/stage1-std/sparc-unknown-linux-gnu/release/deps/libmemchr-7d65095888af1252.rlib" "/home/glaubitz/rust/build/x86_64-unknown-linux-gnu/stage1-std/sparc-unknown-linux-gnu/release/deps/libaddr2line-bc5934419298e94f.rlib" "/home/glaubitz/rust/build/x86_64-unknown-linux-gnu/stage1-std/sparc-unknown-linux-gnu/release/deps/libgimli-a550d13df8702836.rlib" "/home/glaubitz/rust/build/x86_64-unknown-linux-gnu/stage1-std/sparc-unknown-linux-gnu/release/deps/librustc_demangle-3a3f56a767e453f8.rlib" "/home/glaubitz/rust/build/x86_64-unknown-linux-gnu/stage1-std/sparc-unknown-linux-gnu/release/deps/libstd_detect-34ae8bef4a03fd18.rlib" "/home/glaubitz/rust/build/x86_64-unknown-linux-gnu/stage1-std/sparc-unknown-linux-gnu/release/deps/libhashbrown-46ce46b7ff78718c.rlib" "/home/glaubitz/rust/build/x86_64-unknown-linux-gnu/stage1-std/sparc-unknown-linux-gnu/release/deps/librustc_std_workspace_alloc-738616e97bd712d8.rlib" "/home/glaubitz/rust/build/x86_64-unknown-linux-gnu/stage1-std/sparc-unknown-linux-gnu/release/deps/libminiz_oxide-1f2e9ed080496ac7.rlib" "/home/glaubitz/rust/build/x86_64-unknown-linux-gnu/stage1-std/sparc-unknown-linux-gnu/release/deps/libadler-c646151839979ca7.rlib" "/home/glaubitz/rust/build/x86_64-unknown-linux-gnu/stage1-std/sparc-unknown-linux-gnu/release/deps/libunwind-77b4a24e6c936276.rlib" "/home/glaubitz/rust/build/x86_64-unknown-linux-gnu/stage1-std/sparc-unknown-linux-gnu/release/deps/libcfg_if-ca580308d22018b6.rlib" "/home/glaubitz/rust/build/x86_64-unknown-linux-gnu/stage1-std/sparc-unknown-linux-gnu/release/deps/liblibc-721c91ee08a9ebc2.rlib" "/home/glaubitz/rust/build/x86_64-unknown-linux-gnu/stage1-std/sparc-unknown-linux-gnu/release/deps/liballoc-5364848951c68550.rlib" "/home/glaubitz/rust/build/x86_64-unknown-linux-gnu/stage1-std/sparc-unknown-linux-gnu/release/deps/librustc_std_workspace_core-2d05bd64c8bcabbb.rlib" "/home/glaubitz/rust/build/x86_64-unknown-linux-gnu/stage1-std/sparc-unknown-linux-gnu/release/deps/libcore-e51655d4cadb2e75.rlib" "/home/glaubitz/rust/build/x86_64-unknown-linux-gnu/stage1-std/sparc-unknown-linux-gnu/release/deps/libcompiler_builtins-494aac20c9cb2b3e.rlib" "-Wl,-Bdynamic" "-lgcc_s" "-lutil" "-lrt" "-lpthread" "-lm" "-ldl" "-lc" "-Wl,--eh-frame-hdr" "-Wl,-z,noexecstack" "-L" "/home/glaubitz/rust/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/sparc-unknown-linux-gnu/lib" "-o" "/home/glaubitz/rust/build/x86_64-unknown-linux-gnu/stage1-std/sparc-unknown-linux-gnu/release/deps/libstd-41da709e9f6744d7.so" "-shared" "-Wl,-z,relro,-z,now" "-Wl,-O1" "-nodefaultlibs" "-Wl,-z,origin" "-Wl,-rpath,$ORIGIN/../lib"
  = note: /home/glaubitz/rust/build/x86_64-unknown-linux-gnu/stage1-std/sparc-unknown-linux-gnu/release/deps/std-41da709e9f6744d7.dn0tar95l4w690nusxeqr43d3.rcgu.rmeta: file not recognized: file format not recognized
          collect2: error: ld returned 1 exit status
```

I have already tried tuning the compiler and linker options in `compiler/rustc_target/src/spec/targets/sparc_unknown_linux_gnu.rs`, but I am still getting the same error. Since I have no clue what the `rmeta` file is supposed to contain, I don't know what might be wrong and needs to be fixed.

Thus, opening an issue in the hope that someone can explain what's in the `rmeta` file and what could be the reason for that file containing unexpected information, so I can come up with a possible fix.