3.5 Handling Compatible Changes (GNU) (3)
What remains to be explained is the use of @ and @@. The symbol defined using @@ is the default definition.
There must be at most one. It is the version of the symbol used in all linker runs involving the DSO. No symbol defined using @ are ever considered by the linker.
These are the compatibility symbols which are considered only by the dynamic linker.
剩下要解释的是@和@@的用法。使用@@定义的符号是默认定义。
最多只能有一个。它是在涉及DSO的所有链接器运行中使用的符号版本。链接器不会考虑使用@定义的任何符号。
这些是只被动态链接器考虑的兼容性符号。
(有道翻译)
In this example we define both versions of the symbol to use the same code.
We could have just as well kept the old definition of the function and added the new defini- tion.
This would have increased the code size but would provide exactly the same interface.
Code which calls the old version, index@VERS 1.0, would have produced un- specified behavior with the old DSO and now it would re- turn the same as a call to index@@VERS 2.0.
But since such a call is invalid anyway nobody can expect that the ABI does not change in this regard.
在这个例子中,我们定义了符号的两个版本来使用相同的代码。
我们也可以保留函数的旧定义,并添加新的定义。
这将增加代码的大小,但将提供完全相同的接口。
调用旧版本index@VERS 1.0的代码将产生旧DSO的未指定行为,现在它将返回与调用index@@VERS 2.0相同的结果。
但是,由于这样的调用无论如何都是无效的,所以没有人能指望ABI在这方面不会发生变化。
(有道翻译)
todo:自己翻译 仔细看一遍