-1

Currently, I am compiling:

clang -Oz -g

But I would like to apply an -mtune and if possible an -march flag, and anything else that will be valid on all Intel architectures that OS X Leopard supports.

Specifically I am asking: which -mtune and -march flag should I specify so that my binary is optimized for 10.5, and will run on all supported Intel processors for 10.5?

In addition, I would like to apply different tunings to the 32 bit and 64 bit portions, is this possible? If so what should I tune the 64 bit portion to?

For bonus points, I am interested in the same for PowerPC, for future reference, though currently I do not support that.

1 Answer 1

1

You can build separate binaries using different -march and other flags, though be aware that -march can use instructions not available on earlier processors. -mtune and -mcpu can choose instructions, alignment, etc., that will favour a particular processor, yet run on all processors in that family.

To tune to different architectures (i386, x86-64, ppc, ppc64) you would have to consult the manual pages for clang / gcc. After separate builds it should be possible to use lipo to create a universal binary. There's a simple example here.


For Apple's compilers, you should use the -arch specification, and -mmacosx-version-min=10.5, provided you still have the SDKs for 10.5.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.