Allow rust binaries to remove dead code

Note: we may need to add a special init function to stop linker based dead code elimination.
That or special linker commands to keep `roc_*` functions.
Currently this is working on my x86 machine without it though.

Guide here if needed on the init function:
https://stackoverflow.com/questions/43712979/how-to-export-a-symbol-from-a-rust-executable
This commit is contained in:
Brendan Hansknecht 2023-09-25 10:23:00 -07:00
parent 8f210241ab
commit d0e1da40ac
No known key found for this signature in database
GPG key ID: A199D0660F95F948

View file

@ -548,7 +548,7 @@ pub fn rebuild_host(
let rust_flags = if cfg!(windows) {
"-Z export-executable-symbols"
} else {
"-C link-dead-code"
"-C link-args=-rdynamic"
};
cargo_cmd.env("RUSTFLAGS", rust_flags);
cargo_cmd.args(["--bin", "host"]);