Re: __attribute__((used)) not working in Xcode 3?
Re: __attribute__((used)) not working in Xcode 3?
- Subject: Re: __attribute__((used)) not working in Xcode 3?
- From: Peter O'Gorman <email@hidden>
- Date: Sun, 02 Dec 2007 00:45:05 -0600
B.J. Buchalter wrote:
> Bump - surely someone has some idea about this? There is a whole section
> in the Xcode docs about this; it seems odd that it would be in there if
> it just didn't work at all. I'm hoping the first post went by and this
> will catch someone at a better time...
>
> Hi Folks,
>
> I have some code that utilizes some factory functions at run-time that
> are not referenced by any code at compile time.
>
> I have dead-stripping enabled, and the linker is striping out these
> factory functions.
>
> After doing a search in the Xcode docs, I found that I should be able to
> use a declaration like the following:
>
> extern "C" MyClass* MyClass_Factory() __attribute__((used));
>
> This is obviously supposed to work (from the documentation). Any idea of
> what I am doing wrong here?
email@hidden
>
It appears to be broken, file a bug.
The asm output I see with __attribute__((used)) and without for this:
void i(int*) __attribute__((used));
/* asm(".no_dead_strip _i"); */
void i (int *a) {
if (a) *a = *a + 5;
}
int main() { return 0;}
is identical.
If you really want -dead_strip to not strip the function in Xcode-3.0
use the .no_dead_strip asm directive (which gcc should be inserting with
__attribute__((used)), but does not appear to be doing.
Peter
--
Peter O'Gorman
http://pogma.com
_______________________________________________
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