OS X: use mmap() instead of malloc for allocating the bss (#7040)
authorSimon Marlow <marlowsd@gmail.com>
Mon, 20 Aug 2012 12:14:47 +0000 (13:14 +0100)
committerSimon Marlow <marlowsd@gmail.com>
Tue, 21 Aug 2012 14:04:53 +0000 (15:04 +0100)
rts/Linker.c

index 6d86e2b..bf00456 100644 (file)
@@ -6177,8 +6177,13 @@ ocGetNames_MachO(ObjectCode* oc)
 
         if((sections[i].flags & SECTION_TYPE) == S_ZEROFILL)
         {
+#ifdef USE_MMAP
+            char * zeroFillArea = mmapForLinker(sections[i].size, MAP_ANONYMOUS, -1);
+            memset(zeroFillArea, 0, sections[i].size);
+#else
             char * zeroFillArea = stgCallocBytes(1,sections[i].size,
                                       "ocGetNames_MachO(common symbols)");
+#endif
             sections[i].offset = zeroFillArea - image;
         }