From e27e475f0d7292f1ecb64c4f40de2d417b46f45a Mon Sep 17 00:00:00 2001 From: Michael Bishop Date: Fri, 5 Jun 2020 23:34:38 -0300 Subject: 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 --- pkgs/development/compilers/gcc/common/configure-flags.nix | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'pkgs/development/compilers/gcc') 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" ); -- cgit 1.4.1 From 58ffaee5d7d02058a1dd8644990b2f3b6c8a94ef Mon Sep 17 00:00:00 2001 From: Moritz Angermann Date: Mon, 8 Jun 2020 12:40:38 +0800 Subject: Update configure-flags.nix --- pkgs/development/compilers/gcc/common/configure-flags.nix | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'pkgs/development/compilers/gcc') diff --git a/pkgs/development/compilers/gcc/common/configure-flags.nix b/pkgs/development/compilers/gcc/common/configure-flags.nix index f38ce180b1f0..0560fe0fda80 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 @@ -60,7 +70,9 @@ let "--disable-debug" "--disable-win32-registry" ] ++ 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"}") @@ -87,9 +99,6 @@ let "--disable-nls" # 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" ); -- cgit 1.4.1 From f2a33e4486b40434241b964be5c685600c84c3a7 Mon Sep 17 00:00:00 2001 From: Moritz Angermann Date: Mon, 8 Jun 2020 12:43:58 +0800 Subject: Update configure-flags.nix --- pkgs/development/compilers/gcc/common/configure-flags.nix | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'pkgs/development/compilers/gcc') diff --git a/pkgs/development/compilers/gcc/common/configure-flags.nix b/pkgs/development/compilers/gcc/common/configure-flags.nix index 0560fe0fda80..7e0d691412b3 100644 --- a/pkgs/development/compilers/gcc/common/configure-flags.nix +++ b/pkgs/development/compilers/gcc/common/configure-flags.nix @@ -69,6 +69,11 @@ let "--with-gnu-ld" "--disable-debug" "--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" @@ -93,12 +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-hash-synchronization" - "--enable-libssp" - "--disable-nls" - # 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" ); -- cgit 1.4.1