Skip to content

Commit 0f72faa

Browse files
committed
Generate correct symbols.o for sparc-unknown-none-elf
Fixes #130172
1 parent 56e35a5 commit 0f72faa

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

compiler/rustc_codegen_ssa/src/back/metadata.rs

+9-1
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,15 @@ pub(crate) fn create_object_file(sess: &Session) -> Option<write::Object<'static
209209
"powerpc64" => (Architecture::PowerPc64, None),
210210
"riscv32" => (Architecture::Riscv32, None),
211211
"riscv64" => (Architecture::Riscv64, None),
212-
"sparc" => (Architecture::Sparc32Plus, None),
212+
"sparc" => {
213+
if sess.target.options.cpu == "v9" {
214+
// Target uses V8+, aka EM_SPARC32PLUS, aka 64-bit V9 but in 32-bit mode
215+
(Architecture::Sparc32Plus, None)
216+
} else {
217+
// Target uses V7 or V8, aka EM_SPARC
218+
(Architecture::Sparc, None)
219+
}
220+
}
213221
"sparc64" => (Architecture::Sparc64, None),
214222
"avr" => (Architecture::Avr, None),
215223
"msp430" => (Architecture::Msp430, None),

0 commit comments

Comments
 (0)