backport OS X 10.9 handling code from LLVM trunk.