Skip to content

Bootstrapping GHC via c

Hello! This feature is purely about Hadrian and so shouldn't be too controversial

Motivation

Bringing GHC up on a new platform has gotten much easier as time has gone on, but this is assuming that you have a cross toolchain. But there are still a few scenarios where this is not an assumption that we can make.

  1. If we are bootstrapping GHC in order to package it
  2. If we want GHC to run on a platform without a cross toolchain (In my case, Plan9)

In both of these cases, a solution that comes to mind would be to bring back the old method. Configuring an unregistered build of the compiler, compiling with -fvia-c and -keep-hc (or something to that effect), copying over to the target system, and letting the c compiler finish the job.

I propose bring this option back (maybe even with some new features) so that GHC can be enjoyed on more fringe platforms than ever before!

Proposal

  1. Add the ability for Hadrian to compile GHC to hc files and generate make files. Maybe even just generate a folder with all this in like it does with the binary dist.
  2. (Optionally) use rsync/ssh to automate the configuring of the compiler
  3. (Optionally) use rsync/ssh to finish the build on the target platform
Edited by Matthew Pickering
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information