Re-compiling wired-in packages

Joachim Breitner mail at joachim-breitner.de
Mon Apr 24 14:54:59 UTC 2017


Hi,

Am Montag, den 24.04.2017, 21:31 +0800 schrieb Shao Cheng:
> I'm trying to implement a new codegen for ghc, starting by using the
> ghc api to compile modules to STG/Cmm. In order to support importing
> Prelude, I also need the STG/Cmm representations of wired-in packages
> like base, ghc-prim, etc, and I guess that means I need to re-compile 
> them.


I did just that recently, see
https://github.com/nomeata/veggies
for how I did it, in particular boot.sh.

> * Load the `ModIface` of wired-in packages, which are tidied Core
> modules, and convert to STG/Cmm

What won’t work; the interface does not contain all the core, but only
those of inlineable functions.

> I haven't succeeded in either approach. For the first one, I haven't
> found a way to convert `ModIface` of external package to regular
> compilation targets; for the second one, regular "cabal installs"
> won't do the trick, seems compiling wired-in packages require quite
> some magic.

Less than you would think! Use "ghc --make Setup.hs && ./Cabal" instead
of the cabal tool, though.

Greetings,
Joachim
-- 
Joachim “nomeata” Breitner
  mail at joachim-breitner.dehttps://www.joachim-breitner.de/
  XMPP: nomeata at joachim-breitner.de • OpenPGP-Key: 0xF0FBF51F
  Debian Developer: nomeata at debian.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part
URL: <http://mail.haskell.org/pipermail/ghc-devs/attachments/20170424/81ab8ad0/attachment-0001.sig>


More information about the ghc-devs mailing list