Linkers, Loaders & Executables

On Linux, when is the version number in a shared library's soname, such as the ".1" in libfoo.so.1, generally increased?

  1. AWhenever even one bug is fixed
  2. BWhen the library file is moved to another directory
  3. CWhen a change breaks ABI compatibility with old programs, such as altering function arguments or struct layouts
Show answer and explanation

Answer: C. When a change breaks ABI compatibility with old programs, such as altering function arguments or struct layouts

A dynamically linked program uses, at run time, the shared library named by its soname. A compatible fix keeps the same soname, so replacing the file updates every program. Changing argument types or struct sizes, however, would make old programs call with wrong assumptions, so the soname number is raised to treat it as a different library that can be installed alongside the old one.

  • A. Compatible fixes keep the same number.
  • B. Location has nothing to do with the version.
  • C. Correct. It prevents old programs from picking up the incompatible version.
Practice this topic Back to topic

More Linkers, Loaders & Executables questions

  1. What does running the ldd command on an executable on Linux show?
  2. Which pairs major operating systems with the executable formats they use correctly?
  3. When recursion goes so deep that it exceeds the stack limit, what generally happens on Linux and similar systems?
  4. In C, what is true of the starting values of a local variable and a global variable declared without initializers?
  5. After repeated malloc and free, a large block may become impossible to allocate even though total free memory is sufficient. What is this phenomenon called?