Psellos
Life So Short, the Craft So Long to Learn

OCamlXARM Working with Lion

April 11, 2012

For the last few days I’ve been working on getting OCamlXARM working under Lion (OS X 10.7.3) with the latest Xcode (4.3.2). Just now I built the Portland test app under Lion, and it’s running correctly on a second-generation iPod Touch. So things are looking pretty good (knock on wood).

For any other frontiersmen and women working at low levels, here are the changes to Xcode that I’ve had to deal with so far.

  • Under Lion Xcode is installed as an ordinary application, so the paths to the toolchain libraries and executables are all a little different. In particular, OCamlXARM (unfortunately) depends on a hard-coded path to the ARM assembler.

  • The meaning of the assembly directive “.align 0” has changed, presumably due to the switchover from the old-school assembler to the LLVM one. Formerly this caused 4-byte alignment, but now it calls for no special alignment (which is the natural meaning). Change OCamlXARM to emit “.align 2” instead.

  • Also add an alignment directive to the .text section of the low-level assembly support file arm.S.

  • The ARM back end of OCamlXARM produces armv6 instructions. The latest Xcode is configured to build armv7 executables by default. It’s possible, but a little difficult, to convince Xcode to build armv6 instead. For now I’ve decided this is the best approach. It would probably not be too difficult to mark the OCamlXARM output as armv7, but the benefits would be modest since the compiler would still emit the same instructions. (This is something to look at again after upgrading OCamlXARM to work with a modern OCaml compiler version.)

I’ll test more thoroughly, then I’ll release the OCamlXARM patches and binary for Lion.

Posted by: Jeffrey

Comments

blog comments powered by Disqus