From 72170904646a3867963728c503cdb2857964d0fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Domen=20Ko=C5=BEar?= Date: Tue, 5 Nov 2019 19:33:15 +0100 Subject: [PATCH] ghc: compile with DWARF support by default This allows our GHCs to build programs with DWARF debug information when -g is passed, see https://ghc.haskell.org/trac/ghc/wiki/DWARF. Compiling with debug symbols is off by default until GHC ticket https://gitlab.haskell.org/ghc/ghc/issues/15960 (Using -g causes differences in generated core) is fixed. --- pkgs/development/compilers/ghc/head.nix | 27 +++++++++++++------------ 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/pkgs/development/compilers/ghc/head.nix b/pkgs/development/compilers/ghc/head.nix index 565c545e48c..0e73f81fbab 100644 --- a/pkgs/development/compilers/ghc/head.nix +++ b/pkgs/development/compilers/ghc/head.nix @@ -2,11 +2,14 @@ # build-tools , bootPkgs -, autoconf, automake, coreutils, fetchgit, fetchpatch, perl, python3, m4, sphinx +, autoconf, autoreconfHook, automake, coreutils, fetchgit, fetchpatch, perl, python3, m4, sphinx , bash , libiconv ? null, ncurses +, enableDwarf ? !stdenv.targetPlatform.isDarwin && + !stdenv.targetPlatform.isWindows, elfutils # for DWARF support + , useLLVM ? !stdenv.targetPlatform.isx86 , # LLVM is conceptually a run-time-only depedendency, but for # non-x86, we need LLVM to bootstrap later stages, so it becomes a @@ -27,7 +30,7 @@ , # Whetherto build terminfo. enableTerminfo ? !stdenv.targetPlatform.isWindows -, version ? "8.9.20190924" +, version ? "8.10.20191119" , # What flavour to build. An empty string indicates no # specific flavour and falls back to ghc default values. ghcFlavour ? stdenv.lib.optionalString (stdenv.targetPlatform != stdenv.hostPlatform) @@ -73,7 +76,8 @@ let # Splicer will pull out correct variations libDeps = platform: stdenv.lib.optional enableTerminfo [ ncurses ] ++ stdenv.lib.optional (!enableIntegerSimple) gmp - ++ stdenv.lib.optional (platform.libc != "glibc" && !targetPlatform.isWindows) libiconv; + ++ stdenv.lib.optional (platform.libc != "glibc" && !targetPlatform.isWindows) libiconv + ++ stdenv.lib.optional enableDwarf elfutils; toolsForTarget = [ pkgsBuildTarget.targetPackages.stdenv.cc @@ -89,8 +93,8 @@ stdenv.mkDerivation (rec { src = fetchgit { url = "https://gitlab.haskell.org/ghc/ghc.git/"; - rev = "795986aaf33e2ffc233836b86a92a77366c91db2"; - sha256 = "0a111x6c53r07q5qdg6c8mnydqp0wh4mpxmw7ga4x5wlap8i0bji"; + rev = "0418c38d55c7a47967187dce2db5ea2ab1021b1e"; + sha256 = "1d8g30ii0w4xh6fh61bxbalsqqyanny99nn3p727fx7favnhgvxi"; }; enableParallelBuilding = true; @@ -98,13 +102,6 @@ stdenv.mkDerivation (rec { outputs = [ "out" "doc" ]; patches = [ - (fetchpatch { # https://github.com/haskell/haddock/issues/900 - url = "https://patch-diff.githubusercontent.com/raw/haskell/haddock/pull/983.diff"; - name = "loadpluginsinmodules.diff"; - sha256 = "0bvvv0zsfq2581zsir97zfkggc1kkircbbajc2fz3b169ycpbha1"; - extraPrefix = "utils/haddock/"; - stripLen = 1; - }) ]; postPatch = "patchShebangs ."; @@ -176,13 +173,17 @@ stdenv.mkDerivation (rec { "CONF_GCC_LINKER_OPTS_STAGE2=-fuse-ld=gold" ] ++ stdenv.lib.optionals (disableLargeAddressSpace) [ "--disable-large-address-space" + ] ++ stdenv.lib.optional enableDwarf [ + "--enable-dwarf-unwind" + "--with-libdw-includes=${stdenv.lib.getDev elfutils}/include" + "--with-libdw-libraries=${stdenv.lib.getLib elfutils}/lib" ]; # Make sure we never relax`$PATH` and hooks support for compatability. strictDeps = true; nativeBuildInputs = [ - perl autoconf automake m4 python3 sphinx + perl autoconf autoreconfHook automake m4 python3 sphinx ghc bootPkgs.alex bootPkgs.happy bootPkgs.hscolour ];