Re: Weak linking failing on Intel?
Re: Weak linking failing on Intel?
- Subject: Re: Weak linking failing on Intel?
- From: Rosyna <email@hidden>
- Date: Sat, 6 May 2006 12:09:30 -0700
It is most assuredly weak linked. The entire framework itself was
weak linked. nm shows the symbol as being weak linked and the address
of the symbol when printing it out is 0x0. The only thing that fails
is the NULL check.
Or are you saying that gcc knows nothing about the linker flags and
optimizes away an if check even though everything says it is weak
linked?
Ack, at 5/6/06, Alexei Kosut said:
Why is it completely skipping the if check? As I said, this exact
same code works fine on a PPC mac. If it matters, the PPC code is
being compiled with GCC 3.3.
Yes, it matters. GCC 3.3 would let you check any symbol against
NULL, but GCC 4.0 knows that the function has not been weak linked,
so optimizes away your check for NULL. If a symbol is to be
weak-linked, you should ensure it is declared with
__attribute__((weak_import)). This tells the compiler that a check
against NULL could be true.
--
Sincerely,
Rosyna Keller
Technical Support/Holy Knight/Always needs a hug
Unsanity: Unsane Tools for Insanely Great People
It's either this, or imagining Phil Schiller in a thong.
_______________________________________________
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