ELF = executable linkable format,可执行、链接格式。
Linux中的中ELF文件主要包括四类,也即:
1.a.out
2.core
3.so文件
4..o文件
上述1.2是可执行文件,3和4是可链接文件,所以1.2.3.4统称为可执行、链接文件,也就是ELF文件,分别看看:
taoge@localhost Desktop> file a.out
a.out: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), for GNU/Linux 2.6.4, dynamically linked (uses shared libs), for GNU/Linux 2.6.4, not stripped
taoge@localhost Desktop>
taoge@localhost Desktop> file core
core: ELF 32-bit LSB core file Intel 80386, version 1 (SYSV), SVR4-style, from 'a.out'
taoge@localhost Desktop>
taoge@localhost Desktop> file /lib/libc-2.4.so
/lib/libc-2.4.so: ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV), for GNU/Linux 2.6.4, not stripped
taoge@localhost Desktop>
taoge@localhost Desktop> file html_util.o
html_util.o: ELF 32-bit LSB relocatable, Intel 80386, version 1 (SYSV), not stripped
taoge@localhost Desktop>
问个问题,静态库是ELF文件吗?不是的!你用file命令看看就知道了,静态库只是.o文件的归档集合。