[Git][ghc/ghc][master] initialise mmap_32bit_base during RTS startup #24847

Marge Bot (@marge-bot) gitlab at gitlab.haskell.org
Fri Jul 12 15:47:28 UTC 2024



Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC


Commits:
e3914028 by Adam Sandberg Ericsson at 2024-07-12T11:45:47-04:00
initialise mmap_32bit_base during RTS startup #24847
- - - - -


4 changed files:

- rts/Linker.c
- rts/RtsStartup.c
- rts/linker/MMap.c
- rts/linker/MMap.h


Changes:

=====================================
rts/Linker.c
=====================================
@@ -501,11 +501,6 @@ initLinker_ (int retain_cafs)
     }
 #   endif
 
-    if (RtsFlags.MiscFlags.linkerMemBase != 0) {
-        // User-override for mmap_32bit_base
-        mmap_32bit_base = (void*)RtsFlags.MiscFlags.linkerMemBase;
-    }
-
 #if defined(OBJFORMAT_PEi386)
     initLinker_PEi386();
 #endif


=====================================
rts/RtsStartup.c
=====================================
@@ -11,6 +11,7 @@
 #include "HsFFI.h"
 
 #include "sm/Storage.h"
+#include "linker/MMap.h"
 #include "RtsFlags.h"
 #include "RtsUtils.h"
 #include "Prelude.h"
@@ -342,6 +343,9 @@ hs_init_ghc(int *argc, char **argv[], RtsConfig rts_config)
     /* Initialise the adjustors subsystem */
     initAdjustors();
 
+    /* Initialise mmapForLinker */
+    initLinkerMMap();
+
     /* Initialise the stats department, phase 1 */
     initStats1();
 


=====================================
rts/linker/MMap.c
=====================================
@@ -40,6 +40,13 @@
 
 void *mmap_32bit_base = LINKER_LOAD_BASE;
 
+void initLinkerMMap(void) {
+    if (RtsFlags.MiscFlags.linkerMemBase != 0) {
+        // User-override for mmap_32bit_base
+        mmap_32bit_base = (void*)RtsFlags.MiscFlags.linkerMemBase;
+    }
+}
+
 static const char *memoryAccessDescription(MemoryAccess mode)
 {
   switch (mode) {


=====================================
rts/linker/MMap.h
=====================================
@@ -49,6 +49,8 @@
 #define LINKER_LOAD_BASE ((void *) 0x40000000)
 #endif
 
+void initLinkerMMap(void);
+
 /** Access modes for mprotectForLinker */
 typedef enum {
     MEM_NO_ACCESS,



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/e3914028829a6e617c59f7d7b6b1fc969232ac6d

-- 
This project does not include diff previews in email notifications.
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/e3914028829a6e617c59f7d7b6b1fc969232ac6d
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20240712/20e5108c/attachment-0001.html>


More information about the ghc-commits mailing list