`-shared‘ Produce ashared object which can then be linked with other objects toform an executable. Not allsystems support this option. Forpredictable results, you must also specify the same set ofoptions that were used to generate code (`-fpic‘, `-fPIC‘, or modelsuboptions) when you specify this option.(1)
gccmanul上面有说 -fpic If the GOTsize for the linked executable exceeds a machine-specific maximumsize, you get an error message from the linker indicating that-fpic does not work; in that case, recompile
with -fPIC instead.(These maximums are 8k on the SPARC and 32k on the m68k andRS/6000. The 386 has no such limit.)
-fPIC Ifsupported for the target machine, emit position-independent code,suitable for dynamic linking and avoiding any limit on the size ofthe global offset table. This option makes a difference
on them68k, PowerPC and SPARC. Position-independent code requires specialsupport, and therefore works only on certainmachines.