Absolutely minimal runtime for rust9x. Explicitly no C runtime, just the bare minimum to get a pure Rust program running.
Actually, it's less than the bare minimum: Floating point support is not included (yet?), so none of the expected intrincics are available.
cargo +rust9x build --release.cargo/config.toml:
[target.'cfg(all(target_family = "rust9x", target_env = "msvc"))']
rustflags = [
'-Ctarget-feature=+crt-static', # link our libcmt.lib
'-Clink-arg=/LIBPATH:/home/seri/p/rust/rust9x/r9xrsrt/target/i586-rust9x-windows-msvc/release',
# any platform sdk with kernel32.lib and ws2_32.lib will do
'-Clink-arg=/LIBPATH:/home/seri/mnt/ext4/msvc-toolchains/vc8/VC/PlatformSDK/Lib',
]- Unwinding is not supported, use
panic = "abort"in yourCargo.toml.- Even if unwinding is disabled, you also need to disable it for the standard library (otherwise
it'll still ask for symbols like
__CxxFrameHandler3) by using-Zbuild-std=panic_abortin the build command.
- Even if unwinding is disabled, you also need to disable it for the standard library (otherwise
it'll still ask for symbols like
memcpy,memmove,memsetare the simplest possible implementations. Use-Zbuild-std-features=compiler-builtins-memto use optimized compiler-builtins instead.- If you don't need backtraces, don't specify the backtrace feature, saves 5-50KiB.
- You'll need to always build at
opt-level = 1or higher so that dead code elimination can remove unused/unimplemented functions. Otherwise you'll get link errors for missing symbols like_fma, even if you don't use them.
Example build command:
cargo +rust9x build --target i586-rust9x-windows-msvc -Zbuild-std=std,panic_abort -Zbuild-std-features=backtrace,compiler-builtins-mem --releaseAlternatively you can add this to your .cargo/config.toml:
[unstable]
build-std = ["std", "panic_abort"]
build-std-features = ["compiler-builtins-mem", "optimize_for_size"]