3.5 Handling Compatible Changes (GNU) (4)
Since this code introduced a new version name the map file has to change, too.
由于这段代码引入了一个新的版本名,因此映射文件也必须更改。
VERS_1.0 {
global: index;
local: *;
};
VERS_2.0 {
global: index; indexp1;
} VERS_1.0;
The important points to note here are that index is men- tioned in more than one version, indexp1 only appears in VERS 2.0, the local: definitions only appear in the VERS 1.0 definition, and the definition of VERS 2.0 refers to VERS 1.0. The first point should be obvious: we want two versions of index to be available, this is what the source code says. The second point is also easy to under- stand: indexp1 is a new function and was not available when version 1 of the DSO was released. It is not nec- essary to mark the definition of indexp1 in the sources with a version name. Since there is only one definition the linker is able to figure this out by itself.
这里需要注意的重点是,索引在多个版本中被提及,indexp1只出现在VERS 2.0中,local:定义只出现在VERS 1.0定义中,而VERS 2.0的定义指的是VERS 1.0。第一点应该很明显:我们想要两个版本的索引可用,这是源代码所说的。第二点也很容易理解:indexp1是一个新函数,在DSO版本1发布时不可用。没有必要在源文件中用版本名标记indexp1的定义。因为只有一个定义,连接器能够自己解决这个问题。
(有道翻译)
todo:自己翻译