Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 09 Nov 1999 10:23:46 +0800
From:      Peter Wemm <peter@netplex.com.au>
To:        nate@mt.sri.com (Nate Williams)
Cc:        freebsd-hackers@FreeBSD.org
Subject:   Re: Using non-PIC code in shared libraries? 
Message-ID:  <19991109022346.8BA7B1C03@overcee.netplex.com.au>
In-Reply-To: Your message of "Mon, 08 Nov 1999 15:54:11 MST." <199911082254.PAA02935@mt.sri.com> 

next in thread | previous in thread | raw e-mail | index | archive | help
Nate Williams wrote:
> What happens when this is done?  Can it ever work?
> 
> How about the reverse, where you link in PIC compiled libraries into
> static (.a) libraries?  Does this work?
> 
> Assuming it works (in either case) are there any performance
> hits/advantages to either?
> 
> My impression from past discussions is that you can't use non-PIC code
> in shared libraries (it won't work), and that you can use PIC code in
> static libraries, but you take a performance hit for it...
> 
> Am I right?

You *can* use non-PIC for shared libraries, but the resulting code requires
text relocations at runtime which cause copy-on-write faults and kill any
shareability.  This might be acceptable if you are using .so's for
single-process plug-ins or something, but generally you wouldn't want it
for libc (for example. :-).  Of course, getting ld-elf.so and ld(1) to be
quiet about it is another thing altogether...

Cheers,
-Peter




To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19991109022346.8BA7B1C03>