Difference between pic Vs pie

28,323

From the gcc documentation:

-fpic
Generate position-independent code (PIC) suitable for use in a shared library...

-fpie
These options are similar to -fpic and -fPIC, but generated position independent code can be only linked into executables....

Share:
28,323

Related videos on Youtube

Vineet1982
Author by

Vineet1982

I am an Advocate, Owner and Developer at Cee Emm Infotech. I have not taken any kind of Computer Education. I love to do Programming and learn many Languages which are: C/C++ PHP MySQL VB6 JavaScript ASP [little bit] HTML5 Assembly [Currently Learning] With support of these I had developed and Launched Law CD's and the LawMirror.com (Online Legal Resources).

Updated on October 20, 2022

Comments

  • Vineet1982
    Vineet1982 over 1 year

    I am looking the options for Binary Encryption Code generation and found two options available that are PIC and PIE. I have tried for find the differences between both but didn't find suitable articles. If anybody can explain the difference with example with pros and corn or provide the link to the good article would be great to learn.

    My basic motive is to protect the compiled code as ELF/PE format can be attacked by virus or it can be hacked or with the help of reverse techniques can re-produce code. Kindly also provide any other means for protection of compiled code from attacks and d-compling.

    I am using GCC Compiler through Cygwin for building cross platform application.

  • Austin Adams
    Austin Adams about 5 years
    love reading the manpage and googling for more information out of curiosity and seeing the manpage again
  • Carl Norum
    Carl Norum about 5 years
    @AustinAdams - OP seemed satisfied with this answer. Do you have something more specific you want to know about? Maybe asking a new question here would be a good way to get at that?
  • saagarjha
    saagarjha over 3 years
    I suspect that the linked answer in the first comment above happens to a much better response to this question than the answer provided here.
  • lanza
    lanza about 3 years
    @CarlNorum this is the first result for a Google search for fPIC vs -fpie. This opportunity should be used to make the answer more helpful.