Build(Cargo): Add mold as default linker in both profiles

I measured the linking times by running `cargo rustc --bin trinitrix --
-Z time-passes`, which resulted in following data:

`ld`:
37.794s to link
`mold`:
21.389s to link

The downside for now is, that this requires to have mold installed to
build trinitrix (The nix flake based direnv already has it) and that
mold only works on linux.
This commit is contained in:
Benedikt Peetz 2023-07-24 16:44:38 +02:00
parent dfeac4662d
commit e62febf0f4
Signed by: bpeetz
GPG Key ID: A5E94010C3A642AD
2 changed files with 3 additions and 0 deletions

2
.cargo/config.toml Normal file
View File

@ -0,0 +1,2 @@
[target.x86_64-unknown-linux-gnu]
rustflags = ["-C", "link-arg=-fuse-ld=mold"]

View File

@ -52,6 +52,7 @@
nativeBuildInputs = with pkgs; [ nativeBuildInputs = with pkgs; [
pkg-config pkg-config
mold
]; ];
buildInputs = with pkgs; [ buildInputs = with pkgs; [
openssl openssl