Re: Undefined symbols insanity after upgrading to Xcode 2.1...
Re: Undefined symbols insanity after upgrading to Xcode 2.1...
- Subject: Re: Undefined symbols insanity after upgrading to Xcode 2.1...
- From: Andreas Grosam <email@hidden>
- Date: Wed, 27 Jul 2005 12:07:23 +0200
On 26.07.2005, at 20:36, Dave Thorup wrote:
On Jul 26, 2005, at 2:29 PM, Eric Albert wrote:
Well, I at least found a workaround. The only thing I changed when I upgraded our projects to Xcode 2.1 was some of the optimization settings. It seems that the culprit was changing the optimization level from -Os (fastest, smallest) to -O3 (fastest). But why would that effect which symbols are exported?
Changing optimization settings changes which functions get inlined. Is it possible that those functions were getting inlined and therefore didn't exist to be exported?
Yes, I suppose that's possible. If that's the case then should I ever use -O3 when building a dynamic library? I suppose I can try -O3 and go back to -Os if I have problems.
"Changing optimization settings changes which functions get inlined."
A good point.
Furthermore, the compiler may conclude that a (non-inlined) function is not referenced at all and thus strip this "dead code" completely.
Please note:
if functions are defined in a dynamic library and if these functions can/will be called from outside this DSO, you *must* explicitly use the visibility attribute to ensure their *symbols* will be exported - means, are accessible from outside the DSO in which they are defined.
In this case, the compiler assumes a reference from outside and will create a non-inlined function, which is accessable from outside the DSO.
A side note:
Well, interestingly, many problems apparently stem from the new "symbol visbility" feature. This is a new concept in apple gcc-4 - and it actually adds a new dimension of complexity.
In general, this is a great feature! It reduces code, and makes it faster - and also requires almost no effort from the programmer.
But we need to learn it and use it correctly. Basically, it's pretty easy.
Regards
Andreas
Thanks!
_____________________________
Dave Thorup
Software Engineer
email@hidden
http://www.kuwan.net
Defaults Manager - The premier editor for Mac OS X's User Defaults / Preferences database.
_______________________________________________
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
_______________________________________________
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