about summary refs log tree commit diff
path: root/pkgs/development/compilers
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/compilers')
-rw-r--r--pkgs/development/compilers/emscripten-fastcomp/default.nix4
-rw-r--r--pkgs/development/compilers/gcc/7/default.nix19
-rw-r--r--pkgs/development/compilers/gcc/7/riscv-no-relax.patch109
-rw-r--r--pkgs/development/compilers/ghc/8.2.2.nix2
-rw-r--r--pkgs/development/compilers/ghc/8.4.1.nix5
-rw-r--r--pkgs/development/compilers/ghc/abi-depends-determinism.nix12
-rw-r--r--pkgs/development/compilers/go/1.10.nix3
-rw-r--r--pkgs/development/compilers/go/1.9.nix3
-rw-r--r--pkgs/development/compilers/iasl/default.nix4
-rw-r--r--pkgs/development/compilers/rust/default.nix6
-rw-r--r--pkgs/development/compilers/rust/rustc.nix6
-rw-r--r--pkgs/development/compilers/vala/default.nix4
-rw-r--r--pkgs/development/compilers/zig/default.nix11
13 files changed, 162 insertions, 26 deletions
diff --git a/pkgs/development/compilers/emscripten-fastcomp/default.nix b/pkgs/development/compilers/emscripten-fastcomp/default.nix
index 490dace2faaf..10c1107da026 100644
--- a/pkgs/development/compilers/emscripten-fastcomp/default.nix
+++ b/pkgs/development/compilers/emscripten-fastcomp/default.nix
@@ -1,4 +1,4 @@
-{ newScope, stdenv, binutils-raw, wrapCCWith, symlinkJoin }:
+{ newScope, stdenv, binutils, wrapCCWith, symlinkJoin }:
 let
   callPackage = newScope (self // {inherit stdenv;});
 
@@ -7,7 +7,7 @@ let
     emscriptenfastcomp-wrapped = wrapCCWith {
       cc = self.emscriptenfastcomp-unwrapped;
       # Never want Apple's cctools for WASM target
-      bintools = binutils-raw;
+      bintools = binutils;
       libc = stdenv.cc.libc;
       extraBuildCommands = ''
         # hardening flags break WASM support
diff --git a/pkgs/development/compilers/gcc/7/default.nix b/pkgs/development/compilers/gcc/7/default.nix
index 8e7cd3d3fab8..0b19aa95effe 100644
--- a/pkgs/development/compilers/gcc/7/default.nix
+++ b/pkgs/development/compilers/gcc/7/default.nix
@@ -57,16 +57,18 @@ let version = "7.3.0";
     enableParallelBuilding = true;
 
     patches =
-      [ ]
+      [ # https://gcc.gnu.org/ml/gcc-patches/2018-02/msg00633.html
+        ./riscv-pthread-reentrant.patch
+        # https://gcc.gnu.org/ml/gcc-patches/2018-03/msg00297.html
+        ./riscv-no-relax.patch
+      ]
       ++ optional (targetPlatform != hostPlatform) ../libstdc++-target.patch
       ++ optional noSysDirs ../no-sys-dirs.patch
       ++ optional (hostPlatform != buildPlatform) (fetchpatch { # XXX: Refine when this should be applied
         url = "https://git.busybox.net/buildroot/plain/package/gcc/7.1.0/0900-remove-selftests.patch?id=11271540bfe6adafbc133caf6b5b902a816f5f02";
         sha256 = "0mrvxsdwip2p3l17dscpc1x8vhdsciqw1z5q9i6p5g9yg1cqnmgs";
       })
-      ++ optional langFortran ../gfortran-driving.patch
-         # https://gcc.gnu.org/ml/gcc-patches/2018-02/msg00633.html
-      ++ optional targetPlatform.isRiscV ./riscv-pthread-reentrant.patch;
+      ++ optional langFortran ../gfortran-driving.patch;
 
     javaEcj = fetchurl {
       # The `$(top_srcdir)/ecj.jar' file is automatically picked up at
@@ -212,7 +214,12 @@ stdenv.mkDerivation ({
       --replace "-install_name \\\$rpath/\\\$soname" "-install_name $lib/lib/\\\$soname"
   '';
 
-  postPatch =
+  postPatch = ''
+    configureScripts=$(find . -name configure)
+    for configureScript in $configureScripts; do
+      patchShebangs $configureScript
+    done
+  '' + (
     if (hostPlatform.isHurd
         || (libcCross != null                  # e.g., building `gcc.crossDrv'
             && libcCross ? crossConfig
@@ -271,7 +278,7 @@ stdenv.mkDerivation ({
             sed -i gcc/config/linux.h -e '1i#undef LOCAL_INCLUDE_DIR'
         ''
         )
-    else null;
+    else "");
 
   # TODO(@Ericson2314): Make passthru instead. Weird to avoid mass rebuild,
   crossStageStatic = targetPlatform == hostPlatform || crossStageStatic;
diff --git a/pkgs/development/compilers/gcc/7/riscv-no-relax.patch b/pkgs/development/compilers/gcc/7/riscv-no-relax.patch
new file mode 100644
index 000000000000..93d9cd1d60f5
--- /dev/null
+++ b/pkgs/development/compilers/gcc/7/riscv-no-relax.patch
@@ -0,0 +1,109 @@
+commit e7c570f37384d824cb9725f237920e9691e57269
+gpg: Signature made Tue 06 Mar 2018 04:52:46 PM PST
+gpg:                using RSA key 00CE76D1834960DFCE886DF8EF4CA1502CCBAB41
+gpg:                issuer "palmer@dabbelt.com"
+gpg: Good signature from "Palmer Dabbelt <palmer@dabbelt.com>" [ultimate]
+gpg:                 aka "Palmer Dabbelt <palmer@sifive.com>" [ultimate]
+Author: Palmer Dabbelt <palmer@sifive.com>
+Date:   Thu Mar 1 12:01:06 2018 -0800
+
+    RISC-V: Add and document the "-mno-relax" option
+
+    RISC-V relies on aggressive linker relaxation to get good code size.  As
+    a result no text symbol addresses can be known until link time, which
+    means that alignment must be handled during the link.  This alignment
+    pass is essentially just another linker relaxation, so this has the
+    unfortunate side effect that linker relaxation is required for
+    correctness on many RISC-V targets.
+
+    The RISC-V assembler has supported an ".option norelax" for a long time
+    because there are situations in which linker relaxation is a bad idea --
+    the canonical example is when trying to materialize the initial value of
+    the global pointer into a register, which would otherwise be relaxed to
+    a NOP.  We've been relying on users who want to disable relaxation for
+    an entire link to pass "-Wl,--no-relax", but that still relies on the
+    linker relaxing R_RISCV_ALIGN to handle alignment despite it not being
+    strictly necessary.
+
+    This patch adds a GCC option, "-mno-relax", that disable linker
+    relaxation by adding ".option norelax" to the top of every generated
+    assembly file.  The assembler is smart enough to handle alignment at
+    assemble time for files that have never emitted a relaxable relocation,
+    so this is sufficient to really disable all relaxations in the linker,
+    which results in significantly faster link times for large objects.
+
+    This also has the side effect of allowing toolchains that don't support
+    linker relaxation (LLVM and the Linux module loader) to function
+    correctly.  Toolchains that don't support linker relaxation should
+    default to "-mno-relax" and error when presented with any R_RISCV_ALIGN
+    relocation as those need to be handled for correctness.
+
+    gcc/ChangeLog
+
+    2018-03-01  Palmer Dabbelt  <palmer@sifive.com>
+
+            * config/riscv/riscv.opt (mrelax): New option.
+            * config/riscv/riscv.c (riscv_file_start): Emit ".option
+            "norelax" when riscv_mrelax is disabled.
+            * doc/invoke.texi (RISC-V): Document "-mrelax" and "-mno-relax".
+
+diff --git a/gcc/config/riscv/riscv.c b/gcc/config/riscv/riscv.c
+index c38f6c394d54..3e81874de232 100644
+--- a/gcc/config/riscv/riscv.c
++++ b/gcc/config/riscv/riscv.c
+@@ -3979,6 +3979,11 @@ riscv_file_start (void)
+
+   /* Instruct GAS to generate position-[in]dependent code.  */
+   fprintf (asm_out_file, "\t.option %spic\n", (flag_pic ? "" : "no"));
++
++  /* If the user specifies "-mno-relax" on the command line then disable linker
++     relaxation in the assembler.  */
++  if (! riscv_mrelax)
++    fprintf (asm_out_file, "\t.option norelax\n");
+ }
+
+ /* Implement TARGET_ASM_OUTPUT_MI_THUNK.  Generate rtl rather than asm text
+diff --git a/gcc/config/riscv/riscv.opt b/gcc/config/riscv/riscv.opt
+index 581a26bb5c1e..b37ac75d9bb4 100644
+--- a/gcc/config/riscv/riscv.opt
++++ b/gcc/config/riscv/riscv.opt
+@@ -106,6 +106,11 @@ mexplicit-relocs
+ Target Report Mask(EXPLICIT_RELOCS)
+ Use %reloc() operators, rather than assembly macros, to load addresses.
+
++mrelax
++Target Bool Var(riscv_mrelax) Init(1)
++Take advantage of linker relaxations to reduce the number of instructions
++required to materialize symbol addresses.
++
+ Mask(64BIT)
+
+ Mask(MUL)
+diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
+index 8d366c626bae..deb48af2ecad 100644
+--- a/gcc/doc/invoke.texi
++++ b/gcc/doc/invoke.texi
+@@ -1042,7 +1042,8 @@ See RS/6000 and PowerPC Options.
+ -msave-restore  -mno-save-restore @gol
+ -mstrict-align -mno-strict-align @gol
+ -mcmodel=medlow -mcmodel=medany @gol
+--mexplicit-relocs  -mno-explicit-relocs @gol}
++-mexplicit-relocs  -mno-explicit-relocs @gol
++-mrelax -mno-relax @gol}
+
+ @emph{RL78 Options}
+ @gccoptlist{-msim  -mmul=none  -mmul=g13  -mmul=g14  -mallregs @gol
+@@ -23102,6 +23103,12 @@ Use or do not use assembler relocation operators when dealing with symbolic
+ addresses.  The alternative is to use assembler macros instead, which may
+ limit optimization.
+
++@item -mrelax
++@itemx -mno-relax
++Take advantage of linker relaxations to reduce the number of instructions
++required to materialize symbol addresses. The default is to take advantage of
++linker relaxations.
++
+ @end table
+
+ @node RL78 Options
+
diff --git a/pkgs/development/compilers/ghc/8.2.2.nix b/pkgs/development/compilers/ghc/8.2.2.nix
index 1c3f260da1c1..6520daa4d42c 100644
--- a/pkgs/development/compilers/ghc/8.2.2.nix
+++ b/pkgs/development/compilers/ghc/8.2.2.nix
@@ -4,6 +4,7 @@
 # build-tools
 , bootPkgs, alex, happy, hscolour
 , autoconf, autoreconfHook, automake, coreutils, fetchurl, fetchpatch, perl, python3, sphinx
+, runCommand
 
 , libffi, libiconv ? null, ncurses
 
@@ -89,6 +90,7 @@ stdenv.mkDerivation rec {
       url = "https://git.haskell.org/ghc.git/commitdiff_plain/2fc8ce5f0c8c81771c26266ac0b150ca9b75c5f3";
       sha256 = "03253ci40np1v6k0wmi4aypj3nmj3rdyvb1k6rwqipb30nfc719f";
     })
+    (import ./abi-depends-determinism.nix { inherit fetchpatch runCommand; })
   ] ++ stdenv.lib.optional deterministicProfiling
     (fetchpatch { # Backport of https://phabricator.haskell.org/D4388 for more determinism
       url = "https://github.com/shlevy/ghc/commit/fec1b8d3555c447c0d8da0e96b659be67c8bb4bc.patch";
diff --git a/pkgs/development/compilers/ghc/8.4.1.nix b/pkgs/development/compilers/ghc/8.4.1.nix
index dd0e5e4b0572..df23f660147a 100644
--- a/pkgs/development/compilers/ghc/8.4.1.nix
+++ b/pkgs/development/compilers/ghc/8.4.1.nix
@@ -4,6 +4,7 @@
 # build-tools
 , bootPkgs, alex, happy
 , autoconf, automake, coreutils, fetchgit, fetchpatch, perl, python3
+, runCommand
 
 , libffi, libiconv ? null, ncurses
 
@@ -85,7 +86,9 @@ stdenv.mkDerivation rec {
 
   outputs = [ "out" "doc" ];
 
-  patches = stdenv.lib.optional deterministicProfiling
+  patches = [
+    (import ./abi-depends-determinism.nix { inherit fetchpatch runCommand; })
+  ] ++ stdenv.lib.optional deterministicProfiling
     (fetchpatch { # https://phabricator.haskell.org/D4388 for more determinism
       url = "https://github.com/shlevy/ghc/commit/8b2dbd869d1a64de3e99fa8b1c9bb1140eee7099.patch";
       sha256 = "0hxpiwhbg64rsyjdr4psh6dwyp58b96mad3adccvfr0x8hc6ba2m";
diff --git a/pkgs/development/compilers/ghc/abi-depends-determinism.nix b/pkgs/development/compilers/ghc/abi-depends-determinism.nix
new file mode 100644
index 000000000000..bc803b74617f
--- /dev/null
+++ b/pkgs/development/compilers/ghc/abi-depends-determinism.nix
@@ -0,0 +1,12 @@
+# https://phabricator.haskell.org/D4159 to fix non-determinism in
+# cached abi-depends fields in package databases, modified to only
+# contain hunks that exist in distribution tarballs.
+{ fetchpatch, runCommand }: let
+  base = fetchpatch rec { # Non-determinism in cached abi-depends fields
+    # Originally https://phabricator-files.haskell.org/file/data/4pqrbo5b62sifktfbrls/PHID-FILE-4g4zjiqlfxmmlaos7lz7/D4159.diff
+    url = "http://tarballs.nixos.org/sha256/${sha256}";
+    name = "D4159.diff";
+    sha256 = "0b8a08sisf1swmarm6nh9rgw7cpzi2rwdzvrd6ny49c7wk0f7x4b";
+  };
+in runCommand base.name {}
+  "sed -n '/utils\\/ghc-pkg/,$p' ${base} >$out"
diff --git a/pkgs/development/compilers/go/1.10.nix b/pkgs/development/compilers/go/1.10.nix
index 173d7a32fdc6..7ba547552907 100644
--- a/pkgs/development/compilers/go/1.10.nix
+++ b/pkgs/development/compilers/go/1.10.nix
@@ -35,8 +35,7 @@ stdenv.mkDerivation rec {
   };
 
   # perl is used for testing go vet
-  nativeBuildInputs = [ perl which pkgconfig patch makeWrapper ]
-    ++ optionals stdenv.isLinux [ procps ];
+  nativeBuildInputs = [ perl which pkgconfig patch makeWrapper procps ];
   buildInputs = [ cacert pcre ]
     ++ optionals stdenv.isLinux [ stdenv.cc.libc.out ]
     ++ optionals (stdenv.hostPlatform.libc == "glibc") [ stdenv.cc.libc.static ];
diff --git a/pkgs/development/compilers/go/1.9.nix b/pkgs/development/compilers/go/1.9.nix
index 631e61c23053..829309f94268 100644
--- a/pkgs/development/compilers/go/1.9.nix
+++ b/pkgs/development/compilers/go/1.9.nix
@@ -35,8 +35,7 @@ stdenv.mkDerivation rec {
   };
 
   # perl is used for testing go vet
-  nativeBuildInputs = [ perl which pkgconfig patch makeWrapper ]
-    ++ optionals stdenv.isLinux [ procps ];
+  nativeBuildInputs = [ perl which pkgconfig patch makeWrapper procps ];
   buildInputs = [ cacert pcre ]
     ++ optionals stdenv.isLinux [ stdenv.cc.libc.out ]
     ++ optionals (stdenv.hostPlatform.libc == "glibc") [ stdenv.cc.libc.static ];
diff --git a/pkgs/development/compilers/iasl/default.nix b/pkgs/development/compilers/iasl/default.nix
index 5e0970ea12f4..22f80ae559f7 100644
--- a/pkgs/development/compilers/iasl/default.nix
+++ b/pkgs/development/compilers/iasl/default.nix
@@ -2,11 +2,11 @@
 
 stdenv.mkDerivation rec {
   name = "iasl-${version}";
-  version = "20170303";
+  version = "20180313";
 
   src = fetchurl {
     url = "https://acpica.org/sites/acpica/files/acpica-unix-${version}.tar.gz";
-    sha256 = "1dc933rr11gv1nlaf5j8ih1chdakbjbjkn34jgbm330zppmck4y0";
+    sha256 = "05ab2xfv9wqwbzjaa9xqgrvvan87rxv29hw48h1gcckpc5smp2wm";
   };
 
   NIX_CFLAGS_COMPILE = "-O3";
diff --git a/pkgs/development/compilers/rust/default.nix b/pkgs/development/compilers/rust/default.nix
index d9a36273ce1d..3f189249ccad 100644
--- a/pkgs/development/compilers/rust/default.nix
+++ b/pkgs/development/compilers/rust/default.nix
@@ -1,4 +1,5 @@
 { stdenv, callPackage, recurseIntoAttrs, makeRustPlatform, llvm, fetchurl
+, fetchpatch
 , targets ? []
 , targetToolchains ? []
 , targetPatches ? []
@@ -22,6 +23,11 @@ in rec {
 
     patches = [
       ./patches/0001-Disable-fragile-tests-libstd-net-tcp-on-Darwin-Linux.patch
+      # Adapted from https://github.com/rust-lang/rust/pull/47912
+      (fetchpatch {
+        url = "https://src.fedoraproject.org/rpms/rust/raw/1bb4d24c060915c304c9a9f86a438388e599f9c6/f/0002-Use-a-range-to-identify-SIGSEGV-in-stack-guards.patch";
+        sha256 = "16hc170qzzcb9lcabk0ln005zji2h1gq0knbr9avbbzlbg9jha2q";
+      })
     ] ++ stdenv.lib.optional stdenv.needsPax ./patches/grsec.patch
       # https://github.com/rust-lang/rust/issues/45410
       ++ stdenv.lib.optional stdenv.isAarch64 ./patches/aarch64-disable-test_loading_cosine.patch;
diff --git a/pkgs/development/compilers/rust/rustc.nix b/pkgs/development/compilers/rust/rustc.nix
index d7705aa89e8b..bb0794aeb84e 100644
--- a/pkgs/development/compilers/rust/rustc.nix
+++ b/pkgs/development/compilers/rust/rustc.nix
@@ -1,5 +1,5 @@
 { stdenv, targetPackages
-, fetchurl, fetchgit, fetchzip, file, python2, tzdata, procps
+, fetchurl, fetchgit, fetchzip, file, python2, tzdata, ps
 , llvm, jemalloc, ncurses, darwin, rustPlatform, git, cmake, curl
 , which, libffi, gdb
 , version
@@ -19,8 +19,6 @@ let
   inherit (stdenv.lib) optional optionalString;
   inherit (darwin.apple_sdk.frameworks) Security;
 
-  procps = if stdenv.isDarwin then darwin.ps else args.procps;
-
   llvmShared = llvm.override { enableSharedLibraries = true; };
 
   target = builtins.replaceStrings [" "] [","] (builtins.toString targets);
@@ -129,7 +127,7 @@ stdenv.mkDerivation {
 
   # ps is needed for one of the test cases
   nativeBuildInputs =
-    [ file python2 procps rustPlatform.rust.rustc git cmake
+    [ file python2 ps rustPlatform.rust.rustc git cmake
       which libffi
     ]
     # Only needed for the debuginfo tests
diff --git a/pkgs/development/compilers/vala/default.nix b/pkgs/development/compilers/vala/default.nix
index 6a020e11a4be..f36bea42e2a8 100644
--- a/pkgs/development/compilers/vala/default.nix
+++ b/pkgs/development/compilers/vala/default.nix
@@ -1,5 +1,5 @@
 { stdenv, fetchurl, pkgconfig, flex, bison, libxslt, autoconf, graphviz
-, glib, libiconv, libintlOrEmpty, libtool, expat
+, glib, libiconv, libintl, libtool, expat
 }:
 
 let
@@ -16,7 +16,7 @@ let
 
     nativeBuildInputs = [ pkgconfig flex bison libxslt ] ++ extraNativeBuildInputs;
 
-    buildInputs = [ glib libiconv ] ++ libintlOrEmpty ++ extraBuildInputs;
+    buildInputs = [ glib libiconv libintl ] ++ extraBuildInputs;
 
     meta = with stdenv.lib; {
       description = "Compiler for GObject type system";
diff --git a/pkgs/development/compilers/zig/default.nix b/pkgs/development/compilers/zig/default.nix
index cffc683f9e7b..44d1f7bfe4a2 100644
--- a/pkgs/development/compilers/zig/default.nix
+++ b/pkgs/development/compilers/zig/default.nix
@@ -1,17 +1,18 @@
-{ stdenv, fetchFromGitHub, cmake, llvmPackages }:
+{ stdenv, fetchFromGitHub, cmake, llvmPackages, libxml2 }:
 
 stdenv.mkDerivation rec {
-  version = "0.1.1";
+  version = "0.2.0";
   name = "zig-${version}";
 
   src = fetchFromGitHub {
     owner = "zig-lang";
     repo = "zig";
     rev = "${version}";
-    sha256 = "01yqjyi25f99bfmxxwyh45k7j84z0zg7n9jl8gg0draf96mzdh06";
+    sha256 = "0lym28z9mj6hfiq78x1fsd8y89h8xyfc1jgqyazi1g9r72427n07";
   };
 
-  buildInputs = [ cmake llvmPackages.clang-unwrapped llvmPackages.llvm ];
+  nativeBuildInputs = [ cmake ];
+  buildInputs = [ llvmPackages.clang-unwrapped llvmPackages.llvm libxml2 ];
 
   cmakeFlags = [
     "-DZIG_LIBC_INCLUDE_DIR=${stdenv.cc.libc_dev}/include"
@@ -26,7 +27,7 @@ stdenv.mkDerivation rec {
 
   meta = with stdenv.lib; {
     description = "Programming languaged designed for robustness, optimality, and clarity";
-    homepage = http://ziglang.org/;
+    homepage = https://ziglang.org/;
     license = licenses.mit;
     platforms = platforms.unix;
     maintainers = [ maintainers.andrewrk ];