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

John Paul Adrian Glaubitz <[email protected]>
Newsgroups org.kernel.vger.linux-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:
> 
> (unstable-amd64-sbuild)glaubitz@esk:~/rust/build$ file ./x86_64-unknown-linux-gnu/stage2-tools/m68k-unknown-linux-gnu/release/cargo
> ./x86_64-unknown-linux-gnu/stage2-tools/m68k-unknown-linux-gnu/release/cargo: ELF 32-bit MSB pie executable, Motorola m68k, 68020, version 1 (SYSV), dynamically linked, interpreter /lib/ld.so.1,
> BuildID[sha1]=7e5bf08930f87b9eaee173cf163b067f620cb841, for GNU/Linux 3.2.0, not stripped
> (unstable-amd64-sbuild)glaubitz@esk:~/rust/build$
> 
> 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 m68k and it
actually runs. The issues which prevented this are two bugs in the LLVM backend, 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-gnu/stage2/bin/rustc --target m68k-unknown-linux-gnu -C linker=m68k-linux-gnu-gcc ~/main.rs -o ~/hello_world
(unstable-amd64-sbuild)glaubitz@esk:~/rust$ file ~/hello_world 
/home/glaubitz/hello_world: ELF 32-bit MSB pie executable, Motorola m68k, 68020, version 1 (SYSV), dynamically linked, interpreter /lib/ld.so.1, BuildID[sha1]=819625f88d263c358cbf7ff37d660bc453eca931,
for GNU/Linux 3.2.0, not stripped
(unstable-amd64-sbuild)glaubitz@esk:~/rust$ md5sum ~/hello_world 
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 
./hello_world: ELF 32-bit MSB pie executable, Motorola m68k, 68020, version 1 (SYSV), dynamically linked, interpreter /lib/ld.so.1, BuildID[sha1]=819625f88d263c358cbf7ff37d660bc453eca931, for
GNU/Linux 3.2.0, not stripped
glaubitz@mitchy:~$ md5sum ./hello_world 
c12f86b37b301331e14499b573e45955  ./hello_world
glaubitz@mitchy:~$ ./hello_world 
Hello, m68k Linux world!
glaubitz@mitchy:~$

Adrian

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

-- 
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer
`. `'   Physicist
  `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.