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....