ompss: set flags when intel

This commit is contained in:
Aleix Boné 2025-05-21 17:57:43 +02:00
parent c3e215d2f7
commit 0efc78f6ed
Signed by: abonerib
SSH Key Fingerprint: SHA256:Jmq7aNH8XDdGy7E9dqfqrc/LRaVqhnFgDgdxlFw/pl8
2 changed files with 17 additions and 0 deletions

View File

@ -151,6 +151,10 @@ stdenvNoCC.mkDerivation (finalAttrs: {
ln -s $out/bin/icpx $out/bin/c++
ln -s $out/bin/icx $out/bin/cc
# Use this to detect when a compiler subprocess is called
# from icpx (--fsycl-host-compiler)
echo 'export "NIX_CC_WRAPPER_INTEL=1"' >> $out/nix-support/cc-wrapper-hook
sed -i 's/.*isCxx=0/isCxx=1/' $out/bin/icpx
ln -s ${finalAttrs.finalPackage.pkgs.compiler}/lib $out/lib

View File

@ -3,6 +3,7 @@
, lib
, gcc
, clangOmpss2Unwrapped
, writeShellScript
, openmp ? null
, wrapCCWith
, llvmPackages_latest
@ -34,6 +35,15 @@ let
targetConfig = stdenv.targetPlatform.config;
inherit gcc;
cc = clangOmpss2Unwrapped;
resetIntelCCFlags = let tconf = builtins.replaceStrings ["-"] ["_"] targetConfig;
in writeShellScript "remove-intel.sh" ''
if [ "$NIX_CC_WRAPPER_INTEL" = 1 ]; then
unset NIX_CC_WRAPPER_FLAGS_SET_${tconf}
unset NIX_BINTOOLS_WRAPPER_FLAGS_${tconf}
fi
'';
in wrapCCWith {
inherit cc bintools;
# extraPackages adds packages to depsTargetTargetPropagated
@ -58,6 +68,9 @@ in wrapCCWith {
wrap clang++ $wrapper $ccPath/clang++
sed -i 's|# Flirting.*|&\nsource ${resetIntelCCFlags}|' $out/bin/clang
sed -i 's|# Flirting.*|&\nsource ${resetIntelCCFlags}|' $out/bin/clang++
echo "" > $out/nix-support/add-hardening.sh
'' + lib.optionalString (openmp != null) ''