用nm察看elf文件时,会输出各种符号,其中有两种符号,比较特别
"V"
"v" The symbol is a weak object. When a weak defined symbol is linked with a normal defined
symbol, the normal defined symbol is used with no error. When a weak undefined symbol is
linked and the symbol is not defined, the value of the weak symbol becomes zero with no error.
On some systems, uppercase indicates that a default value has been specified.
"W"
"w" The symbol is a weak symbol that has not been specifically tagged as a weak object symbol.
When a weak defined symbol is linked with a normal defined symbol, the normal defined symbol
is used with no error. When a weak undefined symbol is linked and the symbol is not defined,
the value of the symbol is determined in a system-specific manner without error. On some
systems, uppercase indicates that a default value has been specified.
上面是nm的manpage内容,只描述了what,没有why
在网上搜索许久,只能看到what和how,也没有讲why
不行,我要知其然更知其所以然
于是在wikipedia上找到了答案
简言之,就是一种link-time的overloading
原文地址:http://blog.csdn.net/happen23/article/details/45023609