gcc -fPIC generates position independent code (PIC) for shared libraries.
$ gcc -fPIC [options] [source files] [object files] -o output file
Use -fpic instead of -fPIC to generate more efficient code, if supported by the platform compiler.
Write source file myfile.c:
// myfile.c
#include <stdio.h>
int
myfunc()
{
printf("myfunc\n");
}
Build myfile.c generates myfile.o:
$ gcc -fPIC -c myfile.c
$