When a Rust binary (executable or dylib) is created, the version information configured in Cargo.tomldoes not affect the binary structure, that is, the configured version is not saved inside the binary.
On Linux, when I use readelf -Vfor the .so file, you can see that the supported interface (SO Name) is stored in the Version Definition section .gnu.version_d ' ELF file. For example, the output readelf -V /lib/libnss_files-2.12.so:
Version definition section '.gnu.version_d' contains 2 entries:
Addr: 0x0000000000001540 Offset: 0x001540 Link: 5 (.dynstr)
000000: Rev: 1 Flags: BASE Index: 1 Cnt: 1 Name: libnss_files.so.2
0x001c: Rev: 1 Flags: none Index: 2 Cnt: 1 Name: GLIBC_PRIVATE
The file /lib/libnss_files-2.12.soimplements an interface versionlibnss_files.so.2
The output readelf -Vfor a created Rust or Cargo dylib or executable does not have this version information. Version configuration in is Cargo.tomlused only by crates.io.
In addition, Windows DLLs support storing version information rather than the version name of the SONAME interface, such as Linux. The cross-compiled Windows DLL also has no version information. Perhaps this is another question, but I thought I would raise it here first.
source
share