1
Fork 0

rustc_codegen_ssa: Set e_flags for AVR architecture based on target CPU

This commit is contained in:
Adam Gausmann 2023-01-08 22:59:41 -06:00
parent 965cf5c1f5
commit a7158ecfa9
5 changed files with 350 additions and 1 deletions

View file

@ -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.
///
@ -243,6 +243,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`