cc-wrapper: keep local cflags if the same target is passed
12b0e8a/6f756b4 work around clang errors when a nix-wrapped compiler is used like a multi-target compiler. it does so by dropping the machineFlags whenever -target/--target is found in the arguments. however this breaks compiler-rt, which is designed to acommodate multi-target builds and always passes `--target`. in its packaging we make sure to only build it for the target we need, essentially disabling the multi-target aspect, but because it still passes --target, the machineFlags are dropped and compiler-rt could end up being for an invalid ABI, producing an unusable stdenv.cc. we could manually pass machineFlags to compiler-rt's cmake build, but IMO it makes more sense to tolerate --target arguments whose value coincides with the wrapper's, keeping the machineFlags in this case.
This commit is contained in:
@@ -28,8 +28,6 @@ done
|
||||
|
||||
if $targetPassed && [[ "$targetValue" != "@defaultTarget@" ]]; then
|
||||
echo "Warning: supplying the --target $targetValue != @defaultTarget@ argument to a nix-wrapped compiler may not work correctly - cc-wrapper is currently not designed with multi-target compilers in mind. You may want to use an un-wrapped compiler instead." >&2
|
||||
fi
|
||||
|
||||
if ! $targetPassed && [[ $0 != *cpp ]]; then
|
||||
elif [[ $0 != *cpp ]]; then
|
||||
extraBefore+=(-target @defaultTarget@ @machineFlags@)
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user