Skip to content

Commit 878f383

Browse files
authored
Rollup merge of rust-lang#137830 - LuigiPiucco:incompatible-isa-fix, r=workingjubilee
Fix link failure on AVR (incompatible ISA error) Fixes rust-lang#137739. A reproducer of the issue is present there. I believe the root cause was introducing the avr-none target (which has no CPU by default) while also trying to get the ISA revision from the target spec. This commit uses the `target-cpu` option instead, which is already required to be present for the target. r? compiler cc ``@Patryk27``
2 parents c112b70 + 4c1f51b commit 878f383

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Diff for: compiler/rustc_codegen_ssa/src/back/metadata.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,11 @@ pub(crate) fn create_object_file(sess: &Session) -> Option<write::Object<'static
373373
Architecture::Avr => {
374374
// Resolve the ISA revision and set
375375
// the appropriate EF_AVR_ARCH flag.
376-
ef_avr_arch(&sess.target.options.cpu)
376+
if let Some(ref cpu) = sess.opts.cg.target_cpu {
377+
ef_avr_arch(cpu)
378+
} else {
379+
bug!("AVR CPU not explicitly specified")
380+
}
377381
}
378382
Architecture::Csky => {
379383
let e_flags = match sess.target.options.abi.as_ref() {

0 commit comments

Comments
 (0)