/* -----------------------------------------------------------------------------
- * $Id: Linker.c,v 1.138 2003/10/29 16:12:00 wolfgang Exp $
+ * $Id: Linker.c,v 1.144 2004/01/05 17:32:35 simonmar Exp $
*
* (c) The GHC Team, 2000-2003
*
#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"
#define RTS_MINGW_ONLY_SYMBOLS \
SymX(asyncReadzh_fast) \
SymX(asyncWritezh_fast) \
+ SymX(asyncDoProczh_fast) \
SymX(memset) \
SymX(inet_ntoa) \
SymX(inet_addr) \
SymX(newPinnedByteArrayzh_fast) \
SymX(orIntegerzh_fast) \
SymX(performGC) \
+ SymX(performMajorGC) \
SymX(plusIntegerzh_fast) \
SymX(prog_argc) \
SymX(prog_argv) \
# 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
}
initLinker();
-#if !defined(openbsd_TARGET_OS)
hdl= dlopen(dll_name, RTLD_NOW | RTLD_GLOBAL);
-#else
- hdl= dlopen(dll_name, RTLD_LAZY);
-#endif
+
if (hdl == NULL) {
/* dlopen failed; return a ptr to the error msg. */
errmsg = dlerror();
* real count can be found in the first reloc entry.
*
* See Section 4.1 (last para) of the PE spec (rev6.0).
+ *
+ * Nov2003 update: the GNU linker still doesn't correctly
+ * handle the generation of relocatable object files with
+ * overflown relocations. Hence the output to warn of potential
+ * troubles.
*/
COFF_reloc* rel = (COFF_reloc*)
myindex ( sizeof_COFF_reloc, reltab, 0 );
noRelocs = rel->VirtualAddress;
- fprintf(stderr, "Overflown relocs: %u\n", noRelocs);
+ fprintf(stderr, "WARNING: Overflown relocation field (# relocs found: %u)\n", noRelocs); fflush(stderr);
j = 1;
} else {
noRelocs = sectab_i->NumberOfRelocations;