diff --git a/pkgs/build-support/cc-wrapper/cc-wrapper.sh b/pkgs/build-support/cc-wrapper/cc-wrapper.sh index 8003fe1d8f38b..66c1886445804 100644 --- a/pkgs/build-support/cc-wrapper/cc-wrapper.sh +++ b/pkgs/build-support/cc-wrapper/cc-wrapper.sh @@ -137,6 +137,15 @@ source @out@/nix-support/add-hardening.sh extraAfter=($NIX_@infixSalt@_CFLAGS_COMPILE) extraBefore=(${hardeningCFlags[@]+"${hardeningCFlags[@]}"}) +# When enforcing purity, pretend gcc can't find the current date and +# time +if [[ "${NIX_ENFORCE_PURITY:-}" = 1 ]]; then + extraAfter=(-D__DATE__=\"???-??-????\" + -D__TIME__=\"??:??:??\" + -Wno-builtin-macro-redefined + "${extraAfter[@]}") +fi + if [ "$dontLink" != 1 ]; then # Add the flags that should only be passed to the compiler when