Re: Specify Xcode linker version / compatibility
Re: Specify Xcode linker version / compatibility
- Subject: Re: Specify Xcode linker version / compatibility
- From: Chris Espinosa <email@hidden>
- Date: Wed, 4 Nov 2009 21:40:06 -0800
On Nov 4, 2009, at 8:29 PM, Dan Korn wrote:
I can specify the compiler version with the GCC_VERSION setting, but
how can I tell Xcode to use the linker that corresponds to that
version of the compiler? Alternatively, how can I get Xcode 3.2 to
link the same way that Xcode 2.5 does, with code compiled by GCC
4.0, for the same project?
The problem I'm trying to solve is that my program (actually a plug-
in) works just fine if I build it in Xcode 2.5 on a 10.5 (Leopard)
machine, but it has a few subtle GUI issues if I build it in Xcode
3.2 on 10.6 (Snow Leopard). Which OS the program is run on doesn't
seem to make a difference; the same binaries work the same way on
10.5 and 10.6. The issue is specific to the machine, and Xcode
version, it's built on. It's the exact same code base, and the same
Xcode projects, saved in Xcode 3.2 in the "Xcode 2.4-compatible"
format, with GCC_VERSION=4.0.
As far as I can tell, the issue is that some functions in a vtable
which exist in the binary built by Xcode 2.5 are not included in the
binary built by the Xcode 3.2 linker. The executable built by Xcode
3.2 is about half as big as the one built by Xcode 2.5. If I run
"nm -j" on each binary and compare the output, the Xcode 2.5 binary
has about twice as many entries. The main difference seems to be
that a host functions with a ".eh" suffix are missing from the 3.2
output, which as far as I can tell have to do with exception frame
handling.
I did uncheck the "Inline Methods
Hidden" (GCC_INLINES_ARE_PRIVATE_EXTERN) box in Xcode 3.2, and that
made the binary slightly larger, but it still exhibits the same
problems.
I'd like to be able to do all my development on Snow Leopard, but
I'm stuck doing all my builds on Leopard until I figure this out.
Any ideas on how I can make the executable link the same way in
Xcode 3.2 as it did in 2.5?
Xcode uses the compiler to drive the linker, but there is generally
only one linker per toolset. Leaping from Xcode 2.5 across 3 major
versions and 4 minor versions is quite a change, especially as the
linker in Snow Leopard is full 64-bit.
But the linker preserves backwards compatibility when you're targeting
older operating systems. If you set your Deployment Target to 10.5
and link against the Mac OS X 10.5 SDK, you should get an executable
that is structurally similar to the executable built by Xcode 2.5 on
Leopard. It won't be bytewise identical but it will be much closer
than a binary built to run on 10.6.
Chris
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden