Commit 9858bd46 authored by simonmar's avatar simonmar

[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.
parent 1b1d826f
/* -----------------------------------------------------------------------------
* $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 <dlfcn.h>.
#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
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment