What code generates gcc without the -fPIC key?
1) I do this:
# gcc -c p1.c
# file p1.o
conclusion:
p1.o: ELF 64-bit LSB relocatable, x86-64, version 1 (SYSV), not stripped relocatable after all means the position-independent code of the object file?
2)
# gcc -c -fPIC p1.c
# file p1.o
conclusion:
p1.o: ELF 64-bit LSB relocatable, x86-64, version 1 (SYSV), not stripped The conclusion is absolutely the same.
- It turns out for .so you can not specify
-fPIC? I apologize for the stupid question. - Is non-
-fPICcode position-independent?
-fpic Generate position-independent code (PIC) suitable for use in a shared library, if supported for the target machine. Such code accesses all constant addresses through a global offset table (GOT). The dynamic loader resolves the GOT entries when the program starts ... Position-independent code requires special support, .... . For the x86, GCC supports PIC for System V but not for the Sun 386i. Code generated for the IBM RS/6000 is always position-independent-fpic Generate position-independent code (PIC) suitable for use in a shared library, if supported for the target machine. Such code accesses all constant addresses through a global offset table (GOT). The dynamic loader resolves the GOT entries when the program starts ... Position-independent code requires special support, .... . For the x86, GCC supports PIC for System V but not for the Sun 386i. Code generated for the IBM RS/6000 is always position-independent-fpic Generate position-independent code (PIC) suitable for use in a shared library, if supported for the target machine. Such code accesses all constant addresses through a global offset table (GOT). The dynamic loader resolves the GOT entries when the program starts ... Position-independent code requires special support, .... . For the x86, GCC supports PIC for System V but not for the Sun 386i. Code generated for the IBM RS/6000 is always position-independent- avprelocatableis rather a relocatable (i.e. it can be configured to work from any address, but once configured it may not necessarily be used in other addresses (what is needed for .so))) avpно однажды настроенный он не обязательно м.б. использован в других адресахно однажды настроенный он не обязательно м.б. использован в других адресахcan reveal it? - Mike AJ