Where do object file “Version References” come from?

Or from something else?

From something else.

When you build a shared library (say libfoo.so), you can (though don’t have to) supply a linker version script giving certain symbols a version tag.

When you later link an executable or a shared library (say libbar.so) against libfoo.so, iff you use a versioned symbol, the version tag of that symbol is recorded in libbar.so (that is what you observed in your question).

This setup allows libfoo.so to change its symbols in ABI-incompatible way, and still support old client programs that were linked against the old symbols.

For example, libc.so.6 on x86_64 has the following versions of memcpy:

0000000000091620 g   iD  .text  000000000000003d  GLIBC_2.14  memcpy
000000000008c420 g   iD  .text  0000000000000047 (GLIBC_2.2.5) memcpy

Programs that were linked against glibc-2.13 or older will use the GLIBC_2.2.5 version, programs that were linked against glibc-2.14 or newer will use the GLIBC_2.14 version.

If you try to run a program linked against glibc-2.14 on a system with glibc-2.13, you will get an error (missing symbol version), similar to this.

Before the introduction of symbol versioning, changing the ABI of an existing symbol required that you ship an entirely separate library. This is called external library versioning. You can read more about it here.

Leave a Comment