about summary refs log tree commit diff
path: root/compiler/rustc_codegen_ssa
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-06-30 08:55:56 +0000
committerbors <bors@rust-lang.org>2023-06-30 08:55:56 +0000
commitaf9df2fd91434e5d6fab43a71cf90cc459ea2ad8 (patch)
treeedef10c172240b91f4c0b1db0f654b302e5b9b55 /compiler/rustc_codegen_ssa
parentb4591cb04c8dbcd780620c1e86c8ddd0c651622a (diff)
parenta7158ecfa9ab37774b2900972cc1a0279f46caa6 (diff)
downloadrust-af9df2fd91434e5d6fab43a71cf90cc459ea2ad8.tar.gz
rust-af9df2fd91434e5d6fab43a71cf90cc459ea2ad8.zip
Auto merge of #106619 - agausmann:avr-object-file, r=nagisa
Fix unset e_flags in ELF files generated for AVR targets

Closes #106576

~~Sort-of blocked by gimli-rs/object#500~~ (merged)

I'm not sure whether the list of AVR CPU names is okay here. Maybe it could be moved out-of-line to improve the readability of the function.
Diffstat (limited to 'compiler/rustc_codegen_ssa')
-rw-r--r--compiler/rustc_codegen_ssa/src/back/metadata.rs7
1 files changed, 6 insertions, 1 deletions
diff --git a/compiler/rustc_codegen_ssa/src/back/metadata.rs b/compiler/rustc_codegen_ssa/src/back/metadata.rs
index b198e35e0c1..1b1e9138871 100644
--- a/compiler/rustc_codegen_ssa/src/back/metadata.rs
+++ b/compiler/rustc_codegen_ssa/src/back/metadata.rs
@@ -20,7 +20,7 @@ use rustc_metadata::EncodedMetadata;
 use rustc_session::cstore::MetadataLoader;
 use rustc_session::Session;
 use rustc_target::abi::Endian;
-use rustc_target::spec::{RelocModel, Target};
+use rustc_target::spec::{ef_avr_arch, RelocModel, Target};
 
 /// The default metadata loader. This is used by cg_llvm and cg_clif.
 ///
@@ -287,6 +287,11 @@ pub(crate) fn create_object_file(sess: &Session) -> Option<write::Object<'static
             // 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
         }
+        Architecture::Avr => {
+            // Resolve the ISA revision and set
+            // the appropriate EF_AVR_ARCH flag.
+            ef_avr_arch(&sess.target.options.cpu)
+        }
         _ => 0,
     };
     // adapted from LLVM's `MCELFObjectTargetWriter::getOSABI`