From owner-freebsd-amd64@FreeBSD.ORG Sun Feb 22 21:35:27 2004 Return-Path: Delivered-To: freebsd-amd64@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 941A816A4CE for ; Sun, 22 Feb 2004 21:35:27 -0800 (PST) Received: from canning.wemm.org (canning.wemm.org [192.203.228.65]) by mx1.FreeBSD.org (Postfix) with ESMTP id 8B42843D1F for ; Sun, 22 Feb 2004 21:35:27 -0800 (PST) (envelope-from peter@evilpete.dyndns.org) Received: from fw.wemm.org (canning.wemm.org [192.203.228.65]) by canning.wemm.org (Postfix) with ESMTP id 541E72A8EB for ; Sun, 22 Feb 2004 21:35:27 -0800 (PST) (envelope-from peter@overcee.wemm.org) Received: from overcee.wemm.org (unknown [10.0.0.3]) by fw.wemm.org (Postfix) with ESMTP id CA69C2C1AC for ; Sun, 22 Feb 2004 21:35:26 -0800 (PST) (envelope-from peter@overcee.wemm.org) Received: from overcee.wemm.org (localhost [127.0.0.1]) by overcee.wemm.org (8.12.11/8.12.10) with ESMTP id i1N5ZRpd036142; Sun, 22 Feb 2004 21:35:27 -0800 (PST) (envelope-from peter@overcee.wemm.org) Received: from localhost (localhost [[UNIX: localhost]]) by overcee.wemm.org (8.12.11/8.12.10/Submit) id i1N5ZRHl036141; Sun, 22 Feb 2004 21:35:27 -0800 (PST) (envelope-from peter) From: Peter Wemm To: freebsd-amd64@freebsd.org Date: Sun, 22 Feb 2004 21:35:26 -0800 User-Agent: KMail/1.6 References: <200402220033.01795.peter@wemm.org> <20040222185208.GA53610@dhcp01.pn.xcllnt.net> In-Reply-To: <20040222185208.GA53610@dhcp01.pn.xcllnt.net> MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <200402222135.26975.peter@wemm.org> Subject: Re: CFLAGS+= -fPIC per default? X-BeenThere: freebsd-amd64@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Porting FreeBSD to the AMD64 platform List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Feb 2004 05:35:27 -0000 On Sunday 22 February 2004 10:52 am, Marcel Moolenaar wrote: > On Sun, Feb 22, 2004 at 12:33:01AM -0800, Peter Wemm wrote: > > On Saturday 21 February 2004 07:43 pm, Hendrik Scholz wrote: > > > On Feb 21, 2004, at 9:59 PM, Christian Weisgerber wrote: > > > > Why are these shared objects not built with -fPIC in the first > > > > place? > > > > > > Ask the authors of the third party applications :) > > > Most architectures don't need -fPIC and/or it slows them down > > > (thanks for the > > > comment Peter!). > > > > Yes, exactly. Some folks thought it would be an idea to add a flag > > to libtool to force it to link non-pic code into shared libraries. > > Essentially this reduces the sharability since we do relocations on > > the text segment, but the flipside is that its faster on i386 and > > on some libraries they figured it was worth burning extra memory > > that would be wasted by not using -fPIC. > > Not to mention that people generally attach -fPIC to the kind of > library they are making and thus do not build with -fPIC if they > create an archive library (the BSD make infrastructure has this > too). This most of the time works, but not when the archive library > is subsequently linked *into* a shared library later on. So, the > use of -fPIC is determined by how the object files are eventually > used to make up a process and that's not always known to the person > writing the libraries, let alone some (in)convenience tools like > libtool or automake/autoconf. Since you mentioned the BSD make infrastructure.. thats what we produce the _pic.a files for. eg: libc_pic.a, libgcc_pic.a etc. We even have a Makefile knob for it.. INSTALL_PIC_ARCHIVE.. if I remember the name correctly. -- Peter Wemm - peter@wemm.org; peter@FreeBSD.org; peter@yahoo-inc.com "All of this is for nothing if we don't go to the stars" - JMS/B5