rust/compiler/rustc_codegen_ssa/src/back
Ayrton 3d5b1eeb75 Fix e_flags for 32-bit MIPS targets in generated object file
In #95604 the compiler started generating a temporary symbols.o which is added
to the linker invocation. This object file has an `e_flags` which may be invalid
for 32-bit MIPS targets. Even though symbols.o doesn't contain code, linking
    with [lld fails](https://github.com/llvm/llvm-project/blob/main/lld/ELF/Arch/MipsArchTree.cpp#L79) with
```
rust-lld: error: foo-cgu.0.rcgu.o: ABI 'o32' is incompatible with target ABI 'n64'
```
because it omits the ABI bits (EF_MIPS_ABI_O32) so lld assumes it's using the
N64 ABI. This breaks linking on nightly for the out-of-tree [psx
target](https://github.com/ayrtonm/psx-sdk-rs/issues/9), the builtin
mipsel-sony-psp target (cc @overdrivenpotato) and any other 32-bit MIPS
target using lld.

This PR sets the ABI in `e_flags` to O32 since that's the only ABI for 32-bit
MIPS that LLVM supports. It also sets other `e_flags` bits based on the target.
I had to bump the object crate version since some of these constants were [added
recently](https://github.com/gimli-rs/object/pull/433). I'm not sure if this
PR needs a test, but I can confirm that it fixes the linking issue on both
targets I mentioned.
2022-05-10 22:48:19 -04:00
..
rpath Remove LibSource 2021-07-05 10:49:07 +02:00
archive.rs Unconditionally update symbols 2022-02-10 18:27:18 +01:00
command.rs Remove unnecessary sigils around Symbol::as_str() calls. 2021-12-15 17:32:14 +11:00
link.rs Add support for a new attribute #[debugger_visualizer] to support embedding debugger visualizers into a generated PDB. 2022-05-03 10:53:54 -07:00
linker.rs Add support for a new attribute #[debugger_visualizer] to support embedding debugger visualizers into a generated PDB. 2022-05-03 10:53:54 -07:00
lto.rs Merge new_metadata into codegen_allocator 2022-04-30 21:20:08 +02:00
metadata.rs Fix e_flags for 32-bit MIPS targets in generated object file 2022-05-10 22:48:19 -04:00
mod.rs Use the object crate for metadata reading 2021-05-07 18:48:58 +02:00
rpath.rs pass -Wl,-z,origin to set DF_ORIGIN when using rpath 2021-12-17 11:27:14 +00:00
symbol_export.rs Use decorated names for linked_symbols on Windows 2022-04-27 13:17:13 +01:00
write.rs Let LtoModuleCodegen::optimize take self by value 2022-04-30 20:51:17 +02:00