summaryrefslogtreecommitdiff
path: root/rts/Printer.c
diff options
context:
space:
mode:
authorSergei Trofimovich <slyfox@gentoo.org>2014-10-05 21:20:39 +0100
committerSergei Trofimovich <slyfox@gentoo.org>2014-10-05 22:10:08 +0100
commitcb0a503a44bf016de3d9042906c6ac0c0821ffea (patch)
tree02cd71760f54c6b5857eefc3d5f26f13fbf057aa /rts/Printer.c
parent3549c952b535803270872adaf87262f2df0295a4 (diff)
downloadhaskell-cb0a503a44bf016de3d9042906c6ac0c0821ffea.tar.gz
rts: unrust 'libbfd' debug symbols parser
Summary: Patch does the following: - fixes detection of working libbfd on modern linux platforms (where bfd_uncompress_section_contents is a macro) - disables 'bfd' by default and adds '--enable-bfd-debug' configure option. As bfd's ABI is unstable the feature is primarily useful by ghc hackers. Not done (subject for another patch): - one-time bfd object memory leak in DEBUG_LoadSymbols - in '-dynamic' mode debugging symbols are loaded only for current executable, not all libraries it is linked against. Fixes Issue #8790 Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org> Test Plan: built unregisterised ghc on amd64 and ran './hello +RTS -Di' there Reviewers: simonmar, austin Reviewed By: simonmar, austin Subscribers: thomie, simonmar, ezyang, carter Differential Revision: https://phabricator.haskell.org/D193 GHC Trac Issues: #8790
Diffstat (limited to 'rts/Printer.c')
-rw-r--r--rts/Printer.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/rts/Printer.c b/rts/Printer.c
index 3d77e83282..9bc2984384 100644
--- a/rts/Printer.c
+++ b/rts/Printer.c
@@ -7,6 +7,8 @@
* ---------------------------------------------------------------------------*/
#include "PosixSource.h"
+#include "ghcconfig.h"
+
#include "Rts.h"
#include "rts/Bytecodes.h" /* for InstrPtr */
@@ -664,8 +666,16 @@ const char *lookupGHCName( void *addr )
disabling this for now.
*/
#ifdef USING_LIBBFD
-
-#include <bfd.h>
+# define PACKAGE 1
+# define PACKAGE_VERSION 1
+/* Those PACKAGE_* defines are workarounds for bfd:
+ * https://sourceware.org/bugzilla/show_bug.cgi?id=14243
+ * ghc's build system filter PACKAGE_* values out specifically to avoid clashes
+ * with user's autoconf-based Cabal packages.
+ * It's a shame <bfd.h> checks for unrelated fields instead of actually used
+ * macros.
+ */
+# include <bfd.h>
/* Fairly ad-hoc piece of code that seems to filter out a lot of
* rubbish like the obj-splitting symbols
@@ -733,7 +743,6 @@ extern void DEBUG_LoadSymbols( char *name )
for( i = 0; i != number_of_symbols; ++i ) {
symbol_info info;
bfd_get_symbol_info(abfd,symbol_table[i],&info);
- /*debugBelch("\t%c\t0x%x \t%s\n",info.type,(nat)info.value,info.name); */
if (isReal(info.type, info.name)) {
num_real_syms += 1;
}