Psellos
Life So Short, the Craft So Long to Learn

OCaml 4.00.0 Patches for VFPv2

September 30, 2012

I’ve just gotten OCaml 4.00.0 working on the earliest iOS devices, the ones that have the ARMv6 architecture. It turns out, though, that Apple no longer supports these devices for active development—Xcode 4.5 has dropped support for ARMv6. You can see this in the Xcode 4.5 release notes. Look for “Changes, General: iOS.”

An OCaml 4.00.0 cross compiler for old iOS devices still might be useful to a few people, though, so I’m going to release it today or tomorrow as a stand-alone project. I’ve personally enjoyed building OCaml 4.00.0 apps with Xcode 4.3 and running them on a couple of ancient iOS devices I have around my house.

In the meantime, one of the things I had to do for this port was to add VFPv2 support to OCaml 4.00.0. VFP is the (somewhat poorly named) standard scalar floating point subsystem for ARM. The OCaml 4.00.0 compiler comes with support for two variants of VFPv3, but the earliest iOS devices supported only VFPv2, the previous revision of VFP.

This was a relatively small and straightforward change, but I thought there might be some others out there who could use it for other OCaml ports. So, I back-ported the changes to the 4.00.0 release, and produced a set of diffs:

To apply them, download the OCaml 4.00.0 source tarball and untar it. Then:

$ cd ocaml-4.00.0
$ patch -p0 < ocamlvfpv2.diff

Now, build the compiler as usual for your ARM device. To ask the generated compiler to use VFPv2, use the flag -ffpu vfpv2. However, if you’re working on an OCaml port to a new ARM device, you’ll most likely need to modify the handling of the default ABI and other settings in asmcomp/arm/arch.ml (if you haven’t already).

If you have comments or questions, please leave them below, or email me at jeffsco@psellos.com.

Posted by: Jeffrey

Comments

blog comments powered by Disqus