Date: Sun, 22 Feb 2004 15:41:20 -0700 From: Joseph Fenton <jlfenton@citlink.net> To: Marcel Moolenaar <marcel@xcllnt.net>, freebsd-amd64@freebsd.org Subject: Re: CFLAGS+= -fPIC per default? Message-ID: <40393010.4090402@citlink.net> In-Reply-To: <20040222220210.GA54064@dhcp01.pn.xcllnt.net> References: <20040222185212.EB6BE16A4D1@hub.freebsd.org> <40391EC6.7010808@citlink.net> <20040222220210.GA54064@dhcp01.pn.xcllnt.net>
next in thread | previous in thread | raw e-mail | index | archive | help
Marcel Moolenaar wrote: >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. > You just proved my statement true. PC-relative code contains no relocation for within a code section. How do you think that conditional branches work? They do PC-relative jumps inside the code section. > 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. > > > I stated in my email that between two sections you'd have to use a table. That in no way invalidates the fact that within a section, PC-relative is position-independent. As shown in the code snippets, PC-relative is also 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. > > > You've obviously never looked at Mac or Amiga code. Not BSD on the Mac or Amiga, but Mac or Amiga code. You admit above that PIC on BSD is a complete misnomer.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?40393010.4090402>