This is kind of dirty with that huge list of linker params, but it works and it produces smaller object files (probably because GCC is better optimized for size).
This is intentionally similar to the target specifications in Rust: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_target/spec/struct.TargetOptions.html