Skip to content

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

@glaubitz

Description

@glaubitz

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 M680x0/issues#9.

Metadata

Metadata

Assignees

No one assigned

    Labels

    O-motorola68kTarget: Rust from the parallel universe where the Amiga won.needs-triageThis issue may need triage. Remove it if it has been sufficiently triaged.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions