diff options
| author | bors <bors@rust-lang.org> | 2023-07-01 09:31:35 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2023-07-01 09:31:35 +0000 |
| commit | 7905eff5f7c26da8e1aa7880f5e01f395e2e3c05 (patch) | |
| tree | 75983c9b32563e2d33f1c9475fa53946094e7541 /compiler/rustc_codegen_ssa | |
| parent | e5bb341f0e1db4e4407f129d9834f9ada2030b7c (diff) | |
| parent | aa8e8642d955e2184e5c14513e083c970dbd5f25 (diff) | |
| download | rust-7905eff5f7c26da8e1aa7880f5e01f395e2e3c05.tar.gz rust-7905eff5f7c26da8e1aa7880f5e01f395e2e3c05.zip | |
Auto merge of #112550 - loongarch-rs:fix-eflags, r=cjgillot
loongarch: Fix ELF header flags This patch changes the ELF header flags so that the ABI matches the floating-point features. It also updates the link to the new official documentation.
Diffstat (limited to 'compiler/rustc_codegen_ssa')
| -rw-r--r-- | compiler/rustc_codegen_ssa/src/back/metadata.rs | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/compiler/rustc_codegen_ssa/src/back/metadata.rs b/compiler/rustc_codegen_ssa/src/back/metadata.rs index 1b1e9138871..00e6acb5c1a 100644 --- a/compiler/rustc_codegen_ssa/src/back/metadata.rs +++ b/compiler/rustc_codegen_ssa/src/back/metadata.rs @@ -284,8 +284,19 @@ pub(crate) fn create_object_file(sess: &Session) -> Option<write::Object<'static e_flags } Architecture::LoongArch64 => { - // Source: https://loongson.github.io/LoongArch-Documentation/LoongArch-ELF-ABI-EN.html#_e_flags_identifies_abi_type_and_version - elf::EF_LARCH_OBJABI_V1 | elf::EF_LARCH_ABI_DOUBLE_FLOAT + // Source: https://github.com/loongson/la-abi-specs/blob/release/laelf.adoc#e_flags-identifies-abi-type-and-version + let mut e_flags: u32 = elf::EF_LARCH_OBJABI_V1; + let features = &sess.target.options.features; + + // Select the appropriate floating-point ABI + if features.contains("+d") { + e_flags |= elf::EF_LARCH_ABI_DOUBLE_FLOAT; + } else if features.contains("+f") { + e_flags |= elf::EF_LARCH_ABI_SINGLE_FLOAT; + } else { + e_flags |= elf::EF_LARCH_ABI_SOFT_FLOAT; + } + e_flags } Architecture::Avr => { // Resolve the ISA revision and set |
