Skip to content

Commit

Permalink
Enable debug info on linux targets
Browse files Browse the repository at this point in the history
  • Loading branch information
hamishmack committed Feb 19, 2021
1 parent 42b1067 commit 53d8344
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
5 changes: 4 additions & 1 deletion compiler/ghc/configured-src.nix
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
, useLLVM, llvmPackages
, targetCC
, enableIntegerSimple, targetGmp
, enableDebug
, ncurses, targetLibffi, libiconv
, disableLargeAddressSpace
, buildMK
Expand Down Expand Up @@ -112,7 +113,9 @@ stdenv.mkDerivation (rec {
"CFLAGS=-fuse-ld=gold"
"CONF_GCC_LINKER_OPTS_STAGE1=-fuse-ld=gold"
"CONF_GCC_LINKER_OPTS_STAGE2=-fuse-ld=gold"
] ;
] ++ lib.optionals enableDebug [
"--enable-dwarf-unwind"
];

outputs = [ "out" ];
phases = [ "unpackPhase" "patchPhase" ]
Expand Down
6 changes: 6 additions & 0 deletions compiler/ghc/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@

, enableLibraryProfiling ? true

, enableDebug ? stdenv.targetPlatform.isLinux

, # Whether to build terminfo. Musl fails to build terminfo as ncurses seems to be linked to glibc
enableTerminfo ? !stdenv.targetPlatform.isWindows && !stdenv.targetPlatform.isMusl

Expand Down Expand Up @@ -103,6 +105,9 @@ let
'' + lib.optionalString enableRelocatedStaticLibs ''
GhcLibHcOpts += -fPIC
GhcRtsHcOpts += -fPIC
'' + lib.optionalString enableDebug ''
GhcLibHcOpts += -g3
GhcRtsHcOpts += -g3
'' + lib.optionalString targetPlatform.useAndroidPrebuilt ''
EXTRA_CC_OPTS += -std=gnu99
'' + lib.optionalString (!enableTerminfo) ''
Expand Down Expand Up @@ -149,6 +154,7 @@ let
useLLVM llvmPackages
targetCC
enableIntegerSimple targetGmp
enableDebug
ncurses targetLibffi libiconv
disableLargeAddressSpace
buildMK
Expand Down
2 changes: 1 addition & 1 deletion release.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# 'supportedSystems' restricts the set of systems that we will evaluate for. Useful when you're evaluating
# on a machine with e.g. no way to build the Darwin IFDs you need!
{ supportedSystems ? [ "x86_64-linux" "x86_64-darwin" ]
, ifdLevel ? 3
, ifdLevel ? 0
, checkMaterialization ? false }:

let
Expand Down

0 comments on commit 53d8344

Please sign in to comment.