Skip to content

Commit

Permalink
nix: Add notes to C test
Browse files Browse the repository at this point in the history
  • Loading branch information
nspin committed Aug 2, 2023
1 parent 6720570 commit 3603d30
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
6 changes: 6 additions & 0 deletions hacking/nix/rust-utils/build-sysroot.nix
Original file line number Diff line number Diff line change
Expand Up @@ -85,3 +85,9 @@ runCommand "sysroot" {
mkdir -p $d
mv target/${rustTargetInfo.name}/${if release then "release" else "debug"}/deps/* $d
''

# TODO
# rel=lib/rustlib/${buildPlatform.config}/bin
# d=$out/$rel
# mkdir -p $d
# ln -s ${rustToolchain}/$rel/* $d
13 changes: 13 additions & 0 deletions hacking/nix/scope/world/instances/c.nix
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,31 @@ mkInstance {
nativeBuildInputs = super.nativeBuildInputs ++ [
cmake
];
# NIX_DEBUG = 2;
});
# extraCargoFlags = [ "--verbose" ];
modifyConfig = old: lib.recursiveUpdate old {
target.${defaultRustTargetInfo.name} = {
rustflags = (old.target.${defaultRustTargetInfo.name}.rustflags or []) ++ [
"-C" "link-arg=-lc"
"-C" "link-arg=-L${libcDir}/lib"

# TODO
# NOTE: won't work because cross gcc always uses hard-coded --with-ld

# "-C" "linker-flavor=gcc"
# "-C" "link-arg=-nostartfiles"
# "-C" "default-linker-libraries=on"

# "-Z" "gcc-ld=lld"
# (or)
# "-Z" "unstable-options"
# "-C" "link-self-contained=+linker"
# (or)
# "-Z" "unstable-options"
# "-C" "linker-flavor=gnu-lld-cc"

# "-Z" "verbose"
];
};
};
Expand Down

0 comments on commit 3603d30

Please sign in to comment.