Skip to content

Commit

Permalink
Rollup merge of rust-lang#131222 - thejpster:fix-sparc-v7-symbol-o, r…
Browse files Browse the repository at this point in the history
…=workingjubilee

Generate correct symbols.o for sparc-unknown-none-elf

This fixes rust-lang#130172 by selecting the correct ELF Machine type for sparc-unknown-none-elf (which has a baseline of SPARC V7).
  • Loading branch information
workingjubilee authored Nov 4, 2024
2 parents 43c7805 + 0f72faa commit f35433e
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion compiler/rustc_codegen_ssa/src/back/metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,15 @@ pub(crate) fn create_object_file(sess: &Session) -> Option<write::Object<'static
"powerpc64" => (Architecture::PowerPc64, None),
"riscv32" => (Architecture::Riscv32, None),
"riscv64" => (Architecture::Riscv64, None),
"sparc" => (Architecture::Sparc32Plus, None),
"sparc" => {
if sess.target.options.cpu == "v9" {
// Target uses V8+, aka EM_SPARC32PLUS, aka 64-bit V9 but in 32-bit mode
(Architecture::Sparc32Plus, None)
} else {
// Target uses V7 or V8, aka EM_SPARC
(Architecture::Sparc, None)
}
}
"sparc64" => (Architecture::Sparc64, None),
"avr" => (Architecture::Avr, None),
"msp430" => (Architecture::Msp430, None),
Expand Down

0 comments on commit f35433e

Please sign in to comment.