CFLAGS+= -fPIC per default?
jlfenton at citlink.net
Sun Feb 22 14:41:25 PST 2004
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
>The fundamental property of PIC , besides the fact that it's a
>complete misnomer, is that there are no relocations in the code
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.
More information about the freebsd-amd64