Rollup merge of #131222 - thejpster:fix-sparc-v7-symbol-o, r=workingjubilee

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

This fixes #130172 by selecting the correct ELF Machine type for sparc-unknown-none-elf (which has a baseline of SPARC V7).
This commit is contained in:
Jubilee 2024-11-03 20:08:13 -08:00 committed by GitHub
commit f35433e250
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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),