cc-wrapper: Workaround gnuabielfv{1,2} support deficiency on Clang (#297425)
This commit is contained in:
@@ -30,4 +30,8 @@ if $targetPassed && [[ "$targetValue" != "@defaultTarget@" ]] && (( "${NIX_CC_WR
|
||||
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
|
||||
elif [[ $0 != *cpp ]]; then
|
||||
extraBefore+=(-target @defaultTarget@ @machineFlags@)
|
||||
|
||||
if [[ "@explicitAbiValue@" != "" ]]; then
|
||||
extraBefore+=(-mabi=@explicitAbiValue@)
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -94,12 +94,14 @@ let
|
||||
getLib
|
||||
getName
|
||||
getVersion
|
||||
hasPrefix
|
||||
mapAttrsToList
|
||||
optional
|
||||
optionalAttrs
|
||||
optionals
|
||||
optionalString
|
||||
removePrefix
|
||||
removeSuffix
|
||||
replaceStrings
|
||||
toList
|
||||
versionAtLeast
|
||||
@@ -901,12 +903,24 @@ stdenvNoCC.mkDerivation {
|
||||
## General Clang support
|
||||
## Needs to go after ^ because the for loop eats \n and makes this file an invalid script
|
||||
##
|
||||
+ optionalString isClang ''
|
||||
# Escape twice: once for this script, once for the one it gets substituted into.
|
||||
export machineFlags=${escapeShellArg (escapeShellArgs machineFlags)}
|
||||
export defaultTarget=${targetPlatform.config}
|
||||
substituteAll ${./add-clang-cc-cflags-before.sh} $out/nix-support/add-local-cc-cflags-before.sh
|
||||
''
|
||||
+ optionalString isClang (
|
||||
let
|
||||
hasUnsupportedGnuSuffix = hasPrefix "gnuabielfv" targetPlatform.parsed.abi.name;
|
||||
clangCompatibleConfig =
|
||||
if hasUnsupportedGnuSuffix then
|
||||
removeSuffix (removePrefix "gnu" targetPlatform.parsed.abi.name) targetPlatform.config
|
||||
else
|
||||
targetPlatform.config;
|
||||
explicitAbiValue = if hasUnsupportedGnuSuffix then targetPlatform.parsed.abi.abi else "";
|
||||
in
|
||||
''
|
||||
# Escape twice: once for this script, once for the one it gets substituted into.
|
||||
export machineFlags=${escapeShellArg (escapeShellArgs machineFlags)}
|
||||
export defaultTarget=${clangCompatibleConfig}
|
||||
export explicitAbiValue=${explicitAbiValue}
|
||||
substituteAll ${./add-clang-cc-cflags-before.sh} $out/nix-support/add-local-cc-cflags-before.sh
|
||||
''
|
||||
)
|
||||
|
||||
##
|
||||
## Extra custom steps
|
||||
|
||||
Reference in New Issue
Block a user