rust-lang / rust-lang/rust

Outdated cc crates in rustc lead to incorrect toolchain use on m68k

Open
#155,602 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

needs-triage O-motorola68k
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

As of April 21 2026, the Rust compiler (rustc) depends on outdated versions of the cc crate in both the bootstrap code (src/bootstrap) as well as the rustc_llvm (compiler/rustc_llvm) crate causing the build process to invoke the toolchain without the proper m68k-linux-gnu prefix.

As a result, the Rust compiler tries to link m68k object code using the host system's native linker which fails with the following error message (repeated for every object file):

Building stage1 library artifacts (stage1:x86_64-unknown-linux-gnu -> stage1:m68k-unknown-linux-gnu)
   Compiling std v0.0.0 (/home/glaubitz/rust/library/std)
error: linking with `cc` failed: exit status: 1
  |
  = note:  "cc" "-Wl,--version-script=<sysroot>-std/m68k-unknown-linux-gnu/dist/deps/rustcnzfqgV/list" "-Wl,--no-undefined-version" "<sysroot>-std/m68k-unknown-linux-gnu/dist/deps/rustcnzfqgV/symbols.o" "<1 object files omitted>" "<sysroot>-std/m68k-unknown-linux-gnu/dist/deps/rustcnzfqgV/rmeta.o" "<1 object files omitted>" "-Wl,--as-needed" "-Wl,-Bstatic" "/home/glaubitz/rust/build/x86_64-unknown-linux-gnu/stage1-std/m68k-unknown-linux-gnu/dist/deps/{libpanic_unwind-1377bfc885b1fea5,libobject-038ec6607aa4c4f5,libmemchr-9a395131b033cd70,libaddr2line-6fe1c46de534748d,libgimli-364e093a3499fc5c,libcfg_if-cc305db183215df0,librustc_demangle-4c950143726eee4f,libstd_detect-9e67a3fdd25338c4,libhashbrown-2421e2e67df4554f,librustc_std_workspace_alloc-3ca0ede664a406f8,libminiz_oxide-abdd6be91580b465,libadler2-37dab85593db57c7,libunwind-a416c3d7feaced11,liblibc-cffdf4a2a5038e83,librustc_std_workspace_core-0263e07f5a887608,liballoc-090c91757f5851fa,libcore-9c5fde30ad88ab49,libcompiler_builtins-35a7a965815a62c4}.rlib" "-Wl,-Bdynamic" "-lgcc_s" "-lutil" "-lrt" "-lpthread" "-lm" "-ldl" "-lc" "-L" "<sysroot>-std/m68k-unknown-linux-gnu/dist/deps/rustcnzfqgV/raw-dylibs" "-Wl,--eh-frame-hdr" "-Wl,-z,noexecstack" "-L" "<sysroot>-std/m68k-unknown-linux-gnu/dist/build/compiler_builtins-06c5890d2acf1675/out" "-L" "<sysroot>/lib/rustlib/m68k-unknown-linux-gnu/lib" "-o" "<sysroot>-std/m68k-unknown-linux-gnu/dist/deps/libstd-1f520f42acf6c8d6.so" "-shared" "-Wl,-soname=libstd-1f520f42acf6c8d6.so" "-Wl,-z,relro,-z,now" "-Wl,-O1" "-nodefaultlibs" "-Wl,-z,origin" "-Wl,-rpath,$ORIGIN/../lib"
  = note: some arguments are omitted. use `--verbose` to show all linker arguments
  = note: /usr/bin/x86_64-linux-gnu-ld.bfd: /home/glaubitz/rust/build/x86_64-unknown-linux-gnu/stage1-std/m68k-unknown-linux-gnu/dist/deps/std-1f520f42acf6c8d6.std.1017b25e36aff6c-cgu.0.rcgu.o: relocations in generic ELF (EM: 4)
          /usr/bin/x86_64-linux-gnu-ld.bfd: /home/glaubitz/rust/build/x86_64-unknown-linux-gnu/stage1-std/m68k-unknown-linux-gnu/dist/deps/std-1f520f42acf6c8d6.std.1017b25e36aff6c-cgu.0.rcgu.o: relocations in generic ELF (EM: 4)
(...)
          /usr/bin/x86_64-linux-gnu-ld.bfd: /home/glaubitz/rust/build/x86_64-unknown-linux-gnu/stage1-std/m68k-unknown-linux-gnu/dist/deps/std-1f520f42acf6c8d6.std.1017b25e36aff6c-cgu.0.rcgu.o: relocations in generic ELF (EM: 4)
          /usr/bin/x86_64-linux-gnu-ld.bfd: /home/glaubitz/rust/build/x86_64-unknown-linux-gnu/stage1-std/m68k-unknown-linux-gnu/dist/deps/std-1f520f42acf6c8d6.std.1017b25e36aff6c-cgu.0.rcgu.o: relocations in generic ELF (EM: 4)
          /usr/bin/x86_64-linux-gnu-ld.bfd: /home/glaubitz/rust/build/x86_64-unknown-linux-gnu/stage1-std/m68k-unknown-linux-gnu/dist/deps/std-1f520f42acf6c8d6.std.1017b25e36aff6c-cgu.0.rcgu.o: error adding symbols: file in wrong format
          collect2: error: ld returned 1 exit status
          

error: could not compile `std` (lib) due to 1 previous error

To address this, the cc crates in the Rust compiler have to be update to version 1.2.32 or newer as support for the m68k-unknown-linux-gnu cross-compile target was only added in version 1.2.32 of the cc crate.

Originally reported in the M68k issue tracker as https://github.com/M680x0/issues/issues/9.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the cc dependency declarations under src/bootstrap and compiler/rustc_llvm, then inspect the surrounding build configuration and dependency metadata. Verify the m68k-unknown-linux-gnu cross-compilation path and confirm that the build invokes the prefixed toolchain and no longer fails with wrong-format linker errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
build-system, compilers
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
64/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.