Skip to content

Commit

Permalink
ghc: compile with DWARF support by default
Browse files Browse the repository at this point in the history
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 #15960
(Using -g causes differences in generated core) is fixed.
  • Loading branch information
domenkozar authored and peti committed Sep 11, 2019
1 parent f2bf25e commit f431647
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 6 deletions.
7 changes: 6 additions & 1 deletion pkgs/development/compilers/ghc/8.2.2.nix
Expand Up @@ -8,6 +8,8 @@

, libiconv ? null, ncurses

, enableDwarf ? !stdenv.isDarwin, elfutils # for DWARF support

, useLLVM ? !stdenv.targetPlatform.isx86 || (stdenv.targetPlatform.isMusl && stdenv.hostPlatform != stdenv.targetPlatform)
, # LLVM is conceptually a run-time-only depedendency, but for
# non-x86, we need LLVM to bootstrap later stages, so it becomes a
Expand Down Expand Up @@ -69,7 +71,8 @@ let
# Splicer will pull out correct variations
libDeps = platform: [ ncurses ]
++ stdenv.lib.optional (!enableIntegerSimple) gmp
++ stdenv.lib.optional (platform.libc != "glibc") libiconv;
++ stdenv.lib.optional (platform.libc != "glibc") libiconv
++ stdenv.lib.optional enableDwarf elfutils;

toolsForTarget = [
pkgsBuildTarget.targetPackages.stdenv.cc
Expand Down Expand Up @@ -203,6 +206,8 @@ stdenv.mkDerivation (rec {
] ++ stdenv.lib.optionals (targetPlatform.isDarwin && targetPlatform.isAarch64) [
# fix for iOS: https://www.reddit.com/r/haskell/comments/4ttdz1/building_an_osxi386_to_iosarm64_cross_compiler/d5qvd67/
"--disable-large-address-space"
] ++ stdenv.lib.optional enableDwarf [
"--enable-dwarf-unwind"
];

# Don’t add -liconv to LDFLAGS automatically so that GHC will add it itself.
Expand Down
7 changes: 6 additions & 1 deletion pkgs/development/compilers/ghc/8.4.4.nix
Expand Up @@ -7,6 +7,8 @@

, libiconv ? null, ncurses

, enableDwarf ? !stdenv.isDarwin, elfutils # for DWARF support

, useLLVM ? !stdenv.targetPlatform.isx86 || (stdenv.targetPlatform.isMusl && stdenv.hostPlatform != stdenv.targetPlatform)
, # LLVM is conceptually a run-time-only depedendency, but for
# non-x86, we need LLVM to bootstrap later stages, so it becomes a
Expand Down Expand Up @@ -71,7 +73,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
Expand Down Expand Up @@ -180,6 +183,8 @@ stdenv.mkDerivation (rec {
] ++ stdenv.lib.optionals (targetPlatform.isDarwin && targetPlatform.isAarch64) [
# fix for iOS: https://www.reddit.com/r/haskell/comments/4ttdz1/building_an_osxi386_to_iosarm64_cross_compiler/d5qvd67/
"--disable-large-address-space"
] ++ stdenv.lib.optional enableDwarf [
"--enable-dwarf-unwind"
];

# Make sure we never relax`$PATH` and hooks support for compatability.
Expand Down
7 changes: 6 additions & 1 deletion pkgs/development/compilers/ghc/8.6.4.nix
Expand Up @@ -7,6 +7,8 @@

, libiconv ? null, ncurses

, enableDwarf ? !stdenv.isDarwin, elfutils # for DWARF support

, # GHC can be built with system libffi or a bundled one.
libffi ? null

Expand Down Expand Up @@ -76,7 +78,8 @@ let
libDeps = platform: stdenv.lib.optional enableTerminfo [ ncurses ]
++ [libffi]
++ 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
Expand Down Expand Up @@ -179,6 +182,8 @@ 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"
];

# Make sure we never relax`$PATH` and hooks support for compatability.
Expand Down
7 changes: 6 additions & 1 deletion pkgs/development/compilers/ghc/8.6.5.nix
Expand Up @@ -7,6 +7,8 @@

, libiconv ? null, ncurses

, enableDwarf ? !stdenv.isDarwin, elfutils # for DWARF support

, # GHC can be built with system libffi or a bundled one.
libffi ? null

Expand Down Expand Up @@ -76,7 +78,8 @@ let
libDeps = platform: stdenv.lib.optional enableTerminfo [ ncurses ]
++ [libffi]
++ 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
Expand Down Expand Up @@ -179,6 +182,8 @@ 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"
];

# Make sure we never relax`$PATH` and hooks support for compatability.
Expand Down
7 changes: 6 additions & 1 deletion pkgs/development/compilers/ghc/8.8.1.nix
Expand Up @@ -7,6 +7,8 @@

, libiconv ? null, ncurses

, enableDwarf ? !stdenv.isDarwin, elfutils # for DWARF support

, # GHC can be built with system libffi or a bundled one.
libffi ? null

Expand Down Expand Up @@ -76,7 +78,8 @@ let
libDeps = platform: stdenv.lib.optional enableTerminfo [ ncurses ]
++ [libffi]
++ 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
Expand Down Expand Up @@ -164,6 +167,8 @@ 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"
];

# Make sure we never relax`$PATH` and hooks support for compatability.
Expand Down
7 changes: 6 additions & 1 deletion pkgs/development/compilers/ghc/head.nix
Expand Up @@ -7,6 +7,8 @@

, libiconv ? null, ncurses

, enableDwarf ? !stdenv.isDarwin, 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
Expand Down Expand Up @@ -73,7 +75,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
Expand Down Expand Up @@ -176,6 +179,8 @@ 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"
];

# Make sure we never relax`$PATH` and hooks support for compatability.
Expand Down

0 comments on commit f431647

Please sign in to comment.