about summary refs log tree commit diff
path: root/pkgs/development/compilers/gcc
diff options
context:
space:
mode:
authorMichael Bishop <cleverca22@gmail.com>2020-06-05 23:34:38 -0300
committerMichael Bishop <cleverca22@gmail.com>2020-06-05 23:34:38 -0300
commite27e475f0d7292f1ecb64c4f40de2d417b46f45a (patch)
treef2f1bc174d9f09a6f1b173247bbfa7e8e82b2492 /pkgs/development/compilers/gcc
parentdd8f077ff90efa200970855acab12cf4e49b3ea9 (diff)
downloadnixlib-e27e475f0d7292f1ecb64c4f40de2d417b46f45a.tar
nixlib-e27e475f0d7292f1ecb64c4f40de2d417b46f45a.tar.gz
nixlib-e27e475f0d7292f1ecb64c4f40de2d417b46f45a.tar.bz2
nixlib-e27e475f0d7292f1ecb64c4f40de2d417b46f45a.tar.lz
nixlib-e27e475f0d7292f1ecb64c4f40de2d417b46f45a.tar.xz
nixlib-e27e475f0d7292f1ecb64c4f40de2d417b46f45a.tar.zst
nixlib-e27e475f0d7292f1ecb64c4f40de2d417b46f45a.zip
rust: fix rust cross-compile
reasoning:
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
Diffstat (limited to 'pkgs/development/compilers/gcc')
-rw-r--r--pkgs/development/compilers/gcc/common/configure-flags.nix8
1 files changed, 5 insertions, 3 deletions
diff --git a/pkgs/development/compilers/gcc/common/configure-flags.nix b/pkgs/development/compilers/gcc/common/configure-flags.nix
index be7f3df42de9..f38ce180b1f0 100644
--- a/pkgs/development/compilers/gcc/common/configure-flags.nix
+++ b/pkgs/development/compilers/gcc/common/configure-flags.nix
@@ -58,8 +58,9 @@ let
       "--with-gnu-as"
       "--with-gnu-ld"
       "--disable-debug"
-      "--enable-sjlj-exceptions"
       "--disable-win32-registry"
+    ] ++ lib.optionals (crossMingw && targetPlatform.isx86_32) [
+      "--enable-sjlj-exceptions"
     ] else [
       (if crossDarwin then "--with-sysroot=${lib.getLib libcCross}/share/sysroot"
        else                "--with-headers=${lib.getDev libcCross}${libcCross.incdir or "/include"}")
@@ -81,13 +82,14 @@ let
       # 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.optionals (crossMingw && targetPlatform.isx86_32) [
+      "--enable-sjlj-exceptions"
+      "--with-dwarf2"
     ] ++ lib.optional (targetPlatform.libc == "newlib") "--with-newlib"
       ++ lib.optional (targetPlatform.libc == "avrlibc") "--with-avrlibc"
     );