From: simonmar Date: Mon, 5 Jan 2004 17:32:35 +0000 (+0000) Subject: [project @ 2004-01-05 17:32:35 by simonmar] X-Git-Tag: Approx_11550_changesets_converted~148 X-Git-Url: http://git.megacz.com/?p=ghc-hetmet.git;a=commitdiff_plain;h=9858bd46f74aaebbac42b234b43dee8e7cd77715 [project @ 2004-01-05 17:32:35 by simonmar] Instead of grabbing the handle to the executable by calling dlopen(NULL,...), use RTLD_DEFAULT as the handle to lookup symbols if it is available. It seems that RTLD_DEFAULT may be required on certain systems, although I'm not sure it is available everywhere, so I've left the old code as fallback in case it isn't available. --- diff --git a/ghc/rts/Linker.c b/ghc/rts/Linker.c index 738791c..c20d23b 100644 --- a/ghc/rts/Linker.c +++ b/ghc/rts/Linker.c @@ -1,5 +1,5 @@ /* ----------------------------------------------------------------------------- - * $Id: Linker.c,v 1.143 2003/12/23 10:10:53 simonmar Exp $ + * $Id: Linker.c,v 1.144 2004/01/05 17:32:35 simonmar Exp $ * * (c) The GHC Team, 2000-2003 * @@ -10,6 +10,12 @@ #if 0 #include "PosixSource.h" #endif + +// Linux needs _GNU_SOURCE to get RTLD_DEFAULT from . +#ifdef __linux__ +#define _GNU_SOURCE +#endif + #include "Rts.h" #include "RtsFlags.h" #include "HsFFI.h" @@ -697,7 +703,11 @@ initLinker( void ) # endif # if defined(OBJFORMAT_ELF) || defined(OBJFORMAT_MACHO) +# if defined(RTLD_DEFAULT) + dl_prog_handle = RTLD_DEFAULT; +# else dl_prog_handle = dlopen(NULL, RTLD_LAZY); +# endif // RTLD_DEFAULT # endif }