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...]

ABI symbol tags

LIBGDIAGNOSTICS_ABI_0

All entrypoints in the initial release of libgdiagnostics (in GCC 15) are tagged with LIBGDIAGNOSTICS_ABI_0; these entrypoints are:

LIBGDIAGNOSTICS_ABI_1

LIBGDIAGNOSTICS_ABI_1 covers the addition of these functions for acccessing values within a diagnostic_logical_location:

LIBGDIAGNOSTICS_ABI_2

LIBGDIAGNOSTICS_ABI_2 covers the addition of these functions for supporting command-line options and SARIF playback:

LIBGDIAGNOSTICS_ABI_3

LIBGDIAGNOSTICS_ABI_3 covers the addition of these functions for working with directed graphs:

LIBGDIAGNOSTICS_ABI_4

LIBGDIAGNOSTICS_ABI_4 covers the addition of these functions for working with diagnostic_message_buffer.

LIBGDIAGNOSTICS_ABI_5

LIBGDIAGNOSTICS_ABI_5 covers the addition of this function: