Skip to content

Commit

Permalink
rust: fix rust cross-compile
Browse files Browse the repository at this point in the history
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
  • Loading branch information
cleverca22 committed Jun 6, 2020
1 parent dd8f077 commit e27e475
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions pkgs/development/compilers/gcc/common/configure-flags.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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"}")
Expand All @@ -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"
);
Expand Down

0 comments on commit e27e475

Please sign in to comment.