nixpkgs/pkgs/build-support/cc-wrapper
Robert Scott 1a5bd697ad mkDerivation, bintools-wrapper: move defaultHardeningFlags determination to bintools-wrapper
this makes it a lot easier to create a modified stdenv with a
different set of defaultHardeningFlags and as a bonus allows us
to inject the correct defaultHardeningFlags into toolchain wrapper
scripts, reducing repetition.

while most hardening flags are arguably more of a compiler thing,
it works better to put them in bintools-wrapper because cc-wrapper
can easily refer to bintools but not vice-versa.

mkDerivation can still easily refer to either when it is constructed.

this also switches fortran-hook.sh to use the same defaults for
NIX_HARDENING_ENABLE as for C. previously NIX_HARDENING_ENABLE
defaults were apparently used to avoid passing problematic flags
to a fortran compiler, but this falls apart as soon as mkDerivation
sets its own NIX_HARDENING_ENABLE - cc.hardeningUnsupportedFlags
is a more appropriate mechanism for this as it actively filters
out flags from being used by the wrapper, so switch to using that
instead.

this is still an imperfect mechanism because it doesn't handle a
compiler which has both langFortran *and* langC very well - applying
the superset of the two's hardeningUnsupportedFlags to either
compiler's invocation. however this is nothing new - cc-wrapper
already poorly handles a langFortran+langC compiler, applying two
setup hooks that have contradictory options.
2023-12-09 16:30:45 +00:00
..
add-clang-cc-cflags-before.sh cc-wrapper: Add clang specific options to clang specific file 2022-06-15 11:34:53 -04:00
add-flags.sh cc-wrapper: change cflags order from cc/crt1/libc to crt1/libc/cc 2022-02-20 10:45:45 +00:00
add-gnat-extra-flags.sh cc-wrapper: Fix gnatmake wrapper 2023-01-07 18:32:12 +11:00
add-hardening.sh mkDerivation, bintools-wrapper: move defaultHardeningFlags determination to bintools-wrapper 2023-12-09 16:30:45 +00:00
cc-wrapper.sh cc-wrapper: Use MacOS compatible mktemp command 2023-10-05 10:44:34 +02:00
default.nix mkDerivation, bintools-wrapper: move defaultHardeningFlags determination to bintools-wrapper 2023-12-09 16:30:45 +00:00
fortran-hook.sh mkDerivation, bintools-wrapper: move defaultHardeningFlags determination to bintools-wrapper 2023-12-09 16:30:45 +00:00
gnat-wrapper.sh cc-wrapper: Wrap/link all other GNAT commands 2023-01-07 18:32:12 +11:00
go-wrapper.sh gccgo: wrap go binary (#207670) 2023-01-20 14:31:54 +01:00
setup-hook.sh mkDerivation, bintools-wrapper: move defaultHardeningFlags determination to bintools-wrapper 2023-12-09 16:30:45 +00:00