nixpkgs/pkgs/build-support/cc-wrapper
Sergei Trofimovich 8c80bd08b7 build-support/cc-wrapper: pass in non-existent --sysroot= to untangle from libc
I would like to add an extra `gcc` build step during linux bootstrap
(https://github.com/NixOS/nixpkgs/issues/208412). This makes it early
bootstrap compiler linked and targeted against `bootstrapTools` `glibc`
including it's headers.

Without this change `gcc`'s spec files always prefer `bootstrapTools` `glibc`
for header search path (passed in as --with-native-system-header-dir=). We'can't
override it with:

- `-I` option as it gets stacked before gcc-specific headers, we need to keep
  glibc headers after gcc as gcc cleans namespace up for C standard by using
  #include_next and by undefining system macros.
- `-idirafter` option as it gets appended after existing `glibc`-includes

This `--sysroot=/nix/store/does/not/exist` hack allows us to remove existing
`glibc` headers and add new ones with `-idirafter`.

We use `cc-cflags-before` instead of `libc-cflags` to allow user to define
their own `--sysroot=` (like `firefox` does).

To keep it working prerequisite cross-symlink in gcc.libs is required:
https://github.com/NixOS/nixpkgs/pull/209153
2023-01-10 07:54:13 +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
add-hardening.sh cc-wrapper/add-hardening.sh: always unset _FORTIFY_SOURCE before re-setting it 2022-10-01 08:30:11 +01:00
cc-wrapper.sh cc-wrapper: adding a cc-wrapper-hook to the cc-wrapper 2022-10-26 09:33:43 -07:00
default.nix build-support/cc-wrapper: pass in non-existent --sysroot= to untangle from libc 2023-01-10 07:54:13 +00:00
fortran-hook.sh cc-wrapper: fortran: enable stackprotector on M1 2022-08-19 16:41:36 -07:00
gnat-wrapper.sh
setup-hook.sh Revert "Merge #191724: cc-wrapper: remove duplicate include flags" 2022-10-28 10:28:12 +02:00