about summary refs log tree commit diff
path: root/pkgs/build-support/cc-wrapper/default.nix
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2023-04-26 14:03:11 +0000
committerAlyssa Ross <hi@alyssa.is>2023-04-28 10:01:22 +0000
commitbfc7aaa8af566318ad5b0ef35fc8652fecc2945e (patch)
tree3b947fca75b4d0107c283fc5ac431c03a7f1e07f /pkgs/build-support/cc-wrapper/default.nix
parent2839c94f1e2be5fe510597453afc64ed4dc9950b (diff)
wrapCCWith: disable pic when building for Windows
According to <https://gcc.gnu.org/legacy-ml/gcc-patches/2015-08/msg00836.html>,
all code is position-independent on Windows.  Some compilers
apparently warn for -fPIC on Windows, and clang errors:

> clang-15: error: unsupported option '-fPIC' for target 'x86_64-pc-windows-msvc'

I'm guessing the check was hostPlatform instead of targetPlatform by mistake.
Diffstat (limited to 'pkgs/build-support/cc-wrapper/default.nix')
-rw-r--r--pkgs/build-support/cc-wrapper/default.nix2
1 files changed, 1 insertions, 1 deletions
diff --git a/pkgs/build-support/cc-wrapper/default.nix b/pkgs/build-support/cc-wrapper/default.nix
index adab6f239a617..bc9c199f778d5 100644
--- a/pkgs/build-support/cc-wrapper/default.nix
+++ b/pkgs/build-support/cc-wrapper/default.nix
@@ -518,7 +518,7 @@ stdenv.mkDerivation {
     ''
 
     # TODO: categorize these and figure out a better place for them
-    + optionalString hostPlatform.isCygwin ''
+    + optionalString targetPlatform.isWindows ''
       hardening_unsupported_flags+=" pic"
     '' + optionalString targetPlatform.isMinGW ''
       hardening_unsupported_flags+=" stackprotector fortify"