mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-25 16:33:15 +00:00
6f756b4065
We already did this for -march in 12b0e8ac74
("clang: don't set
-march for overridden target"), but it should have been done for all
machine flags, for the same reason.
Example bug this fixes:
nix-shell -E '
with import ./. {
crossSystem = {
system = "powerpc64le-linux";
gcc.cpu = "power10";
};
};
clangStdenv.mkDerivation { name = "test"; }
' --run '$CC -target wasm32-unknown-unknown -c /dev/null'
Which previously failed with:
clang: error: unsupported option '-mcpu=' for target 'wasm32-unknown-unknown'
12 lines
208 B
Bash
12 lines
208 B
Bash
needsTarget=true
|
|
|
|
for p in "${params[@]}"; do
|
|
case "$p" in
|
|
-target | --target=*) needsTarget=false ;;
|
|
esac
|
|
done
|
|
|
|
if $needsTarget; then
|
|
extraBefore+=(-target @defaultTarget@ @machineFlags@)
|
|
fi
|