1
Fork 0
rust/compiler/rustc_codegen_ssa/src
bors 1c80ac003b Auto merge of #96930 - ayrtonm:mips32-tmp-file, r=petrochenkov
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 is invalid for 32-bit MIPS targets. Even though symbols.o doesn't contain code, linking these targets with [lld fails](https://github.com/llvm/llvm-project/blob/main/lld/ELF/Arch/MipsArchTree.cpp#L76-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 [mipsel-sony-psx target](https://github.com/ayrtonm/psx-sdk-rs/issues/9), the builtin mipsel-sony-psp target (cc `@overdrivenpotato)` and probably 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 to avoid similar issues with the object file arch and PIC. 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-13 08:48:31 +00:00
..
back Fix e_flags for 32-bit MIPS targets in generated object file 2022-05-10 22:48:19 -04:00
coverageinfo Remove in_band_lifetimes from rustc_codegen_ssa 2021-12-15 00:41:41 -05:00
debuginfo Remove NodeIdHashingMode. 2022-04-12 19:59:32 +02:00
mir Add unsigned_offset_from on pointers 2022-05-11 17:16:25 -07:00
traits Merge new_metadata into codegen_allocator 2022-04-30 21:20:08 +02:00
base.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
common.rs use tcx.require_lang_item() instead 2022-04-28 20:18:01 +08:00
glue.rs Improve AdtDef interning. 2022-03-11 13:31:24 +11:00
lib.rs Auto merge of #91779 - ridwanabdillahi:natvis, r=michaelwoerister 2022-05-05 12:26:38 +00:00
meth.rs debuginfo: Refactor debuginfo generation for types -- Rename DebugInfoMethods::create_vtable_metadata() to DebugInfoMethods::create_vtable_debuginfo() 2022-03-14 17:25:24 +01:00
mono_item.rs Add codegen for global_asm! sym operands 2022-04-15 14:36:30 +01:00
target_features.rs Rollup merge of #91608 - workingjubilee:fold-neon-fp, r=nagisa,Amanieu 2022-03-23 03:05:28 +01:00