From owner-freebsd-hackers Fri Aug 29 21:06:05 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.7/8.8.7) id VAA17197 for hackers-outgoing; Fri, 29 Aug 1997 21:06:05 -0700 (PDT) Received: from dyson.iquest.net (dyson.iquest.net [198.70.144.127]) by hub.freebsd.org (8.8.7/8.8.7) with ESMTP id VAA17192 for ; Fri, 29 Aug 1997 21:05:57 -0700 (PDT) Received: (from root@localhost) by dyson.iquest.net (8.8.6/8.8.5) id XAA00224; Fri, 29 Aug 1997 23:05:22 -0500 (EST) From: "John S. Dyson" Message-Id: <199708300405.XAA00224@dyson.iquest.net> Subject: Re: PIC (was: shared libraries?) In-Reply-To: from Alfred Perlstein at "Aug 30, 97 03:01:45 am" To: perlsta@fang.cs.sunyit.edu (Alfred Perlstein) Date: Fri, 29 Aug 1997 23:05:22 -0500 (EST) Cc: hackers@FreeBSD.ORG Reply-To: dyson@FreeBSD.ORG X-Mailer: ELM [version 2.4ME+ PL31 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-freebsd-hackers@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk Alfred Perlstein said: > > Probably the most important factor in PIC is the instruction set. > > Many systems generate PIC by default, or with few constraints. The > > i386 architecture doesn't, unfortunately, and to generate PIC you have > > to do without a number of instructions or address modes. As a result, > > the code is less efficient. > > ummmm, as far as i know the 386 and beyond greatly reduced the addressing > restrictions placed on code, almost any register is avalable for > addressing and since you can load the PC into a register i don't see the > problem here. > Basically, PIC requires the use of an additional base register. That adds register pressure and complicates the needed addressing modes. There are only 6 or 7 registers to begin with on an X86. Please look at the code that gcc creates with the -fpic option. It isn't gcc's fault that the code looks more complex. It seems that the X86 could use at least a few more registers :-(, but there are always design tradeoffs. -- John dyson@freebsd.org jdyson@nc.com