So I’ve taken Stephen’s work and tested it on my Pandaboard which shows several issues needed to be worked around. First was deprecation of swp instruction on ARMv6. GNU assembler complained about it. This was quite easy so I provided ARMv6/7 specific xchg function. Next was issue which shows like Illegal instruction error and which was caused by wrong interworking between Thumb and ARM code. To be precise, Ubuntu’s GCC compiles into Thumb by default while LLVM compiles into ARM by default. That would not be that big issue if we don’t have any hand written assembler, but we have it! In fact it forms a *glue* between C world (Thumb compiled!) and Haskell world (ARM compiled!) and it looks like this glue, i.e. StgRun/StgReturn functions were not Thumb friendly enough. Last issue was that Stephen, due to having just ARMv5 machine, completely omitted floating point support. As I do have ARMv7 where VFPv3 (at least in a “crippled” form of VFPv3-D16) is broadly supported I went ahead and added support for it too.

If you are curious, just grab latest LLVM HEAD, apply following patch, compile, install somewhere and then test GHC from my fork on GitHub.com. Please remember I have probably completely broken ARMv5 support of original Stephen’s patches (Stephen, I’m sorry for this) as I’ve not #ifdefed carefully ARMv7 bits out so make sure you do have ARMv7 hardware ready.

For your reference I’m using this mk/build.mk file:

SRC_HC_OPTS = -H64m -opta=-march=armv7a -opta=-mfpu=vfpv3 GhcLibWays = v GhcStage2HcOpts = -opta=-march=armv7a -opta=-mfpu=vfpv3 GhcLibHcOpts = -opta=-march=armv7a -opta=-mfpu=vfpv3 TABLES_NEXT_TO_CODE = NO SplitObjs = NO HADDOCK_DOCS = NO BUILD_DOCBOOK_HTML = NO BUILD_DOCBOOK_PS = NO BUILD_DOCBOOK_PDF = NO