GCC, Mac OS X & the future
Manuel M T Chakravarty
chak at cse.unsw.edu.au
Mon May 30 15:59:06 CEST 2011
It is no secret that Apple moves away from the traditional GCC backend to LLVM. In fact, Xcode (which bundles all command line developer tools on the Mac) today comes with two flavours of gcc: 'gcc' and 'llvm-gcc', which AFAIK only differ in the backend that is being used. Currently, the default is the traditional GCC backend, but it takes no precognition to realise that this will eventually change. The 'gcc' executable will use the LLVM backend and, at least for a while, the traditional backend will still be available under a different name.
Unfortunately, GHC will break at this point as the LLVM backend does not support pinned global registers. ('llvm-gcc' happily accepts the register assignment, but fails with a runtime error during code generation.) Now, it shouldn't be hard to make configure a bit smarter to ensure it picks a version of gcc with the old backend (after all, --version is sufficient to identify the backend). However, GHC bakes the pathname of gcc into various places during a build. Hence, a GHC built with todays Xcode will not run on a Mac using a future version that uses the LLVM backend by default. This then gives the same awkward user experience as when Xcode 4 was released and GHC broke.
To avoid that, we would need to pick the right version of gcc to use at GHC install time instead. Does that make sense? I wonder how many places are referring to gcc in an install.
Manuel
-=-
withinreason chak 5 (/Users/chak): gcc --version
i686-apple-darwin10-gcc-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5666) (dot 3)
Copyright (C) 2007 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
withinreason chak 6 (/Users/chak): llvm-gcc --version
i686-apple-darwin10-llvm-gcc-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.9)
Copyright (C) 2007 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
More information about the Cvs-ghc
mailing list