From 731a6333522081628a63dfb360a8cc1864be218f Mon Sep 17 00:00:00 2001 From: Ben Gamari Date: Mon, 28 Mar 2022 22:03:03 -0400 Subject: MMTK-GHC --- rts/RtsStartup.c | 7 +++++++ rts/mmtk/Makefile | 2 ++ rts/mmtk/mmtk-ghc.h | 3 +++ rts/mmtk/mmtk-test.c | 7 +++++++ rts/rts.cabal.in | 8 ++++++++ 5 files changed, 27 insertions(+) create mode 100644 rts/mmtk/Makefile create mode 100644 rts/mmtk/mmtk-ghc.h create mode 100644 rts/mmtk/mmtk-test.c 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 + +#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 -- cgit v1.2.1