ABI and API compatibility¶
The libgdiagnostics developers strive for ABI and API backward-compatibility: programs built against libgdiagnostics.so stand a good chance of running without recompilation against newer versions of libgdiagnostics.so, and ought to recompile without modification against newer versions of libgdiagnostics.h.
Note
The libgdiagnostics++.h C++ API is more experimental, and less locked-down at this time.
API compatibility is achieved by extending the API rather than changing it. For ABI compatiblity, we avoid bumping the SONAME, and instead use symbol versioning to tag each symbol, so that a binary linked against libgdiagnostics.so is tagged according to the symbols that it uses.
For example, diagnostic_logical_location_get_kind()
was added in
LIBGDIAGNOSTICS_ABI_1
. If a client program uses it, this can be detected
from metadata by using objdump
:
$ objdump -p testsuite/libgdiagnostics/test-logical-location.c.exe | tail -n 7
Version References:
required from libc.so.6:
0x09691a75 0x00 04 GLIBC_2.2.5
required from libgdiagnostics.so.0:
0x0ec567d1 0x00 03 LIBGDIAGNOSTICS_ABI_1
0x0ec567d0 0x00 02 LIBGDIAGNOSTICS_ABI_0
You can see the symbol tags provided by libgdiagnostics.so using objdump
:
$ objdump -p libgdiagnostics.so | less
[...snip...]
Version definitions:
1 0x01 0x099ea4b0 libgdiagnostics.so.0
2 0x00 0x0ec567d0 LIBGDIAGNOSTICS_ABI_0
3 0x00 0x0ec567d1 LIBGDIAGNOSTICS_ABI_1
LIBGDIAGNOSTICS_ABI_0
[...snip...]