Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 22 Feb 2004 14:02:10 -0800
From:      Marcel Moolenaar <marcel@xcllnt.net>
To:        Joseph Fenton <jlfenton@citlink.net>
Cc:        freebsd-amd64@freebsd.org
Subject:   Re: CFLAGS+= -fPIC per default?
Message-ID:  <20040222220210.GA54064@dhcp01.pn.xcllnt.net>
In-Reply-To: <40391EC6.7010808@citlink.net>
References:  <20040222185212.EB6BE16A4D1@hub.freebsd.org> <40391EC6.7010808@citlink.net>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, Feb 22, 2004 at 02:27:34PM -0700, Joseph Fenton wrote:
> 
> Sorry to be anal, but PC-relative addressing is by definition
> position-independent code.

False.

The fundamental property of PIC , besides the fact that it's a
complete misnomer, is that there are no relocations in the code
segment. The operating system cannot share read-only segments if
the linker/loader has to modify it first to relocate it depending
on where segments are loaded in memory for each process. Across
processes the relative distance between two segments within the
same shared executable is not fixed. Therefore, PIC has not so
much to do with whether or not PC-relative addressing can be used
per se, as it has to do with how much the compiler/assembler knows
about the relative distance between addresses. In practice this
is not as much as it seems due to the tendency to make the unit
of compilation smaller.

> Sorry to nit-pick like this, but having worked on both Mac
> and Amiga ROMs, PIC mode under BSD really seems
> backwards to me.

It's no different than PIC on other OSes.

-- 
 Marcel Moolenaar	  USPA: A-39004		 marcel@xcllnt.net



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