X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=rts%2FLinker.c;h=6ce16d9adc1c2844cc4d18f969dd139878650121;hb=9142c238bd014c45e30fc79eee69fa6ab3f469d8;hp=1614a1a78f9e1fd475ecdbb84721c00081de5e68;hpb=723da2ed96068632ede8d1e8514dd02bbe1336ea;p=ghc-hetmet.git diff --git a/rts/Linker.c b/rts/Linker.c index 1614a1a..6ce16d9 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) @@ -4976,7 +4974,7 @@ static int ocGetNames_MachO(ObjectCode* oc) for(i=0;insects;i++) { - IF_DEBUG(linker, debugBelch("ocGetNames_MachO: segment %d\n")); + IF_DEBUG(linker, debugBelch("ocGetNames_MachO: segment %d\n", i)); if (sections[i].size == 0) continue;