diff options
Diffstat (limited to 'nixpkgs/pkgs/build-support/cc-wrapper/default.nix')
-rw-r--r-- | nixpkgs/pkgs/build-support/cc-wrapper/default.nix | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/nixpkgs/pkgs/build-support/cc-wrapper/default.nix b/nixpkgs/pkgs/build-support/cc-wrapper/default.nix index 551074e0a211..c7c733a427aa 100644 --- a/nixpkgs/pkgs/build-support/cc-wrapper/default.nix +++ b/nixpkgs/pkgs/build-support/cc-wrapper/default.nix @@ -51,6 +51,8 @@ # the derivation at which the `-B` and `-L` flags added by `useCcForLibs` will point , gccForLibs ? if useCcForLibs then cc else null +, fortify-headers ? null +, includeFortifyHeaders ? null }: with lib; @@ -65,6 +67,10 @@ let stdenv = stdenvNoCC; inherit (stdenv) hostPlatform targetPlatform; + includeFortifyHeaders' = if includeFortifyHeaders != null + then includeFortifyHeaders + else targetPlatform.libc == "musl"; + # Prefix for binaries. Customarily ends with a dash separator. # # TODO(@Ericson2314) Make unconditional, or optional but always true by @@ -165,6 +171,8 @@ let stdenv.targetPlatform.darwinMinVersionVariable; in +assert includeFortifyHeaders' -> fortify-headers != null; + # Ensure bintools matches assert libc_bin == bintools.libc_bin; assert libc_dev == bintools.libc_dev; @@ -189,7 +197,7 @@ stdenv.mkDerivation { # Binutils, and Apple's "cctools"; "bintools" as an attempt to find an # unused middle-ground name that evokes both. inherit bintools; - inherit cc libc nativeTools nativeLibc nativePrefix isGNU isClang; + inherit cc libc libcxx nativeTools nativeLibc nativePrefix isGNU isClang; emacsBufferSetup = pkgs: '' ; We should handle propagation here too @@ -414,6 +422,16 @@ stdenv.mkDerivation { echo "${libc_lib}" > $out/nix-support/orig-libc echo "${libc_dev}" > $out/nix-support/orig-libc-dev + '' + # fortify-headers is a set of wrapper headers that augment libc + # and use #include_next to pass through to libc's true + # implementations, so must appear before them in search order. + # in theory a correctly placed -idirafter could be used, but in + # practice the compiler may have been built with a --with-headers + # like option that forces the libc headers before all -idirafter, + # hence -isystem here. + + optionalString includeFortifyHeaders' '' + echo "-isystem ${fortify-headers}/include" >> $out/nix-support/libc-cflags '') ## @@ -609,6 +627,8 @@ stdenv.mkDerivation { env = { + inherit isClang; + # for substitution in utils.bash expandResponseParams = "${expand-response-params}/bin/expand-response-params"; shell = getBin shell + shell.shellPath or ""; |