diff options
Diffstat (limited to 'pkgs/development/compilers/gcc')
-rw-r--r-- | pkgs/development/compilers/gcc/10/default.nix | 4 | ||||
-rw-r--r-- | pkgs/development/compilers/gcc/4.8/default.nix | 4 | ||||
-rw-r--r-- | pkgs/development/compilers/gcc/4.9/default.nix | 4 | ||||
-rw-r--r-- | pkgs/development/compilers/gcc/6/default.nix | 4 | ||||
-rw-r--r-- | pkgs/development/compilers/gcc/7/default.nix | 4 | ||||
-rw-r--r-- | pkgs/development/compilers/gcc/8/default.nix | 4 | ||||
-rw-r--r-- | pkgs/development/compilers/gcc/9/default.nix | 4 | ||||
-rw-r--r-- | pkgs/development/compilers/gcc/builder.sh | 48 | ||||
-rw-r--r-- | pkgs/development/compilers/gcc/common/configure-flags.nix | 28 | ||||
-rw-r--r-- | pkgs/development/compilers/gcc/common/extra-target-flags.nix | 4 | ||||
-rw-r--r-- | pkgs/development/compilers/gcc/libstdc++-hook.sh | 2 |
11 files changed, 60 insertions, 50 deletions
diff --git a/pkgs/development/compilers/gcc/10/default.nix b/pkgs/development/compilers/gcc/10/default.nix index 4a4cfce5cc47..ae723a145313 100644 --- a/pkgs/development/compilers/gcc/10/default.nix +++ b/pkgs/development/compilers/gcc/10/default.nix @@ -239,8 +239,8 @@ stdenv.mkDerivation ({ (import ../common/extra-target-flags.nix { inherit stdenv crossStageStatic libcCross threadsCross; }) - EXTRA_TARGET_FLAGS - EXTRA_TARGET_LDFLAGS + EXTRA_FLAGS_FOR_TARGET + EXTRA_LDFLAGS_FOR_TARGET ; passthru = { diff --git a/pkgs/development/compilers/gcc/4.8/default.nix b/pkgs/development/compilers/gcc/4.8/default.nix index b35b69e87e1e..6a2c506b1bf3 100644 --- a/pkgs/development/compilers/gcc/4.8/default.nix +++ b/pkgs/development/compilers/gcc/4.8/default.nix @@ -264,8 +264,8 @@ stdenv.mkDerivation ({ (import ../common/extra-target-flags.nix { inherit stdenv crossStageStatic libcCross threadsCross; }) - EXTRA_TARGET_FLAGS - EXTRA_TARGET_LDFLAGS + EXTRA_FLAGS_FOR_TARGET + EXTRA_LDFLAGS_FOR_TARGET ; passthru = { diff --git a/pkgs/development/compilers/gcc/4.9/default.nix b/pkgs/development/compilers/gcc/4.9/default.nix index f7fbe1ec554b..0a35ed023c6f 100644 --- a/pkgs/development/compilers/gcc/4.9/default.nix +++ b/pkgs/development/compilers/gcc/4.9/default.nix @@ -276,8 +276,8 @@ stdenv.mkDerivation ({ (import ../common/extra-target-flags.nix { inherit stdenv crossStageStatic libcCross threadsCross; }) - EXTRA_TARGET_FLAGS - EXTRA_TARGET_LDFLAGS + EXTRA_FLAGS_FOR_TARGET + EXTRA_LDFLAGS_FOR_TARGET ; passthru = { diff --git a/pkgs/development/compilers/gcc/6/default.nix b/pkgs/development/compilers/gcc/6/default.nix index 173ca128ee0b..f3b15eac55d2 100644 --- a/pkgs/development/compilers/gcc/6/default.nix +++ b/pkgs/development/compilers/gcc/6/default.nix @@ -292,8 +292,8 @@ stdenv.mkDerivation ({ (import ../common/extra-target-flags.nix { inherit stdenv crossStageStatic libcCross threadsCross; }) - EXTRA_TARGET_FLAGS - EXTRA_TARGET_LDFLAGS + EXTRA_FLAGS_FOR_TARGET + EXTRA_LDFLAGS_FOR_TARGET ; passthru = { diff --git a/pkgs/development/compilers/gcc/7/default.nix b/pkgs/development/compilers/gcc/7/default.nix index 9153268a12b3..89933c22edd4 100644 --- a/pkgs/development/compilers/gcc/7/default.nix +++ b/pkgs/development/compilers/gcc/7/default.nix @@ -247,8 +247,8 @@ stdenv.mkDerivation ({ (import ../common/extra-target-flags.nix { inherit stdenv crossStageStatic libcCross threadsCross; }) - EXTRA_TARGET_FLAGS - EXTRA_TARGET_LDFLAGS + EXTRA_FLAGS_FOR_TARGET + EXTRA_LDFLAGS_FOR_TARGET ; passthru = { diff --git a/pkgs/development/compilers/gcc/8/default.nix b/pkgs/development/compilers/gcc/8/default.nix index e3091a062be8..5a6e20c0f412 100644 --- a/pkgs/development/compilers/gcc/8/default.nix +++ b/pkgs/development/compilers/gcc/8/default.nix @@ -234,8 +234,8 @@ stdenv.mkDerivation ({ (import ../common/extra-target-flags.nix { inherit stdenv crossStageStatic libcCross threadsCross; }) - EXTRA_TARGET_FLAGS - EXTRA_TARGET_LDFLAGS + EXTRA_FLAGS_FOR_TARGET + EXTRA_LDFLAGS_FOR_TARGET ; passthru = { diff --git a/pkgs/development/compilers/gcc/9/default.nix b/pkgs/development/compilers/gcc/9/default.nix index fadfdfa47a89..978ad75a3d26 100644 --- a/pkgs/development/compilers/gcc/9/default.nix +++ b/pkgs/development/compilers/gcc/9/default.nix @@ -242,8 +242,8 @@ stdenv.mkDerivation ({ (import ../common/extra-target-flags.nix { inherit stdenv crossStageStatic langD libcCross threadsCross; }) - EXTRA_TARGET_FLAGS - EXTRA_TARGET_LDFLAGS + EXTRA_FLAGS_FOR_TARGET + EXTRA_LDFLAGS_FOR_TARGET ; passthru = { diff --git a/pkgs/development/compilers/gcc/builder.sh b/pkgs/development/compilers/gcc/builder.sh index b806f5a6e503..4b14cdb94cdd 100644 --- a/pkgs/development/compilers/gcc/builder.sh +++ b/pkgs/development/compilers/gcc/builder.sh @@ -25,12 +25,12 @@ echo "\$LIBRARY_PATH is \`${LIBRARY_PATH-}'" if test "$noSysDirs" = "1"; then declare \ - EXTRA_BUILD_FLAGS EXTRA_FLAGS EXTRA_TARGET_FLAGS \ - EXTRA_BUILD_LDFLAGS EXTRA_TARGET_LDFLAGS + EXTRA_FLAGS_FOR_BUILD EXTRA_FLAGS EXTRA_FLAGS_FOR_TARGET \ + EXTRA_LDFLAGS_FOR_BUILD EXTRA_LDFLAGS_FOR_TARGET # Extract flags from Bintools Wrappers - for pre in 'BUILD_' ''; do - curBintools="NIX_${pre}BINTOOLS" + for post in '_FOR_BUILD' ''; do + curBintools="NIX_BINTOOLS${post}" declare -a extraLDFlags=() if [[ -e "${!curBintools}/nix-support/orig-libc" ]]; then @@ -48,14 +48,14 @@ if test "$noSysDirs" = "1"; then extraLDFlags=("-L$libc_libdir" "-rpath" "$libc_libdir" "${extraLDFlags[@]}") for i in "${extraLDFlags[@]}"; do - declare EXTRA_${pre}LDFLAGS+=" -Wl,$i" + declare EXTRA_LDFLAGS${post}+=" -Wl,$i" done done # Extract flags from CC Wrappers - for pre in 'BUILD_' ''; do - curCC="NIX_${pre}CC" - curFIXINC="NIX_${pre}FIXINC_DUMMY" + for post in '_FOR_BUILD' ''; do + curCC="NIX_CC${post}" + curFIXINC="NIX_FIXINC_DUMMY${post}" declare -a extraFlags=() if [[ -e "${!curCC}/nix-support/orig-libc" ]]; then @@ -69,11 +69,11 @@ if test "$noSysDirs" = "1"; then # Use *real* header files, otherwise a limits.h is generated that # does not include Libc's limits.h (notably missing SSIZE_MAX, # which breaks the build). - declare NIX_${pre}FIXINC_DUMMY="$libc_devdir/include" + declare NIX_FIXINC_DUMMY${post}="$libc_devdir/include" else # Hack: support impure environments. extraFlags=("-isystem" "/usr/include") - declare NIX_${pre}FIXINC_DUMMY=/usr/include + declare NIX_FIXINC_DUMMY${post}=/usr/include fi extraFlags=("-I${!curFIXINC}" "${extraFlags[@]}") @@ -89,13 +89,13 @@ if test "$noSysDirs" = "1"; then extraFlags=("-O2" "${extraFlags[@]}") fi - declare EXTRA_${pre}FLAGS="${extraFlags[*]}" + declare EXTRA_FLAGS${post}="${extraFlags[*]}" done if test -z "${targetConfig-}"; then # host = target, so the flags are the same - EXTRA_TARGET_FLAGS="$EXTRA_FLAGS" - EXTRA_TARGET_LDFLAGS="$EXTRA_LDFLAGS" + EXTRA_FLAGS_FOR_TARGET="$EXTRA_FLAGS" + EXTRA_LDFLAGS_FOR_TARGET="$EXTRA_LDFLAGS" fi # CFLAGS_FOR_TARGET are needed for the libstdc++ configure script to find @@ -103,31 +103,31 @@ if test "$noSysDirs" = "1"; then # FLAGS_FOR_TARGET are needed for the target libraries to receive the -Bxxx # for the startfiles. makeFlagsArray+=( - "BUILD_SYSTEM_HEADER_DIR=$NIX_BUILD_FIXINC_DUMMY" - "SYSTEM_HEADER_DIR=$NIX_BUILD_FIXINC_DUMMY" + "BUILD_SYSTEM_HEADER_DIR=$NIX_FIXINC_DUMMY_FOR_BUILD" + "SYSTEM_HEADER_DIR=$NIX_FIXINC_DUMMY_FOR_BUILD" "NATIVE_SYSTEM_HEADER_DIR=$NIX_FIXINC_DUMMY" - "LDFLAGS_FOR_BUILD=$EXTRA_BUILD_LDFLAGS" + "LDFLAGS_FOR_BUILD=$EXTRA_LDFLAGS_FOR_BUILD" #"LDFLAGS=$EXTRA_LDFLAGS" - "LDFLAGS_FOR_TARGET=$EXTRA_TARGET_LDFLAGS" + "LDFLAGS_FOR_TARGET=$EXTRA_LDFLAGS_FOR_TARGET" - "CFLAGS_FOR_BUILD=$EXTRA_BUILD_FLAGS $EXTRA_BUILD_LDFLAGS" - "CXXFLAGS_FOR_BUILD=$EXTRA_BUILD_FLAGS $EXTRA_BUILD_LDFLAGS" - "FLAGS_FOR_BUILD=$EXTRA_BUILD_FLAGS $EXTRA_BUILD_LDFLAGS" + "CFLAGS_FOR_BUILD=$EXTRA_FLAGS_FOR_BUILD $EXTRA_LDFLAGS_FOR_BUILD" + "CXXFLAGS_FOR_BUILD=$EXTRA_FLAGS_FOR_BUILD $EXTRA_LDFLAGS_FOR_BUILD" + "FLAGS_FOR_BUILD=$EXTRA_FLAGS_FOR_BUILD $EXTRA_LDFLAGS_FOR_BUILD" # It seems there is a bug in GCC 5 #"CFLAGS=$EXTRA_FLAGS $EXTRA_LDFLAGS" #"CXXFLAGS=$EXTRA_FLAGS $EXTRA_LDFLAGS" - "CFLAGS_FOR_TARGET=$EXTRA_TARGET_FLAGS $EXTRA_TARGET_LDFLAGS" - "CXXFLAGS_FOR_TARGET=$EXTRA_TARGET_FLAGS $EXTRA_TARGET_LDFLAGS" - "FLAGS_FOR_TARGET=$EXTRA_TARGET_FLAGS $EXTRA_TARGET_LDFLAGS" + "CFLAGS_FOR_TARGET=$EXTRA_FLAGS_FOR_TARGET $EXTRA_LDFLAGS_FOR_TARGET" + "CXXFLAGS_FOR_TARGET=$EXTRA_FLAGS_FOR_TARGET $EXTRA_LDFLAGS_FOR_TARGET" + "FLAGS_FOR_TARGET=$EXTRA_FLAGS_FOR_TARGET $EXTRA_LDFLAGS_FOR_TARGET" ) if test -z "${targetConfig-}"; then makeFlagsArray+=( "BOOT_CFLAGS=$EXTRA_FLAGS $EXTRA_LDFLAGS" - "BOOT_LDFLAGS=$EXTRA_TARGET_FLAGS $EXTRA_TARGET_LDFLAGS" + "BOOT_LDFLAGS=$EXTRA_FLAGS_FOR_TARGET $EXTRA_LDFLAGS_FOR_TARGET" ) fi diff --git a/pkgs/development/compilers/gcc/common/configure-flags.nix b/pkgs/development/compilers/gcc/common/configure-flags.nix index be7f3df42de9..7e0d691412b3 100644 --- a/pkgs/development/compilers/gcc/common/configure-flags.nix +++ b/pkgs/development/compilers/gcc/common/configure-flags.nix @@ -27,6 +27,16 @@ assert cloog != null -> stdenv.lib.versionOlder version "5"; assert langJava -> stdenv.lib.versionOlder version "7"; +# Note [Windows Exception Handling] +# sjlj (short jump long jump) exception handling makes no sense on x86_64, +# it's forcably slowing programs down as it produces a constant overhead. +# On x86_64 we have SEH (Structured Exception Handling) and we should use +# that. On i686, we do not have SEH, and have to use sjlj with dwarf2. +# Hence it's now conditional on x86_32 (i686 is 32bit). +# +# ref: https://stackoverflow.com/questions/15670169/what-is-difference-between-sjlj-vs-dwarf-vs-seh + + let inherit (stdenv) buildPlatform hostPlatform targetPlatform @@ -58,8 +68,16 @@ let "--with-gnu-as" "--with-gnu-ld" "--disable-debug" - "--enable-sjlj-exceptions" "--disable-win32-registry" + "--enable-hash-synchronization" + "--enable-libssp" + "--disable-nls" + # To keep ABI compatibility with upstream mingw-w64 + "--enable-fully-dynamic-string" + ] ++ lib.optionals (crossMingw && targetPlatform.isx86_32) [ + # See Note [Windows Exception Handling] + "--enable-sjlj-exceptions" + "--with-dwarf2" ] else [ (if crossDarwin then "--with-sysroot=${lib.getLib libcCross}/share/sysroot" else "--with-headers=${lib.getDev libcCross}${libcCross.incdir or "/include"}") @@ -80,14 +98,6 @@ let ] ++ lib.optionals (targetPlatform.libc == "musl") [ # musl at least, disable: https://git.buildroot.net/buildroot/commit/?id=873d4019f7fb00f6a80592224236b3ba7d657865 "--disable-libmpx" - ] ++ lib.optionals crossMingw [ - "--enable-sjlj-exceptions" - "--enable-hash-synchronization" - "--enable-libssp" - "--disable-nls" - "--with-dwarf2" - # To keep ABI compatibility with upstream mingw-w64 - "--enable-fully-dynamic-string" ] ++ lib.optional (targetPlatform.libc == "newlib") "--with-newlib" ++ lib.optional (targetPlatform.libc == "avrlibc") "--with-avrlibc" ); diff --git a/pkgs/development/compilers/gcc/common/extra-target-flags.nix b/pkgs/development/compilers/gcc/common/extra-target-flags.nix index 62d9818ca957..0a5a7a1bc1cb 100644 --- a/pkgs/development/compilers/gcc/common/extra-target-flags.nix +++ b/pkgs/development/compilers/gcc/common/extra-target-flags.nix @@ -8,7 +8,7 @@ in # For non-cross builds these flags are currently assigned in builder.sh. # It would be good to consolidate the generation of makeFlags # ({C,CXX,LD}FLAGS_FOR_{BUILD,TARGET}, etc...) at some point. - EXTRA_TARGET_FLAGS = let + EXTRA_FLAGS_FOR_TARGET = let mkFlags = dep: langD: lib.optionals (targetPlatform != hostPlatform && dep != null && !langD) ([ "-O2 -idirafter ${lib.getDev dep}${dep.incdir or "/include"}" ] ++ stdenv.lib.optionals (! crossStageStatic) [ @@ -18,7 +18,7 @@ in ++ lib.optionals (!crossStageStatic) (mkFlags threadsCross langD) ; - EXTRA_TARGET_LDFLAGS = let + EXTRA_LDFLAGS_FOR_TARGET = let mkFlags = dep: lib.optionals (targetPlatform != hostPlatform && dep != null) ([ "-Wl,-L${lib.getLib dep}${dep.libdir or "/lib"}" ] ++ (if crossStageStatic then [ diff --git a/pkgs/development/compilers/gcc/libstdc++-hook.sh b/pkgs/development/compilers/gcc/libstdc++-hook.sh index 60c610a8e7a8..f5b4123b64d9 100644 --- a/pkgs/development/compilers/gcc/libstdc++-hook.sh +++ b/pkgs/development/compilers/gcc/libstdc++-hook.sh @@ -1,4 +1,4 @@ # See pkgs/build-support/setup-hooks/role.bash getHostRole -export NIX_${role_pre}CXXSTDLIB_COMPILE+=" -isystem $(echo -n @gcc@/include/c++/*) -isystem $(echo -n @gcc@/include/c++/*)/@targetConfig@" +export NIX_CXXSTDLIB_COMPILE${role_post}+=" -isystem $(echo -n @gcc@/include/c++/*) -isystem $(echo -n @gcc@/include/c++/*)/@targetConfig@" |