Re: First successful cargo build - Re: Summary on what's blocking full Rust support on m68k

John Paul Adrian Glaubitz <[email protected]> Sun, 07 Jun 2026 11:05:01 +0200
Newsgroups gmane.os.netbsd.ports.m68k,gmane.linux.debian.ports.68k,gmane.linux.ports.m68k
Message-ID <49e6f18c2eed28743afb4d22717a93af8fb9089d.camel@physik.fu-berlin.de>
Hi,

On Wed, 2026-05-20 at 10:36 +0200, John Paul Adrian Glaubitz wrote:
> I was eventually able to build cargo for m68k-unknown-linux-gnu:
>=20
> (unstable-amd64-sbuild)glaubitz@esk:~/rust/build$ file ./x86_64-unknown-l=
inux-gnu/stage2-tools/m68k-unknown-linux-gnu/release/cargo
> ./x86_64-unknown-linux-gnu/stage2-tools/m68k-unknown-linux-gnu/release/ca=
rgo: ELF 32-bit MSB pie executable, Motorola m68k, 68020, version 1 (SYSV),=
 dynamically linked, interpreter /lib/ld.so.1,
> BuildID[sha1]=3D7e5bf08930f87b9eaee173cf163b067f620cb841, for GNU/Linux 3=
.2.0, not stripped
> (unstable-amd64-sbuild)glaubitz@esk:~/rust/build$
>=20
> The binary runs on m68k but there is no output, unfortunately. Needs more=
 debugging.

Some more progress. I managed to cross-compile "Hello World" in Rust for m6=
8k and it
actually runs. The issues which prevented this are two bugs in the LLVM bac=
kend, one
is already known upstream [1]. I will file a bug report for the second one.

(unstable-amd64-sbuild)glaubitz@esk:~/rust$ uname -a
Linux esk 6.18.12+deb14-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.18.12-1 (2026=
-02-17) x86_64 GNU/Linux
(unstable-amd64-sbuild)glaubitz@esk:~/rust$ cat ~/main.rs
fn main() {
    println!("Hello, m68k Linux world!");
}
(unstable-amd64-sbuild)glaubitz@esk:~/rust$ ./build/x86_64-unknown-linux-gn=
u/stage2/bin/rustc --target m68k-unknown-linux-gnu -C linker=3Dm68k-linux-g=
nu-gcc ~/main.rs -o ~/hello_world
(unstable-amd64-sbuild)glaubitz@esk:~/rust$ file ~/hello_world=20
/home/glaubitz/hello_world: ELF 32-bit MSB pie executable, Motorola m68k, 6=
8020, version 1 (SYSV), dynamically linked, interpreter /lib/ld.so.1, Build=
ID[sha1]=3D819625f88d263c358cbf7ff37d660bc453eca931,
for GNU/Linux 3.2.0, not stripped
(unstable-amd64-sbuild)glaubitz@esk:~/rust$ md5sum ~/hello_world=20
c12f86b37b301331e14499b573e45955  /home/glaubitz/hello_world
(unstable-amd64-sbuild)glaubitz@esk:~/rust$

glaubitz@mitchy:~$ uname -a
Linux mitchy 6.15.0-rc2-virt #1 Thu May  1 10:27:28 UTC 2025 m68k GNU/Linux
glaubitz@mitchy:~$ file ./hello_world=20
./hello_world: ELF 32-bit MSB pie executable, Motorola m68k, 68020, version=
 1 (SYSV), dynamically linked, interpreter /lib/ld.so.1, BuildID[sha1]=3D81=
9625f88d263c358cbf7ff37d660bc453eca931, for
GNU/Linux 3.2.0, not stripped
glaubitz@mitchy:~$ md5sum ./hello_world=20
c12f86b37b301331e14499b573e45955  ./hello_world
glaubitz@mitchy:~$ ./hello_world=20
Hello, m68k Linux world!
glaubitz@mitchy:~$

Adrian

> [1] https://github.com/llvm/llvm-project/issues/152816

--=20
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer
`. `'   Physicist
  `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913