Re: What does -DPIC linker flag mean

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

 



Sameer Naik wrote:

>     i would like to know what -DPIC linker flag mean. Tried to search in
> the gcc man page, but couldnt find.
> I've seen its usage as -fPIC -DPIC and id like to know whats it for..

It is not a linker flag, it is a preprocessor flag.  It defines the PIC
macro, the equivalent of "#define PIC 1", just like any other regular
preprocessor macro or -D option.  What that actually means would depend
on the specific code being compiled.

I would hazard a guess that this flag is automatically supplied by
libtool just in case the object may need this knowledge, but that it
isn't actually needed or utilized much.  You'd have to search the code
being compiled for any "#if PIC" or "#ifdef PIC"-type constructs.  From
a quick search at
<http://www.google.com/codesearch?hl=en&lr=&q=%22%23ifdef+PIC%22> it
would appear that this is used mainly when inline assembler is involved,
so that a version can be included that uses the GOT.

Brian

[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