How to compile assembly generated by rustc?

⚓ Rust    📅 2025-11-07    👤 surdeus    👁️ 10      

surdeus

Warning

This post was published 72 days ago. The information described in this article may have changed.

Hello! Is it possible to emit assembly in rustc and then compile it with GNU Assembler? I tried to do so, but I got these linker errors when I ran as and then ld:

ld: warning: cannot find entry symbol _start; defaulting to 0000000000401000
ld: a.o: in function `std::rt::lang_start':
hello.c3e402144fb7d6b4-cgu.0:(.text._ZN3std2rt10lang_start17hf8754b1fbdb05c66E+0x1a): undefined reference to `std::rt::lang_start_internal'
ld: a.o: in function `hello::main':
hello.c3e402144fb7d6b4-cgu.0:(.text._ZN5hello4main17ha49144bd44429a12E+0x31): undefined reference to `std::io::stdio::_print'
ld: a.o: in function `main':
hello.c3e402144fb7d6b4-cgu.0:(.text.main+0x21): undefined reference to `std::rt::lang_start_internal'

What am I doing wrong here?

2 posts - 2 participants

Read full topic

🏷️ Rust_feed