This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: What does -DPIC linker flag mean


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 Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]