|
|
|
@ -63,6 +63,25 @@ let |
|
|
|
|
then import ../expand-response-params { inherit (buildPackages) stdenv; } |
|
|
|
|
else ""; |
|
|
|
|
|
|
|
|
|
# older compilers (for example bootstrap's GCC 5) fail with -march=too-modern-cpu |
|
|
|
|
isGccArchSupported = arch: |
|
|
|
|
if cc.isGNU or false then |
|
|
|
|
{ skylake = versionAtLeast ccVersion "6.0"; |
|
|
|
|
skylake-avx512 = versionAtLeast ccVersion "6.0"; |
|
|
|
|
cannonlake = versionAtLeast ccVersion "8.0"; |
|
|
|
|
icelake-client = versionAtLeast ccVersion "8.0"; |
|
|
|
|
icelake-server = versionAtLeast ccVersion "8.0"; |
|
|
|
|
knm = versionAtLeast ccVersion "8.0"; |
|
|
|
|
}.${arch} or true |
|
|
|
|
else if cc.isClang or false then |
|
|
|
|
{ cannonlake = versionAtLeast ccVersion "5.0"; |
|
|
|
|
icelake-client = versionAtLeast ccVersion "7.0"; |
|
|
|
|
icelake-server = versionAtLeast ccVersion "7.0"; |
|
|
|
|
knm = versionAtLeast ccVersion "7.0"; |
|
|
|
|
}.${arch} or true |
|
|
|
|
else |
|
|
|
|
false; |
|
|
|
|
|
|
|
|
|
in |
|
|
|
|
|
|
|
|
|
# Ensure bintools matches |
|
|
|
@ -287,7 +306,8 @@ stdenv.mkDerivation { |
|
|
|
|
# Always add -march based on cpu in triple. Sometimes there is a |
|
|
|
|
# discrepency (x86_64 vs. x86-64), so we provide an "arch" arg in |
|
|
|
|
# that case. |
|
|
|
|
+ optionalString (targetPlatform ? platform.gcc.arch || targetPlatform.parsed.cpu ? arch) '' |
|
|
|
|
+ optionalString ((targetPlatform ? platform.gcc.arch || targetPlatform.parsed.cpu ? arch) && |
|
|
|
|
isGccArchSupported targetPlatform.platform.gcc.arch or targetPlatform.parsed.cpu.arch) '' |
|
|
|
|
echo "-march=${targetPlatform.platform.gcc.arch or targetPlatform.parsed.cpu.arch}" >> $out/nix-support/cc-cflags-before |
|
|
|
|
'' |
|
|
|
|
|
|
|
|
@ -309,7 +329,8 @@ stdenv.mkDerivation { |
|
|
|
|
+ optionalString (targetPlatform ? platform.gcc.mode) '' |
|
|
|
|
echo "-mmode=${targetPlatform.platform.gcc.mode}" >> $out/nix-support/cc-cflags-before |
|
|
|
|
'' |
|
|
|
|
+ optionalString (targetPlatform ? platform.gcc.tune) '' |
|
|
|
|
+ optionalString (targetPlatform ? platform.gcc.tune && |
|
|
|
|
isGccArchSupported targetPlatform.platform.gcc.tune) '' |
|
|
|
|
echo "-mtune=${targetPlatform.platform.gcc.tune}" >> $out/nix-support/cc-cflags-before |
|
|
|
|
'' |
|
|
|
|
|
|
|
|
|