Linux gcc 컴파일러 옵션 정리

|
Shared and static libraries information

Linux
Version [kernel 2.x, GCC 2.95.x and later]
1 compiler flag (position independent code) -fPIC
2a shared library creation flag -shared
2b shared library creation (C++) g++ -fPIC -shared -o
2c static archiver (C++) ar
3a library name (ld option) -soname name
3b file extension .so
4 executable link options -Bdynamic
-Lpath -lname
5a runtime path specification -rpath <path>
5b Does not build the path for shared libraries into the executable default
6 controlling symbols using a script file (see "info ld")

Linux
7 exports file/link option
(see notes)
using a script file (see "info ld")
8 hiding symbols using a script file: VERSION command (see "Version Script" section in "info ld")
9 runtime library path LD_LIBRARY_PATH
10 symbol binding -Bsymbolic
11 runtime debugging (c.f. man ld.so)
LD_BIND_NOW
LD_TRACE_LOADED_OBJECTS
LD_DEBUG=help
ltrace
12 runtime preload LD_PRELOAD
13 loader ld.so
14 runtime performance xxxx

Linux
15 versioning using a script file: VERSION command (see "info ld")
16 entry points xxxx
17 dynamic loading /
dynamic symbol access
dlopen / dlsym
18 utilities ldd, ldconfig, objdump, ltrace, readelf
19 documentation man: ld, ld.so, ldd
info: ld, gcc, binutil
HOWTO: ELF-HOWTO, GCC-HOWTO

Linux
And