Skip to content

sparc-unknown-none-elf target broken #130172

Closed
@thejpster

Description

@thejpster

If I try and build https://github.com/ferrous-systems/sparc-experiments with today's nightly, I get:

/home/jonathan/Downloads/gaisler/sparc-bcc-2.3.0-llvm/bin/sparc-gaisler-elf-ld: unknown architecture of input file `/tmp/rustc4jBo9z/symbols.o' is incompatible with sparc output

Using -Csave-temps, I can see:

$ file /tmp/rustc4jBo9z/symbols.o
/tmp/rustc4jBo9z/symbols.o: ELF 32-bit MSB relocatable, SPARC32PLUS, total store ordering, version 1 (SYSV), not stripped
$ file ./target/sparc-unknown-none-elf/debug/deps/sparc_demo_rust-8c8aedb85be3cab2.0unncljkfm3eoay971moazawq.rcgu.o 
./target/sparc-unknown-none-elf/debug/deps/sparc_demo_rust-8c8aedb85be3cab2.0unncljkfm3eoay971moazawq.rcgu.o: ELF 32-bit MSB relocatable, SPARC, version 1 (SYSV), with debug_info, not stripped

They are not the same.

Doing a bisect, it falls over on 2024-08-08. I suspect it might be d1d21ed, which probably should have picked Architecture::Sparc instead.

diff --git a/compiler/rustc_codegen_ssa/src/back/metadata.rs b/compiler/rustc_codegen_ssa/src/back/metadata.rs
index 0fd9d7fffe8..ea9327dc0f1 100644
--- a/compiler/rustc_codegen_ssa/src/back/metadata.rs
+++ b/compiler/rustc_codegen_ssa/src/back/metadata.rs
@@ -208,7 +208,7 @@ 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" => (Architecture::Sparc, None),
         "sparc64" => (Architecture::Sparc64, None),
         "avr" => (Architecture::Avr, None),
         "msp430" => (Architecture::Msp430, None),

I did a build and my repo now builds and runs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    O-SPARCTarget: SPARC processorsP-lowLow priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-nightlyPerformance or correctness regression from stable to nightly.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions