···301 libc = "msvcrt"; # This distinguishes the mingw (non posix) toolchain
302 };
303304- # 64 bit mingw-w64 with a llvm-based toolchain targetting ucrt
305- #
306- # Inspired by mstorsjo/llvm-mingw
307- mingwW64-llvm = {
308- config = "x86_64-w64-mingw32";
309- libc = "ucrt";
310- useLLVM = true;
311- };
312-313 # BSDs
314315 amd64-netbsd = lib.warn "The amd64-netbsd system example is deprecated. Use x86_64-netbsd instead." x86_64-netbsd;
···301 libc = "msvcrt"; # This distinguishes the mingw (non posix) toolchain
302 };
303000000000304 # BSDs
305306 amd64-netbsd = lib.warn "The amd64-netbsd system example is deprecated. Use x86_64-netbsd instead." x86_64-netbsd;
···1-# ld.lld has two incompatible command-line drivers: One for the gnu-compatible COFF linker and one for
2-# the ELF linker. If no emulation is set (with -m), it will default to the ELF linker;
3-# unfortunately, some configure scripts use `ld --help` to check for certain Windows-specific flags,
4-# which don't show up in the help for the ELF linker. So we set a default -m here.
5-6-extraBefore+=("-m" "@mtype@")
···000000
-32
pkgs/build-support/bintools-wrapper/default.nix
···3132# Darwin code signing support utilities
33, postLinkSignHook ? null, signingUtils ? null
34-35-# Linker type
36-, isLld ? bintools.isLld or false
37-, isCctools ? bintools.isCctools or false
38-, isGNU ? bintools.isGNU or false
39-, isGold ? bintools.isGold or false
40-, isBfd ? bintools.isBfd or false
41}:
4243with lib;
···119120 passthru = {
121 inherit bintools libc nativeTools nativeLibc nativePrefix;
122-123- inherit isLld isCctools isGNU isGold isBfd;
124125 emacsBufferSetup = pkgs: ''
126 ; We should handle propagation here too
···302 echo "-arch ${targetPlatform.darwinArch}" >> $out/nix-support/libc-ldflags
303 ''
304305- # lld's MinGW driver (e.g. `ld.lld -m i386pep`) does not support the `-z` flag.
306- + optionalString (targetPlatform.isWindows && isLld) ''
307- hardening_unsupported_flags+=" relro bindnow"
308- ''
309-310 ##
311 ## GNU specific extra strip flags
312 ##
···350 substituteAll ${./add-darwin-ldflags-before.sh} $out/nix-support/add-local-ldflags-before.sh
351 ''
352 )
353-354- ##
355- ## Set the default machine type so that $prefix-ld.lld uses the COFF driver for --help
356- ##
357- ## Needed because autotools parses --help for linker features...
358- ##
359- + optionalString (isLld && stdenv.targetPlatform.isWindows) (let
360- mtype =
361- /**/ if targetPlatform.isx86_32 then "i386pe"
362- else if targetPlatform.isx86_64 then "i386pep"
363- else if targetPlatform.isAarch32 then "thumb2pe"
364- else if targetPlatform.isAarch64 then "arm64pe"
365- else throw "unsupported target arch for lld";
366- in ''
367- export mtype=${mtype}
368- substituteAll ${./add-lld-ldflags-before.sh} add-local-ldflags-before.sh
369- cat add-local-ldflags-before.sh >> $out/nix-support/add-local-ldflags-before.sh
370- '')
371372 ##
373 ## Code signing on Apple Silicon
···3132# Darwin code signing support utilities
33, postLinkSignHook ? null, signingUtils ? null
000000034}:
3536with lib;
···112113 passthru = {
114 inherit bintools libc nativeTools nativeLibc nativePrefix;
00115116 emacsBufferSetup = pkgs: ''
117 ; We should handle propagation here too
···293 echo "-arch ${targetPlatform.darwinArch}" >> $out/nix-support/libc-ldflags
294 ''
29500000296 ##
297 ## GNU specific extra strip flags
298 ##
···336 substituteAll ${./add-darwin-ldflags-before.sh} $out/nix-support/add-local-ldflags-before.sh
337 ''
338 )
000000000000000000339340 ##
341 ## Code signing on Apple Silicon
+1-4
pkgs/build-support/cc-wrapper/default.nix
···18, isGNU ? false, isClang ? cc.isClang or false, gnugrep ? null
19, buildPackages ? {}
20, libcxx ? null
21-, isCompilerRT ? false
22}:
2324with lib;
···147 # Binutils, and Apple's "cctools"; "bintools" as an attempt to find an
148 # unused middle-ground name that evokes both.
149 inherit bintools;
150- inherit libc nativeTools nativeLibc nativePrefix isGNU isClang isCompilerRT;
151152 emacsBufferSetup = pkgs: ''
153 ; We should handle propagation here too
···480 hardening_unsupported_flags+=" pic"
481 '' + optionalString targetPlatform.isMinGW ''
482 hardening_unsupported_flags+=" stackprotector fortify"
483- '' + optionalString (targetPlatform.isWindows && isClang) ''
484- hardening_unsupported_flags+=" pic"
485 '' + optionalString targetPlatform.isAvr ''
486 hardening_unsupported_flags+=" stackprotector pic"
487 '' + optionalString (targetPlatform.libc == "newlib") ''
···18, isGNU ? false, isClang ? cc.isClang or false, gnugrep ? null
19, buildPackages ? {}
20, libcxx ? null
021}:
2223with lib;
···146 # Binutils, and Apple's "cctools"; "bintools" as an attempt to find an
147 # unused middle-ground name that evokes both.
148 inherit bintools;
149+ inherit libc nativeTools nativeLibc nativePrefix isGNU isClang;
150151 emacsBufferSetup = pkgs: ''
152 ; We should handle propagation here too
···479 hardening_unsupported_flags+=" pic"
480 '' + optionalString targetPlatform.isMinGW ''
481 hardening_unsupported_flags+=" stackprotector fortify"
00482 '' + optionalString targetPlatform.isAvr ''
483 hardening_unsupported_flags+=" stackprotector pic"
484 '' + optionalString (targetPlatform.libc == "newlib") ''
···32 # https://gitlab.haskell.org/ghc/ghc/-/merge_requests/6155
33 # https://gitlab.gnome.org/GNOME/gobject-introspection/-/merge_requests/283
34 "--disable-exec-static-tramp"
35- ] ++
36- # ld.lld on Windows doesn't support --version-script.
37- lib.optional (stdenv.hostPlatform.isWindows && stdenv.cc.bintools.isLld) "--disable-symvers";
3839 preCheck = ''
40 # The tests use -O0 which is not compatible with -D_FORTIFY_SOURCE.
···46 inherit doCheck;
4748 checkInputs = [ dejagnu ];
49-50- nativeBuildInputs = lib.optional stdenv.hostPlatform.isWindows autoreconfHook;
5152 meta = with lib; {
53 description = "A foreign function call interface library";
···32 # https://gitlab.haskell.org/ghc/ghc/-/merge_requests/6155
33 # https://gitlab.gnome.org/GNOME/gobject-introspection/-/merge_requests/283
34 "--disable-exec-static-tramp"
35+ ];
003637 preCheck = ''
38 # The tests use -O0 which is not compatible with -D_FORTIFY_SOURCE.
···44 inherit doCheck;
4546 checkInputs = [ dejagnu ];
004748 meta = with lib; {
49 description = "A foreign function call interface library";
···46 ];
4748 # Only the C compiler, and explicitly not C++ compiler needs this flag on solaris:
49- CFLAGS =
50- # Only the C compiler, and explicitly not C++ compiler needs this flag on solaris:
51- /**/ if stdenv.isSunOS then "-D_XOPEN_SOURCE_EXTENDED"
52- # ucrt doesn't support X_OK to access() without this flag
53- else if stdenv.hostPlatform.libc == "ucrt" then "-D__USE_MINGW_ACCESS"
54- else "";
55-5657 depsBuildBuild = [
58 buildPackages.stdenv.cc
···46 ];
4748 # Only the C compiler, and explicitly not C++ compiler needs this flag on solaris:
49+ CFLAGS = lib.optionalString stdenv.isSunOS "-D_XOPEN_SOURCE_EXTENDED";
0000005051 depsBuildBuild = [
52 buildPackages.stdenv.cc
+4-4
pkgs/development/libraries/zlib/default.nix
···88 ''
89 # Non-typical naming confuses libtool which then refuses to use zlib's DLL
90 # in some cases, e.g. when compiling libpng.
91- + lib.optionalString (stdenv.hostPlatform.isMinGW && shared) ''
92 ln -s zlib1.dll $out/bin/libz.dll
93 '';
94···101 dontStrip = stdenv.hostPlatform != stdenv.buildPlatform && static;
102 configurePlatforms = [];
103104- installFlags = lib.optionals (stdenv.hostPlatform.isMinGW) [
105 "BINARY_PATH=$(out)/bin"
106 "INCLUDE_PATH=$(dev)/include"
107 "LIBRARY_PATH=$(out)/lib"
···112113 makeFlags = [
114 "PREFIX=${stdenv.cc.targetPrefix}"
115- ] ++ lib.optionals (stdenv.hostPlatform.isMinGW) [
116 "-f" "win32/Makefile.gcc"
117 ] ++ lib.optionals shared [
118 # Note that as of writing (zlib 1.2.11), this flag only has an effect
···134 preConfigure = ''
135 export CHOST=${stdenv.hostPlatform.config}
136 '';
137-} // lib.optionalAttrs (stdenv.hostPlatform.isMinGW) {
138 dontConfigure = true;
139})
···88 ''
89 # Non-typical naming confuses libtool which then refuses to use zlib's DLL
90 # in some cases, e.g. when compiling libpng.
91+ + lib.optionalString (stdenv.hostPlatform.libc == "msvcrt" && shared) ''
92 ln -s zlib1.dll $out/bin/libz.dll
93 '';
94···101 dontStrip = stdenv.hostPlatform != stdenv.buildPlatform && static;
102 configurePlatforms = [];
103104+ installFlags = lib.optionals (stdenv.hostPlatform.libc == "msvcrt") [
105 "BINARY_PATH=$(out)/bin"
106 "INCLUDE_PATH=$(dev)/include"
107 "LIBRARY_PATH=$(out)/lib"
···112113 makeFlags = [
114 "PREFIX=${stdenv.cc.targetPrefix}"
115+ ] ++ lib.optionals (stdenv.hostPlatform.libc == "msvcrt") [
116 "-f" "win32/Makefile.gcc"
117 ] ++ lib.optionals shared [
118 # Note that as of writing (zlib 1.2.11), this flag only has an effect
···134 preConfigure = ''
135 export CHOST=${stdenv.hostPlatform.config}
136 '';
137+} // lib.optionalAttrs (stdenv.hostPlatform.libc == "msvcrt") {
138 dontConfigure = true;
139})
-5
pkgs/development/tools/misc/binutils/default.nix
···203 inherit targetPrefix;
204 hasGold = enableGold;
205 isGNU = true;
206- # TODO Currently platform.linker == "gold" has no effect outside
207- # of building GHC. If/when that's fixed, these flags should
208- # probably move to the invocations of bintools-wrapper
209- isGold = false;
210- isBfd = true;
211 };
212213 meta = with lib; {
···203 inherit targetPrefix;
204 hasGold = enableGold;
205 isGNU = true;
00000206 };
207208 meta = with lib; {
···1-From a18473ed4e5574dab899db640b8efeff78939b54 Mon Sep 17 00:00:00 2001
2-From: Manoj Gupta <manojgupta@chromium.org>
3-Date: Wed, 10 Oct 2018 10:50:23 +0300
4-Subject: [PATCH 1/2] Pick up clang_rt static archives compiler internal
5- libraries
6-7-Libtool checks only for libraries linked as -l* when trying to
8-find internal compiler libraries. Clang, however uses the absolute
9-path to link its internal libraries e.g. compiler_rt. This patch
10-handles clang's statically linked libraries when finding internal
11-compiler libraries.
12-https://crbug.com/749263
13-https://debbugs.gnu.org/cgi/bugreport.cgi?bug=27866
14----
15- m4/libtool.m4 | 2 +-
16- 1 file changed, 1 insertion(+), 1 deletion(-)
17-18-diff --git a/m4/libtool.m4 b/m4/libtool.m4
19-index b55a6e5..d9322d0 100644
20---- a/m4/libtool.m4
21-+++ b/m4/libtool.m4
22-@@ -7556,7 +7556,7 @@ if AC_TRY_EVAL(ac_compile); then
23- for p in `eval "$output_verbose_link_cmd"`; do
24- case $prev$p in
25-26-- -L* | -R* | -l*)
27-+ -L* | -R* | -l* | */libclang_rt.*.a)
28- # Some compilers place space between "-{L,R}" and the path.
29- # Remove the space.
30- if test x-L = "$p" ||
31---
32-2.7.4
33-
···17402 # These are used when buiding compiler-rt / libgcc, prior to building libc.
17403 preLibcCrossHeaders = let
17404 inherit (stdenv.targetPlatform) libc;
17405- in if libc == "msvcrt" || libc == "ucrt" then targetPackages.windows.mingw_w64_headers or windows.mingw_w64_headers
17406 else if libc == "nblibc" then targetPackages.netbsdCross.headers or netbsdCross.headers
17407 else if libc == "libSystem" && stdenv.targetPlatform.isAarch64 then targetPackages.darwin.LibsystemCross or darwin.LibsystemCross
17408 else null;
···17421 else if name == "newlib" then targetPackages.newlibCross or newlibCross
17422 else if name == "newlib-nano" then targetPackages.newlib-nanoCross or newlib-nanoCross
17423 else if name == "musl" then targetPackages.muslCross or muslCross
17424- else if name == "msvcrt" || name == "ucrt" then targetPackages.windows.mingw_w64 or windows.mingw_w64
17425 else if name == "libSystem" then
17426 if stdenv.targetPlatform.useiOSPrebuilt
17427 then targetPackages.darwin.iosSdkPkgs.libraries or darwin.iosSdkPkgs.libraries
···17402 # These are used when buiding compiler-rt / libgcc, prior to building libc.
17403 preLibcCrossHeaders = let
17404 inherit (stdenv.targetPlatform) libc;
17405+ in if libc == "msvcrt" then targetPackages.windows.mingw_w64_headers or windows.mingw_w64_headers
17406 else if libc == "nblibc" then targetPackages.netbsdCross.headers or netbsdCross.headers
17407 else if libc == "libSystem" && stdenv.targetPlatform.isAarch64 then targetPackages.darwin.LibsystemCross or darwin.LibsystemCross
17408 else null;
···17421 else if name == "newlib" then targetPackages.newlibCross or newlibCross
17422 else if name == "newlib-nano" then targetPackages.newlib-nanoCross or newlib-nanoCross
17423 else if name == "musl" then targetPackages.muslCross or muslCross
17424+ else if name == "msvcrt" then targetPackages.windows.mingw_w64 or windows.mingw_w64
17425 else if name == "libSystem" then
17426 if stdenv.targetPlatform.useiOSPrebuilt
17427 then targetPackages.darwin.iosSdkPkgs.libraries or darwin.iosSdkPkgs.libraries