سؤال

In a particular project, I saw the following compiler options used all at once:

gcc foo.c -o foo.o -Icomponent1/subcomponent1 -Icomponent2/subcomponent1 -Wall -fPIC -s

Are the -fPIC and -s used together contradictory here? If not, why?

هل كانت مفيدة؟

المحلول

-s and -fPIC are two flags used for different purposes. They are not contradictory.

From the gcc manual

-s Remove all symbol table and relocation information from the executable.

-fPIC If supported for the target machine, emit position-independent code, suitable for dynamic linking and avoiding any limit on the size of the global offset table. This option makes a difference on the m68k, PowerPC and SPARC.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top