From 3ce0e0baad05352e2e1ca439794b6f9f2325ef2b Mon Sep 17 00:00:00 2001 From: Simon Marlow Date: Fri, 14 Oct 2016 10:43:10 -0400 Subject: [PATCH] Build ghc-iserv with --export-dynamic This enables loading dynamic libraries that refer to the RTS. I just came across somewhere I needed to do that, and without `--export-dynamic` it's impossible. For now we'll only support that when using `-fexternal-interpreter`, because the dynamic symbol table for GHC itself is much bigger. Test Plan: validate Reviewers: niteria, austin, erikd, bgamari Reviewed By: bgamari Subscribers: Phyx, thomie Differential Revision: https://phabricator.haskell.org/D2590 --- iserv/ghc.mk | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/iserv/ghc.mk b/iserv/ghc.mk index 83691bc131..cab432a3d6 100644 --- a/iserv/ghc.mk +++ b/iserv/ghc.mk @@ -24,6 +24,16 @@ iserv_stage2_MORE_HC_OPTS += -threaded iserv_stage2_p_MORE_HC_OPTS += -threaded iserv_stage2_dyn_MORE_HC_OPTS += -threaded +# Add -Wl,--export-dynamic enables GHCi to load dynamic objects that +# refer to the RTS. This is harmless if you don't use it (adds a bit +# of overhead to startup and increases the binary sizes) but if you +# need it there's no alternative. +ifeq "$(TargetElf)" "YES" +iserv_stage2_MORE_HC_OPTS += -optl-Wl,--export-dynamic +iserv_stage2_p_MORE_HC_OPTS += -optl-Wl,--export-dynamic +iserv_stage2_dyn_MORE_HC_OPTS += -optl-Wl,--export-dynamic +endif + # Override the default way, because we want a specific version of this # program for each way. Note that it's important to do this even for # the vanilla version, otherwise we get a dynamic executable when -- GitLab