summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2022-03-28 22:03:03 -0400
committerBen Gamari <ben@smart-cactus.org>2022-04-06 21:57:00 -0400
commit731a6333522081628a63dfb360a8cc1864be218f (patch)
treebe010da5b8c05c7a319d57afcaf48e09c2352db1
parent3d7ede65e2d715b86fe25eae105ff44adc144de5 (diff)
downloadhaskell-731a6333522081628a63dfb360a8cc1864be218f.tar.gz
MMTK-GHC
-rw-r--r--rts/RtsStartup.c7
-rw-r--r--rts/mmtk/Makefile2
-rw-r--r--rts/mmtk/mmtk-ghc.h3
-rw-r--r--rts/mmtk/mmtk-test.c7
-rw-r--r--rts/rts.cabal.in8
5 files changed, 27 insertions, 0 deletions
diff --git a/rts/RtsStartup.c b/rts/RtsStartup.c
index bfdfb1e976..7325c07436 100644
--- a/rts/RtsStartup.c
+++ b/rts/RtsStartup.c
@@ -41,6 +41,9 @@
#include "LinkerInternals.h"
#include "LibdwPool.h"
#include "sm/CNF.h"
+#if defined(MMTK_GHC)
+#include "mmtk/mmtk-ghc.h"
+#endif
#include "TopHandler.h"
#if defined(PROFILING)
@@ -206,6 +209,10 @@ hs_init_ghc(int *argc, char **argv[], RtsConfig rts_config)
setlocale(LC_CTYPE,"");
+#if defined(MMTK_GHC)
+ mmtk_ghc_init();
+#endif
+
/* Initialise the stats department, phase 0 */
initStats0();
diff --git a/rts/mmtk/Makefile b/rts/mmtk/Makefile
new file mode 100644
index 0000000000..7199df1e65
--- /dev/null
+++ b/rts/mmtk/Makefile
@@ -0,0 +1,2 @@
+libmmtk-ghc.a : mmtk-ghc.o
+ ar q $@ $+
diff --git a/rts/mmtk/mmtk-ghc.h b/rts/mmtk/mmtk-ghc.h
new file mode 100644
index 0000000000..5f6bbadbf8
--- /dev/null
+++ b/rts/mmtk/mmtk-ghc.h
@@ -0,0 +1,3 @@
+#pragma once
+
+void mmtk_ghc_init(void);
diff --git a/rts/mmtk/mmtk-test.c b/rts/mmtk/mmtk-test.c
new file mode 100644
index 0000000000..afbbc4eaec
--- /dev/null
+++ b/rts/mmtk/mmtk-test.c
@@ -0,0 +1,7 @@
+#include <stdio.h>
+
+#include "mmtk-ghc.h"
+
+void mmtk_ghc_init() {
+ printf("hello world\n");
+}
diff --git a/rts/rts.cabal.in b/rts/rts.cabal.in
index 641fccc437..a310e2d35c 100644
--- a/rts/rts.cabal.in
+++ b/rts/rts.cabal.in
@@ -10,6 +10,8 @@ source-repository head
location: https://gitlab.haskell.org/ghc/ghc.git
subdir: rts
+flag mmtk
+ default: True
flag libm
default: @CabalHaveLibm@
flag librt
@@ -471,6 +473,12 @@ library
if arch(ppc) || arch(ppc64) || arch(s390x) || arch(riscv64)
asm-sources: StgCRunAsm.S
+ if flag(mmtk)
+ -- link against libmmtk-ghc
+ extra-libraries: mmtk-ghc
+ extra-lib-dirs: mmtk
+ cpp-options: -DMMTK_GHC
+
c-sources: Adjustor.c
adjustor/AdjustorPool.c
ExecPage.c