summaryrefslogtreecommitdiff
path: root/rts
diff options
context:
space:
mode:
authorIan Lynagh <igloo@earth.li>2010-11-27 17:30:00 +0000
committerIan Lynagh <igloo@earth.li>2010-11-27 17:30:00 +0000
commit9142c238bd014c45e30fc79eee69fa6ab3f469d8 (patch)
treeb67c39856302f48740f06894284ad064ddcffadb /rts
parent71d0e9a03797a194209cb61b7f75c2e1c8ddf237 (diff)
downloadhaskell-9142c238bd014c45e30fc79eee69fa6ab3f469d8.tar.gz
Always enable the archive-loading code
If the GHCi .o lib doesn't exist, load the .a instead
Diffstat (limited to 'rts')
-rw-r--r--rts/Linker.c20
-rw-r--r--rts/ghc.mk4
2 files changed, 9 insertions, 15 deletions
diff --git a/rts/Linker.c b/rts/Linker.c
index 657c2c3886..6ce16d9adc 100644
--- a/rts/Linker.c
+++ b/rts/Linker.c
@@ -1670,7 +1670,6 @@ mkOc( char *path, char *image, int imageSize,
return oc;
}
-#if defined(USE_ARCHIVES_FOR_GHCI)
HsInt
loadArchive( char *path )
{
@@ -1765,11 +1764,16 @@ loadArchive( char *path )
/* We can't mmap from the archive directly, as object
files need to be 8-byte aligned but files in .ar
- archives are 2-byte aligned, and if we malloc the
- memory then we can be given memory above 2^32, so we
- mmap some anonymous memory and use that. We could
- do better here. */
+ archives are 2-byte aligned. When possible we use mmap
+ to get some anonymous memory, as on 64-bit platforms if
+ we use malloc then we can be given memory above 2^32.
+ In the mmap case we're probably wasting lots of space;
+ we could do better. */
+#ifdef USE_MMAP
image = mmapForLinker(imageSize, MAP_ANONYMOUS, -1);
+#else
+ image = stgMallocBytes(imageSize, "loadArchive(image)");
+#endif
n = fread ( image, 1, imageSize, f );
if (n != imageSize)
barf("loadObj: error whilst reading `%s'", path);
@@ -1817,12 +1821,6 @@ loadArchive( char *path )
stgFree(file);
return 1;
}
-#else
-HsInt GNU_ATTRIBUTE(__noreturn__)
-loadArchive( char *path STG_UNUSED ) {
- barf("loadArchive: not enabled");
-}
-#endif
/* -----------------------------------------------------------------------------
* Load an obj (populate the global symbol table, but don't resolve yet)
diff --git a/rts/ghc.mk b/rts/ghc.mk
index 2bd67de30f..55a11ba401 100644
--- a/rts/ghc.mk
+++ b/rts/ghc.mk
@@ -246,10 +246,6 @@ ifeq "$(UseLibFFIForAdjustors)" "YES"
rts_CC_OPTS += -DUSE_LIBFFI_FOR_ADJUSTORS
endif
-ifeq "$(UseArchivesForGhci)" "YES"
-rts_CC_OPTS += -DUSE_ARCHIVES_FOR_GHCI
-endif
-
# Mac OS X: make sure we compile for the right OS version
rts_CC_OPTS += $(MACOSX_DEPLOYMENT_CC_OPTS)
rts_HC_OPTS += $(addprefix -optc, $(MACOSX_DEPLOYMENT_CC_OPTS))