diff options
| author | Jubilee <workingjubilee@gmail.com> | 2024-11-03 20:08:13 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-11-03 20:08:13 -0800 |
| commit | f35433e25071c236327921898745a182b2aa8c83 (patch) | |
| tree | 6d8dc39eb0242d5e453fc7c20182b8132b270cc1 /compiler/rustc_codegen_ssa/src/back | |
| parent | 43c78051ea96f89ecf33533dfed6db6f1eeba150 (diff) | |
| parent | 0f72faa2b84dda5a1d67d2a55126572867ca5b0d (diff) | |
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).
Diffstat (limited to 'compiler/rustc_codegen_ssa/src/back')
| -rw-r--r-- | compiler/rustc_codegen_ssa/src/back/metadata.rs | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/compiler/rustc_codegen_ssa/src/back/metadata.rs b/compiler/rustc_codegen_ssa/src/back/metadata.rs index dad21bb309f..3f3cb8b4073 100644 --- a/compiler/rustc_codegen_ssa/src/back/metadata.rs +++ b/compiler/rustc_codegen_ssa/src/back/metadata.rs @@ -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), |
