summaryrefslogtreecommitdiff
path: root/aclocal.m4
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 /aclocal.m4
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 'aclocal.m4')
-rw-r--r--aclocal.m449
1 files changed, 49 insertions, 0 deletions
diff --git a/aclocal.m4 b/aclocal.m4
index a98691ef57..0db231db04 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -2215,4 +2215,53 @@ $2=$HS_CPP_ARGS
])
+# FP_BFD_SUPPORT()
+# ----------------------
+# whether to use libbfd for debugging RTS
+AC_DEFUN([FP_BFD_SUPPORT], [
+ AC_ARG_ENABLE(bfd-debug,
+ [AC_HELP_STRING([--enable-bfd-debug],
+ [Enable symbol resolution for -debug rts ('+RTS -Di') via binutils' libbfd [default=no]])],
+ [
+ # don't pollute general LIBS environment
+ save_LIBS="$LIBS"
+ AC_CHECK_HEADERS([bfd.h])
+ dnl ** check whether this machine has BFD and libiberty installed (used for debugging)
+ dnl the order of these tests matters: bfd needs libiberty
+ AC_CHECK_LIB(iberty, xmalloc)
+ dnl 'bfd_init' is a rare non-macro in libbfd
+ AC_CHECK_LIB(bfd, bfd_init)
+
+ AC_TRY_LINK([#include <bfd.h>],
+ [
+ /* mimic our rts/Printer.c */
+ bfd* abfd;
+ const char * name;
+ char **matching;
+
+ name = "some.executable";
+ bfd_init();
+ abfd = bfd_openr(name, "default");
+ bfd_check_format_matches (abfd, bfd_object, &matching);
+ {
+ long storage_needed;
+ storage_needed = bfd_get_symtab_upper_bound (abfd);
+ }
+ {
+ asymbol **symbol_table;
+ long number_of_symbols;
+ symbol_info info;
+
+ number_of_symbols = bfd_canonicalize_symtab (abfd, symbol_table);
+ bfd_get_symbol_info(abfd,symbol_table[0],&info);
+ }
+ ],
+ [],dnl bfd seems to work
+ [AC_MSG_ERROR([can't use 'bfd' library])])
+ LIBS="$save_LIBS"
+ ],
+ []
+ )
+])
+
# LocalWords: fi