I am trying to create a static executable with Rust. I am not trying to link a particular library statically, I am trying to create a executable which does not use dynamic linking at all. I have the following (otherwise working) test:
$ cat hello.rs
fn main()
{
print!("Hello, world!\n");
}
$ rustc hello.rs -o hello
$ file hello
hello: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV),
dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, [etc]
Note the dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2. Static executables have statically linked instead. (And in my case corrupted section header size, although I would be pleasantly astonished if I could convince Rust to replicate that.)
What options do I need to pass to rustc to get it to generate an actual static executable (for concreteness: one which even file agrees is statically linked).
printbottoms out (via either function calls or inlining) tomov eax,1 ; mov ebx,fdout ; mov ecx bufptr ; mov edx buflen. It's probably possible to design a system call interface that truly requires dynamic linking, but only a raging incompetent would do so for a general purpose OS.