From owner-freebsd-hackers Mon Nov 8 18:24: 0 1999 Delivered-To: freebsd-hackers@freebsd.org Received: from overcee.netplex.com.au (overcee.netplex.com.au [202.12.86.7]) by hub.freebsd.org (Postfix) with ESMTP id B5BD9150D1 for ; Mon, 8 Nov 1999 18:23:48 -0800 (PST) (envelope-from peter@netplex.com.au) Received: from netplex.com.au (localhost [127.0.0.1]) by overcee.netplex.com.au (Postfix) with ESMTP id 8BA7B1C03; Tue, 9 Nov 1999 10:23:46 +0800 (WST) (envelope-from peter@netplex.com.au) X-Mailer: exmh version 2.0.2 2/24/98 To: nate@mt.sri.com (Nate Williams) Cc: freebsd-hackers@FreeBSD.org Subject: Re: Using non-PIC code in shared libraries? In-reply-to: Your message of "Mon, 08 Nov 1999 15:54:11 MST." <199911082254.PAA02935@mt.sri.com> Date: Tue, 09 Nov 1999 10:23:46 +0800 From: Peter Wemm Message-Id: <19991109022346.8BA7B1C03@overcee.netplex.com.au> Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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