Skip to content

Fix link failure on AVR (incompatible ISA error) #137830

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 2, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Fix link failure on AVR (incompatible ISA error)
Fixes #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) and trying to get the ISA revision from there. This commit
uses the `target-cpu` option instead, which is already required to be
present for the target.

Co-authored-by: tones111 <[email protected]>
  • Loading branch information
LuigiPiucco and tones111 committed Feb 28, 2025
commit 4c1f51bf6ecc68fb6eb4b90ea6b0d0b027146aee
6 changes: 5 additions & 1 deletion compiler/rustc_codegen_ssa/src/back/metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,11 @@ pub(crate) fn create_object_file(sess: &Session) -> Option<write::Object<'static
Architecture::Avr => {
// Resolve the ISA revision and set
// the appropriate EF_AVR_ARCH flag.
ef_avr_arch(&sess.target.options.cpu)
if let Some(ref cpu) = sess.opts.cg.target_cpu {
ef_avr_arch(cpu)
} else {
bug!("AVR CPU not explicitly specified")
}
}
Architecture::Csky => {
let e_flags = match sess.target.options.abi.as_ref() {
Expand Down
Loading