diff --git a/pkgs/development/tools/misc/elfutils/debug-info-from-env.patch b/pkgs/development/tools/misc/elfutils/debug-info-from-env.patch new file mode 100644 index 000000000000..409f1311c315 --- /dev/null +++ b/pkgs/development/tools/misc/elfutils/debug-info-from-env.patch @@ -0,0 +1,27 @@ +Look up .build-id files relative to the directories in the +colon-separated environment variable NIX_DEBUG_INFO_DIRS, unless +overriden by --debuginfo-path. + +diff -ru elfutils-0.169-orig/libdwfl/argp-std.c elfutils-0.169/libdwfl/argp-std.c +--- elfutils-0.169-orig/libdwfl/argp-std.c 2017-05-02 23:05:52.000000000 +0200 ++++ elfutils-0.169/libdwfl/argp-std.c 2017-07-28 16:08:06.739558106 +0200 +@@ -376,5 +376,7 @@ + const struct argp * + dwfl_standard_argp (void) + { ++ debuginfo_path = getenv("NIX_DEBUG_INFO_DIRS"); ++ + return &libdwfl_argp; + } +diff -ru elfutils-0.169-orig/src/stack.c elfutils-0.169/src/stack.c +--- elfutils-0.169-orig/src/stack.c 2017-02-24 11:55:28.000000000 +0100 ++++ elfutils-0.169/src/stack.c 2017-07-28 15:50:06.743196696 +0200 +@@ -631,6 +631,8 @@ + /* Set locale. */ + (void) setlocale (LC_ALL, ""); + ++ debuginfo_path = getenv("NIX_DEBUG_INFO_DIRS"); ++ + const struct argp_option options[] = + { + { NULL, 0, NULL, 0, N_("Input selection options:"), 0 }, diff --git a/pkgs/development/tools/misc/elfutils/default.nix b/pkgs/development/tools/misc/elfutils/default.nix index d8e54e47404e..591e263205c8 100644 --- a/pkgs/development/tools/misc/elfutils/default.nix +++ b/pkgs/development/tools/misc/elfutils/default.nix @@ -1,4 +1,4 @@ -{ lib, stdenv, fetchurl, m4, zlib, bzip2, bison, flex, gettext, xz }: +{ lib, stdenv, fetchurl, m4, zlib, bzip2, bison, flex, gettext, xz, setupDebugInfoDirs }: # TODO: Look at the hardcoded paths to kernel, modules etc. stdenv.mkDerivation rec { @@ -10,6 +10,8 @@ stdenv.mkDerivation rec { sha256 = "1hiv1yqig3292dwqhrwsxwk3qjalxp5fpl8yphwbfwh8ng3zl4ll"; }; + patches = ./debug-info-from-env.patch; + hardeningDisable = [ "format" ]; # We need bzip2 in NativeInputs because otherwise we can't unpack the src, @@ -17,6 +19,8 @@ stdenv.mkDerivation rec { nativeBuildInputs = [ m4 bison flex gettext bzip2 ]; buildInputs = [ zlib bzip2 xz ]; + propagatedNativeBuildInputs = [ setupDebugInfoDirs ]; + configureFlags = [ "--program-prefix=eu-" # prevent collisions with binutils "--enable-deterministic-archives"