Re: what does -fno-pic do

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 10/07/2016 16:15, Yubin Ruan wrote:

>      I am reading some OS kernel codes, and I find that in the Makefile 
> used to build the kernel, there is a **-fno-pic** flag. I totally don't 
> understand what that mean. I try to find some description from the man 
> pages but can find no direct description about that flag (same for the 
> **-fpic** flags).

Really? A search for gcc fpic returns many relevant results.

Here, pic stands for "position-independent code".

The latest gcc documentation states:
( https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html )

> -fpic
> 
> Generate position-independent code (PIC) suitable for use in a shared
> library, if supported for the target machine. Such code accesses all
> constant addresses through a global offset table (GOT). The dynamic
> loader resolves the GOT entries when the program starts (the dynamic
> loader is not part of GCC; it is part of the operating system). If
> the GOT size for the linked executable exceeds a machine-specific
> maximum size, you get an error message from the linker indicating
> that -fpic does not work; in that case, recompile with -fPIC instead.
> (These maximums are 8k on the SPARC, 28k on AArch64 and 32k on the
> m68k and RS/6000. The x86 has no such limit.)
> 
> Position-independent code requires special support, and therefore
> works only on certain machines. For the x86, GCC supports PIC for
> System V but not for the Sun 386i. Code generated for the IBM RS/6000
> is always position-independent.
> 
> When this flag is set, the macros __pic__ and __PIC__ are defined to 1.

Regards.




[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux