Custom ghcPrimIface for cross-compilation?

Moritz Angermann moritz at
Fri Mar 16 06:10:26 UTC 2018


not sure I understand your question. If you build a cross compiler
targetting a 32bit device (say Raspbian/Raspberry Pi) for say x86_64
linux, you end up with a 64bit compiler emitting code for a 32bit

If you question revolves around dynamically changing GHCs target at
runtime.  Essentially turning GHC into a multi-target compiler, we
hope to get there eventually.

Please not that just emitting a single module in 32bit is likely not
going to get you far. You will still need to build the rts and potentially
some additional support libraries to turn that module into something


> On Mar 16, 2018, at 1:12 PM, Shao Cheng <astrohavoc at> wrote:
> Hi all, is it possible for a 64-bit ghc to emit 32-bit code, if I supply a custom ghcPrimIface via Hooks and also modify the platform flags in DynFlags? The module does not import Prelude and has no dependencies other than GHC.Prim. _______________________________________________
> ghc-devs mailing list
> ghc-devs at

More information about the ghc-devs mailing list