gcc, as, AVX, binutils and MacOS X 10.7

vincent habchi vince at macports.org
Sun Oct 2 02:17:32 PDT 2011


Hi there,

I haven’t been much presently lately, but I was taken away by my work and also pondering on various bugs I encountered lately, especially with the Atlas port. I am now sure something is definitely rotten in OS 10.7 kingdom.

The starting point is Atlas not being compiled properly by clang. The source compiles fine, but the resulting library crashes on various calls. Then, there are sparse bugs related to ar(1) or ranlib(1) that prevents gcc46, atlas with standard ar or even qt4.8 beta to build properly. At this point, I am deeply convinced that this is caused by clang miscompilations: either we are plagued by clang producing weirds object files, or the tools themselves (MacOS 10.7 has been built with clang/llvm, AFAIK) are buggy. Unfortunately, I am more inclined towards the latter possibility, since the ar bugs manifests itself during the libgfortran archiving, where clang plays no role. I have filed various radars apropos, but while they have been acknowledged, no patch has been released yet. My opinion is that Apple has moved far too fast to clang for obvious political reasons, resulting in a flawed OS. 

Then there is another knot: the ‘as’ assembler, bundled with OS 10.7, and used by our various gcc, is antiquated: GNU assembler version 1.38 (output of as -v – this is probably the last GPL v.2 version). This means no Sandy bridge AVX support (unknown instructions), so no possibility to compile or assemble code with gcc -mavx switch on: that’s a waste of power, and means inferior performance on floating point code (at best); with Ivy bridge processor looming, the gap will increase if we find no quick fix to this.

Trying to build the gas included in libtools fails: the configure script reports an unknown configuration and won’t build the assembler. The llvm toolchain won’t help us, since it is based on a wholly different structure, and won’t accept GNU assembler files as input, so our last hope is to try using ‘yasm’ with gcc: did anybody already test this?

We can’t count on Apple helping us, since they are forbidden to touch every GPL v.3 tool. Besides, clang support for AVX instructions is currently broken.

So folks, question is: how can we get out of this trap?

Cheers,
Vincent


More information about the macports-dev mailing list