Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: universal binaries



On Jul 10, 2006, at 8:06 PM, Syd Polk wrote:

On Jul 10, 2006, at 9:57 PM, David A Rowland wrote:

I have an XCode project which uses some assembler code for mathematical efficiency. I wonder how to build a universal binary. If I simply use the "Architectures" target setting and choose both, the compiler blows up on one branch of the compile because it sees incompatible assembler code.

This may be a very basic question, but do you have assembler code for both architectures? If not, do you have C code for the other architecture? You can't assemble ppc code for intel, nor can you do the reverse.


Is this assembler code inline, or it is separate assembler files? If it is the former, you can wrap it with architecture macros. If it is the latter, then you are probably going to have to play games with targets and libraries.

If it's the latter, macros should work too. If, for example, your .s file is entirely x86 assembly, wrap it in
#if __i386__
...code here...
#endif


Xcode compiles .s files with the -x assembler-with-cpp flag, which runs the C preprocessor on the file before handing it off to the assembler. Wrapping it in a #if for its architecture will ensure that the file compiles for all architectures.

Hope this helps,
Eric

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/xcode-users/email@hidden

This email sent to email@hidden
References: 
 >universal binaries (From: David A Rowland <email@hidden>)
 >Re: universal binaries (From: Syd Polk <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.