nixpkgs/pkgs/build-support/cc-wrapper
Florian Klink 07c4056179 gnats: format hardened flag isn't supported
When invoking a simple Ada program with `gcc` from `gnats10`, the
following warnings are shown:

```
$ gcc -c conftest.adb
gnat1: warning: command-line option ‘-Wformat=1’ is valid for C/C++/ObjC/ObjC++ but not for Ada
gnat1: warning: command-line option ‘-Wformat-security’ is valid for C/C++/ObjC/ObjC++ but not for Ada
gnat1: warning: ‘-Werror=’ argument ‘-Werror=format-security’ is not valid for Ada
$ echo $?
0
```

This is only spammy when compiling Ada programs inside a Nix derivation,
but certain configure scripts (such as the ./configure script from the
gcc that's built by coreboot's `make crossgcc` command) fail entirely
when getting that warning output.

https://nixos.wiki/wiki/Coreboot currently suggests manually running

> NIX_HARDENING_ENABLE="${NIX_HARDENING_ENABLE/ format/}" make crossgcc

… but actually teaching the nixpkgs-provided cc wrapper that `format`
isn't supported as a hardening flag seems to be the more canonical way
to do this in nixpgks.

After this, Ada programs still compile:

```
$ gcc -c conftest.adb
$ echo $?
0
```

And the compiler output is empty.
2020-12-23 01:51:14 +01:00
..
add-flags.sh stdenv: make -nostdinc work as intended 2020-07-23 08:39:46 +01:00
add-hardening.sh *-wrapper; Switch from infixSalt to suffixSalt 2020-05-12 00:44:44 -04:00
cc-wrapper.sh stdenv: make -nostdinc work as intended 2020-07-23 08:39:46 +01:00
default.nix gnats: format hardened flag isn't supported 2020-12-23 01:51:14 +01:00
fortran-hook.sh cc-wrapper: set FC when langFortran is on 2020-07-06 00:22:19 -04:00
gnat-wrapper.sh gnat: fix build 2020-09-19 20:54:27 -07:00
setup-hook.sh *-wrapper; Switch from infixSalt to suffixSalt 2020-05-12 00:44:44 -04:00