Re: Linker refuses to link my dylib? Why?
Re: Linker refuses to link my dylib? Why?
- Subject: Re: Linker refuses to link my dylib? Why?
- From: Ladd Van Tol <email@hidden>
- Date: Thu, 15 Feb 2007 15:03:33 -0800
On Feb 15, 2007, at 11:57 AM, Eric Albert wrote:
It definitely isn't supported. You can construct the code, but
dyld assumes that all libraries are relocatable, so if the library
has to be slid due to other things inserted into the process'
address space it'll go ahead and slide the library. If the library
is non-PIC, it'll run incorrectly when it's slid.
In other words, I'd strongly suggest that you not ship libraries
built non-PIC.
It is actually possible to preserve relocation entries in a dylib,
and have dyld rewrite them at runtime, allowing non-PIC code to
slide. You do have to pass "-read_only_relocs supress" to ld. I have
done this with Intel assembly that was written for Windows with
position-dependent code, and needed to be linked into a Mac Intel
dylib. This strategy is not really recommended, if you can avoid it,
as it will eliminate most of the virtual memory code-sharing benefits
that dylibs provide. I have not tried it with output from the C
compiler or with PPC code, so there may be other pitfalls as well.
PIC vs. non-PIC shouldn't be an issue on x86_64, as the instruction
set adds support for PC-relative addressing. Assuming the compiler
uses it, the speed hit of PIC should be minimal or non-existent on
x86_64.
_______________________________________________
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