ABIDIFF(1)
π
ABIDIFF β the abidiff(1) glow-up
okay so bestie, welcome to abidiff, a Libabigail icon. she compares ABIs of ELF files and she does NOT miss. let's get into it π«Ά
β¨ NAME β¨
abidiff β compare ABIs of ELF files.
abidiff compares the Application Binary Interfaces (ABI) of two shared libraries in ELF format. she emits a meaningful report describing the differences between the two ABIs. like, a whole report. not a vibe, an actual report π
this tool can also compare the textual representations of the ABI of two ELF binaries (as emitted by abidw) or an ELF binary against a textual representation of another ELF binary. so many combos, all valid, all slaying β¨
for a comprehensive ABI change report between two input shared libraries that includes changes about function and variable sub-types, abidiff uses by default debug information in DWARF format, if present, otherwise it compares interfaces using debug information in CTF or BTF formats, if present. finally, if no debug info in these formats is found, it only considers ELF symbols and report about their addition or removal. that's the fallback era and honestly? she still shows up πΈ
this tool uses the libabigail library to analyze the binary as well as its associated debug information. here is its general mode of operation π
when instructed to do so, a binary and its associated debug information is read and analyzed. to that effect, libabigail analyzes by default the descriptions of the types reachable by the interfaces (functions and variables) that are visible outside of their translation unit. once that analysis is done, an Application Binary Interface Corpus is constructed by only considering the subset of types reachable from interfaces associated to ELF symbols that are defined and exported by the binary. it's that final ABI corpus which libabigail considers as representing the ABI of the analyzed binary. that's the whole main character arc, no cap.
libabigail then has capabilities to generate textual representations of ABI Corpora, compare them, analyze their changes and report about them. she contains multitudes π
π INVOCATION π
abidiff [options] <first-shared-library> <second-shared-library>
that's it. that's the whole summoning ritual. two libraries, one comparison π¦
π ENVIRONMENT π
abidiff loads two default suppression specifications files, merges their content and use it to filter out ABI change reports that might be considered as false positives to users. she's protecting your peace, honestly π
- Default system-wide suppression specification file
it's located by the optional environment variable LIBABIGAIL_DEFAULT_SYSTEM_SUPPRESSION_FILE. if that environment variable is not set, then abidiff tries to load the suppression file $libdir/libabigail/libabigail-default.abignore. if that file is not present, then no default system-wide suppression specification file is loaded. no file, no problem π
- Default user suppression specification file
it's located by the optional environment LIBABIGAIL_DEFAULT_USER_SUPPRESSION_FILE. if that environment variable is not set, then abidiff tries to load the suppression file $HOME/.abignore. if that file is not present, then no default user suppression specification is loaded. bestie really said "respect the home directory" π
- Parallel processing
the environment variable ABIGAIL_THREAD_POOL_SIZE can be set to either an integer, or a percentage value, e.g, 10%. the integer value defines the number of threads used by Libabigail to perform parallel processing when applicable. the percentage defines the percentage of the total available cores to use by Libabigail to perform the parallel processing when applicable.
by default, Libabigail uses all the available cores to perform its parallel processing. all of them. every single one. she's an overachiever and we love her for it π₯
β¨ OPTIONS β¨
there are a LOT of these and we're not skipping a single one, so hydrate and stay with me π
--add-binaries1 <bin1,bin2,bin3,..>β for each of the comma-separated binaries given in argument to this option, if the binary is found in the directory specified by the--added-binaries-dir1option, thenabidiffloads the ABI corpus of the binary and adds it to a set of corpora (called an ABI Corpus Group) that includes the first argument ofabidiff.
that ABI corpus group is then compared against the second corpus group given in argument to abidiff. squad assemble π«Ά
--add-binaries2 <bin1,bin2,bin3,..>β for each of the comma-separated binaries given in argument to this option, if the binary is found in the directory specified by the--added-binaries-dir2option, thenabidiffloads the ABI corpus of the binary and adds it to a set of corpora (called an ABI Corpus Group) that includes the second argument ofabidiff.
that ABI corpus group is then compared against the first corpus group given in argument to abidiff. same energy, other side of the comparison β¨
--added-binaries-dir1|--abd1 <added-binaries-directory-1>β this option is to be used in conjunction with the--add-binaries1,--follow-dependenciesand--list-dependenciesoptions. binaries referred to by these options, if found in the directory added-binaries-directory-1, are loaded as ABI corpus and are added to the first ABI corpus group that is to be used in the comparison. she's the designated meeting spot π--added-binaries-dir2|--abd2 <added-binaries-directory-2>β this option is to be used in conjunction with the--add-binaries2,--follow-dependenciesand--list-dependenciesoptions. binaries referred to by these options, if found in the directory added-binaries-directory-2, are loaded as ABI corpus and are added to the second ABI corpus group to be used in the comparison. twin behavior, second group, iconic π--added-fnsβ in the resulting report about the differences between first-shared-library and second-shared-library, only display the globally defined functions that were added to second-shared-library. only the new ones. nothing else invited πΈ--added-varsβ in the resulting report about the differences between first-shared-library and second-shared-library, only display the global variables that were added (defined) to second-shared-library. yes, added and defined. both. she said no ambiguity π¦--allow-non-exported-interfacesβ when looking at the debug information accompanying a binary, this tool analyzes the descriptions of the types reachable by the interfaces (functions and variables) that are visible outside of their translation unit. once that analysis is done, an ABI corpus is constructed by only considering the subset of types reachable from interfaces associated to ELF symbols that are defined and exported by the binary. it's those final ABI Corpora that are compared by this tool.
the problem with that approach however is that analyzing all the interfaces that are visible from outside their translation unit can amount to a lot of data, especially when those binaries are applications, as opposed to shared libraries. one example of such applications is the Linux Kernel. analyzing massive ABI Corpora like these can be extremely slow. like, extremely. bring a snack, bring a blanket, bring a whole personality π
in the presence of an "average sized" binary however one can afford having libabigail analyze all interfaces that are visible outside of their translation unit, using this option. average sized = manageable, bestie π
β note that this option is turned on by default, unless we are in the presence of the Linux Kernel.
--btfβ when comparing binaries, extract ABI information from BTF debug information, if present. if present, okurrr π--changed-fnsβ in the resulting report about the differences between first-shared-library and second-shared-library, only display the changes in sub-types of the global functions defined in first-shared-library. glow-ups only, no debuts π--changed-varsβ in the resulting report about the differences between first-shared-library and second-shared-library, only display the changes in the sub-types of the global variables defined in first-shared-library. same rules, variable edition π--ctfβ when comparing binaries, extract ABI information from CTF debug information, if present. CTF girlies rise πΈ--debug-info-dir1|--d1 <di-path1>β for cases where the debug information for first-shared-library is split out into a separate file, tellsabidiffwhere to find that separate debug information file.
note that di-path must point to the root directory under which the debug information is arranged in a tree-like manner. under Red Hat based systems, that directory is usually <root>/usr/lib/debug. tree-like arrangement, very organizational of her π³
this option can be provided several times with different root directories. in that case, abidiff will potentially look into all those root directories to find the split debug info for first-shared-library. she will check every single one, thorough queen π
π note also that this option is not mandatory for split debug information installed by your system's package manager because then abidiff knows where to find it. she already has the address, basically.
--debug-info-dir2|--d2 <di-path2>β like--debug-info-dir1, this options tellsabidiffwhere to find the split debug information for the second-shared-library file.
this option can be provided several times with different root directories. in that case, abidiff will potentially look into all those root directories to find the split debug info for second-shared-library. matching set, second file, still slaying β¨
--debug-self-comparisonβ in this mode, error messages are emitted for types which fail type canonicalization, in some circumstances, when comparing a binary against itself.
when comparing a binary against itself, canonical types of the second binary should be equal (as much as possible) to canonical types of the first binary. when some discrepancies are detected in this mode, an abort signal is emitted and execution is halted. like, she will literally stop. abort signal. halted. π this option should be used while executing the tool in a debugger, for troubleshooting purposes.
this is an optional debugging and sanity check option. to enable it the libabigail package needs to be configured with the βenable-debug-self-comparison configure option. no flag, no feature, that's the deal π
--debug-tcβ in this mode, the process of type canonicalization is put under heavy scrutiny. basically, during type canonicalization, each type comparison is performed twice: once in a structural mode (comparing every sub-type member-wise), and once using canonical comparison. the two comparisons should yield the same result. otherwise, an abort signal is emitted and the process can be debugged to understand why the two kinds of comparison yield different results. double-checked, and if the vibes don't match β abort π
this is an optional debugging and sanity check option. to enable it the libabigail package needs to be configured with the βenable-debug-type-canonicalization configure option. again: configure option or it didn't happen π
--deleted-fnsβ in the resulting report about the differences between first-shared-library and second-shared-library, only display the globally defined functions that got deleted from first-shared-library. rest in peace to those functions, they served ποΈ--deleted-varsβ β¦and this one continues in the next part, bestie, don't go anywhere π¦
β¦and in the resulting report about the differences between first-shared-library and second-shared-library, youβre only showing the globally defined variables that got deleted from first-shared-library. Slay β no extra noise. π
--drop <regex>β When reading thefirst-shared-libraryandsecond-shared-libraryELF input files, drop the globally defined functions and variables whose name matches the regular expression regex. Result? No change involving those functions or variables gets emitted in the diff report. π«Ά--drop-fn <regex>β When reading thefirst-shared-libraryandsecond-shared-libraryELF input files, drop the globally defined functions whose name matches the regular expression regex. Result? No change involving those functions gets emitted in the diff report. β¨--drop-var <regex>β When reading thefirst-shared-libraryandsecond-shared-libraryELF input files, drop the globally defined variables matching the regular expression regex. π--drop-private-typesβ This option is to be used with the--headers-dir1,header-file1,header-file2and--headers-dir2options. With this option, types that are NOT defined in the headers are entirely dropped from the internal representation build by Libabigail to represent the ABI. They thus donβt have to be filtered out from the final ABI change report because they are not even present in Libabigailβs representation. π
Without this option, though, those private types are kept in the internal representation and later filtered out from the report.
This option thus potentially makes Libabigail consume less memory. Itβs meant to be mainly used to optimize the memory consumption of the tool on binaries with a lot of publicly defined and exported types. π§
--dump-diff-treeβ After the diff report, emit a textual representation of the diff nodes tree used by the comparison engine to represent the changed functions and variables. That representation is emitted to the error output for debugging purposes. Note that this diff tree is relevant only to functions and variables that have some sub-type changes. Added or removed functions and variables do not have any diff nodes tree associated to them. π₯--exported-interfaces-onlyβ By default, when looking at the debug information accompanying a binary, this tool analyzes the descriptions of the types reachable by the interfaces (functions and variables) that are visible outside of their translation unit. Once that analysis is done, an ABI corpus is constructed by only considering the subset of types reachable from interfaces associated to ELF symbols that are defined and exported by the binary. Itβs those final ABI Corpora that are compared by this tool. π
The problem with that approach, bestie, is that analyzing all the interfaces visible from outside their translation unit can amount to a lot of data β especially when those binaries are applications instead of shared libraries. One example of such applications is the Linux Kernel. Analyzing massive ABI corpora like these can be extremely slow. π
To mitigate that performance issue, this option allows libabigail to only analyze types that are reachable from interfaces associated with defined and exported ELF symbols.
Note that this option is turned on by default when analyzing the Linux Kernel. Otherwise, itβs turned off by default. π
--fail-no-debug-infoβ If no debug info was found, then this option makes the program fail. Otherwise, without this option, the program will attempt to compare properties of the binaries that are not related to debug info, like pure ELF properties. π--follow-dependencies|--fdepsβ For each dependency of the first argument ofabidiff, if itβs found in the directory specified by the--added-binaries-dir1option, then construct an ABI corpus out of the dependency, add it to a set of corpora (called an ABI Corpus Group) that includes the first argument ofabidiff. π¦
Similarly, for each dependency of the second argument of abidiff, if itβs found in the directory specified by the --added-binaries-dir2 option, then construct an ABI corpus out of the dependency, add it to an ABI corpus group that includes the second argument of abidiff.
These two ABI corpus groups are then compared against each other.
Said otherwise: this makes abidiff compare the set of its first input and its dependencies against the set of its second input and its dependencies. πΈ
--harmlessβ In the diff report, display only the harmless changes. By default, the harmless changes are filtered out of the diff report to keep the clutter to a minimum and give you a greater chance to spot real ABI issues. π- *
--headers-dir1|--hd1*<headers-directory-path-1> ** β Specifies where to find the public headers of the first shared library (or binary in general) that the tool has to consider. The tool will thus filter out ABI changes on types that are not defined in public headers. π
Note that several public header directories can be specified for the first shared library. In that case the --headers-dir1 option should be present several times on the command line, like in the following example:
$ abidiff --headers-dir1 /some/path \
--headers-dir1 /some/other/path \
binary-version-1 binary-version-2
- *
--headers-dir2|--hd2*<headers-directory-path-2> ** β Specifies where to find the public headers of the second shared library that the tool has to consider. The tool will thus filter out ABI changes on types that are not defined in public headers. π¦
Note that several public header directories can be specified for the second shared library. In that case the --headers-dir2 option should be present several times like in the following example:
$ abidiff --headers-dir2 /some/path \
--headers-dir2 /some/other/path \
binary-version-1 binary-version-2
- *
--header-file1|--hf1*<header-file-path-1> ** β Specifies where to find one public header of the first shared library that the tool has to consider. The tool will thus filter out ABI changes on types that are not defined in public headers. β¨ - *
--header-file2|--hf2*<header-file-path-2> ** β Specifies where to find one public header of the second shared library that the tool has to consider. The tool will thus filter out ABI changes on types that are not defined in public headers. πΈ --help|-hβ Display a short help about the command and exit. π«Ά--ignore-sonameβ Ignore differences in the SONAME when doing a comparison. π--impacted-interfacesβ When showing leaf changes, this option instructsabidiffto show the list of impacted interfaces. This option is thus to be used in addition to the--leaf-changes-onlyoption; otherwise, itβs ignored. π--keep <regex>β When reading thefirst-shared-libraryandsecond-shared-libraryELF input files, keep the globally defined functions and variables whose names match the regular expression regex. All other functions and variables are dropped on the floor and will thus not appear in the resulting diff report. π₯--keep-fn <regex>β When reading thefirst-shared-libraryandsecond-shared-libraryELF input files, keep the globally defined functions whose name matches the regular expression regex. All other functions are dropped on the floor and will thus not appear in the resulting diff report. π--keep-var <regex>β When reading thefirst-shared-libraryandsecond-shared-libraryELF input files, keep the globally defined variables whose names match the regular expression regex. All other variables are dropped on the floor and will thus not appear in the resulting diff report. π- *
--kmi-whitelist|-w*<path-to-whitelist> ** β When analyzing a Linux kernel binary, this option points to the white list of names of ELF symbols of functions and variables whose ABI must be considered. That white list is called a βKernel Module Interface white listβ. This is because for the Kernel, we donβt talk about ABI; we rather talk about the interface between the Kernel and its module. Hence the term KMI rather than ABI. π§
Any other function or variable whose ELF symbol is not present in that white list will not be considered by this tool.
If this option is not provided β thus if no white list is provided β then the entire KMI, that is, the set of all publicly defined and exported functions and global variables by the Linux Kernel binaries, is considered. π
--leaf-changes-only|-lβ Only show leaf changes, so donβt show the impact analysis report. This option implies--redundant. π
The typical output of abidiff when comparing two binaries looks like this:
$ abidiff libtest-v0.so libtest-v1.so
Functions changes summary: 0 Removed, 1 Changed, 0 Added function
Variables changes summary: 0 Removed, 0 Changed, 0 Added variable
1 function with some indirect sub-type change:
[C]'function void fn(C&)' at test-v1.cc:13:1 has some indirect sub-type changes:
parameter 1 of type 'C&' has sub-type changes:
in referenced type 'struct C' at test-v1.cc:7:1:
type size hasn't changed
1 data member change:
type of 'leaf* C::m0' changed:
in pointed to type 'struct leaf' at test-v1.cc:1:1:
type size changed from 32 to 64 bits
1 data member insertion:
'char leaf::m1', at offset 32 (in bits) at test-v1.cc:4:1
$
So in that example the report emits information about how the data member insertion change of βstruct leafβ is reachable from function βvoid fn(C&)β. In other words, the report not only shows the data member change on βstruct leafβ, but it also shows the impact of that change on the function βvoid fn(C&)β. ππ
Okay so in abidiff parlance, the change on struct leaf is literally called a leaf change π. So the --leaf-changes-only --impacted-interfaces options show, well, only the leaf change. And it goes like this:
$ abidiff -l libtest-v0.so libtest-v1.so
'struct leaf' changed:
type size changed from 32 to 64 bits
1 data member insertion:
'char leaf::m1', at offset 32 (in bits) at test-v1.cc:4:1
one impacted interface:
function void fn(C&)
$
See how the report wraps up by showing the list of interfaces impacted by the leaf change? π
Now if you donβt want to see that list of impacted interfaces, just avoid using the --impacted-interface option. You can learn about that option below in any case, bestie.
--list-dependencies,--ldepsβ lists all the dependencies of the input arguments of abidiff that are found in the directories specified by the options--added-binaries-dir1and--added-binaries-dir2π«Ά--no-added-symsβ in the resulting report about the differences between first-shared-library and second-shared-library, donβt display added functions or variables. Donβt display added functions or variables ELF symbols either. All other kinds of changes are displayed unless they are explicitly forbidden by other options on the command line.--no-assume-odr-for-cplusplusβ when analyzing a binary originating from C++ code using DWARF debug information, libabigail assumes the One Definition Rule to speed-up the analysis. In that case, when several types have the same name in the binary, they are assumed to all be equal. This option disables that assumption and instructs libabigail to actually compare the types to determine if they are equal. π--no-architectureβ do not take architecture into account when comparing ABIs.--no-change-categorization,-xβ disables the categorization of changes into harmless and harmful changes. Note that this categorization is a pre-requisite for the filtering of changes, so this option disables that filtering too. The goal here is to speed-up execution for cases where the graph of changes is huge and the user is just interested in looking at, for instance, leaf node changes without caring about their possible impact on interfaces. In that case, use this option along with the--leaf-changes-onlyone. β‘--no-corpus-pathβ do not emit the path attribute for the ABI corpus.--no-default-suppressionβ do not load the default suppression specification files.--no-harmfulβ in the diff report, do not display the harmful changes. By default, only the harmful changes are displayed in the diff report.--no-leverage-dwarf-factorizationβ when analyzing a binary whose DWARF debug information was processed with the DWZ tool, the type information is supposed to already be factorized. libabigail uses that context to perform some speed optimizations. This option disables those optimizations. π§--no-linkage-nameβ in the resulting report, do not display the linkage names of the added, removed, or changed functions or variables.--no-linux-kernel-modeβ without this option, if abidiff detects that the binaries it is looking at are Linux Kernel binaries (either vmlinux or modules), then it only considers functions and variables whose ELF symbols are listed in the__ksymtaband__ksymtab_gplsections. With this option, abidiff considers the binary as a non-special ELF binary, so it considers functions and variables that are defined and exported in the ELF sense. π§--no-redundantβ in the diff report, do NOT display redundant changes. A redundant change is a change that has been displayed elsewhere in the report. This option is switched on by default.--no-show-locsβ do not show information about where in the second shared library the respective type was changed.--no-show-num-filtered-data-membersβ in the change report, do not show the number of filtered data members.--no-show-relative-offset-changesβ without this option, when the offset of a data member changes, the change report not only mentions the older and newer offset, it also mentions by how many bits the data member changes. With this option, that last part is not shown.--no-unreferenced-symbolsβ in the resulting report, do not display change information about function and variable symbols that are not referenced by any debug information. Note that for these symbols not referenced by any debug information, the change information displayed is either added or removed symbols.--non-reachable-types,-tβ analyze and emit change reports for all the types of the binary, including those that are not reachable from global functions and variables. This option might incur some serious performance degradation because the number of types analyzed can be huge π. However, if paired with the--headers-dir{1,2}and/orheader-file{1,2}options, the additional non-reachable types analyzed are restricted to those defined in public headers files, hopefully making the performance hit acceptable. Also, using this option alongside suppression specifications (by also using the--suppressionsoption) might help keep the number of analyzed types (and the potential performance degradation) in control. Note that without this option, only types that are reachable from global functions and variables are analyzed, so the tool detects and reports changes on these reachable types only.--redundantβ in the diff report, do display redundant changes. A redundant change is a change that has been displayed elsewhere in the report.--show-bitsβ show sizes and offsets in bits, not bytes. This option is activated by default. π--show-bytesβ show sizes and offsets in bytes, not bits. By default, sizes and offsets are shown in bits.--show-decβ show sizes and offsets in decimal base. This option is activated by default.--show-hexβ show sizes and offsets in hexadecimal base.--statβ rather than displaying the detailed ABI differences between first-shared-library and second-shared-library, just display some summary statistics about these differences. π--statsβ emit statistics about various internal things.--suppressions,--supprpath-to-suppressions β use a suppression specification file located at path-to-suppressions. Note that this option can appear multiple times on the command line. In that case, all of the provided suppression specification files are taken into account. Please note that, by default, if this option is not provided, then the default suppression specification files are loaded.--symtabsβ only display the symbol tables of first-shared-library and second-shared-library.--thread-pool-sizeN|N%,-jN|N% β set the size of the thread pool used by Libabigail for parallel processing. The size is either the number of threads or a percentage of the total number of available cores on the machine. By default, all the available cores of the machine are used for parallel processing. Note that the environment variableABIGAIL_THREAD_POOL_SIZEcan also be set to similar values. This command line option, if present, supersedes the value of the environment variable. π₯--verboseβ emit verbose logs about the progress of miscellaneous internal things.--version,-vβ display the version of the program and exit.
β¨ RETURN VALUES β¨
The exit code of the abidiff command is either 0 if the ABI of the binaries being compared are equal, or non-zero if they differ or if the tool encountered an error. π€
In the latter case, the exit code is an 8-bit-wide bit field in which each bit has a specific meaning:
- The first bit, of value
1, namedABIDIFF_ERRORβ means there was an error. - The second bit, of value
2, namedABIDIFF_USAGE_ERRORβ means there was an error in the way the user invoked the tool. It might be set, for instance, if the user invoked the tool with an unknown command line switch, with a wrong number or argument, etc. If this bit is set, then theABIDIFF_ERRORbit must be set as well. - The third bit, of value
4, namedABIDIFF_ABI_CHANGEβ means the ABI of the binaries being compared are different. - The fourth bit, of value
8, namedABIDIFF_ABI_INCOMPATIBLE_CHANGEβ means the ABI of the binaries compared are different in an incompatible way. If this bit is set, then theABIDIFF_ABI_CHANGEbit must be set as well. IfABIDIFF_ABI_CHANGEis set andABIDIFF_INCOMPATIBLE_CHANGEis NOT set, then it means the ABIs being compared might or might not be compatible. In that case, a human being needs to review the ABI changes to decide if they are compatible or not. π
Note that, at the moment, there are only a few kinds of ABI changes that would result in setting the flag ABIDIFF_ABI_INCOMPATIBLE_CHANGE. Those ABI changes are either:
- the removal of the symbol of a function or variable that has been defined and exported.
- the modification of the index of a member of a virtual function table (for C++ programs and libraries).
With time, when more ABI change patterns are found to always constitute incompatible ABI changes, we will adapt the code to recognize those cases and set the ABIDIFF_ABI_INCOMPATIBLE_CHANGE accordingly. So, if you find such patterns, please let us know. π«Ά The remaining bits are not used for the moment.
πΈ USAGE EXAMPLES πΈ
okay bestie, grab a lil snack because these are the actual receipts β six real scenarios, copy-paste ready, no cap π
1. Detecting an ABI change in a sub-type of a function:
so like, this one's the classic "oops we slipped a base class in there" situation π«Ά
$ cat -n test-v0.cc
1 // Compile this with:
2 // g++ -g -Wall -shared -o libtest-v0.so test-v0.cc
3
4 struct S0
5 {
6 int m0;
7 };
8
9 void
10 foo(S0* /*parameter_name*/)
11 {
12 // do something with parameter_name.
13 }
$
$ cat -n test-v1.cc
1 // Compile this with:
2 // g++ -g -Wall -shared -o libtest-v1.so test-v1.cc
3
4 struct type_base
5 {
6 int inserted;
7 };
8
9 struct S0 : public type_base
10 {
11 int m0;
12 };
13
14 void
15 foo(S0* /*parameter_name*/)
16 {
17 // do something with parameter_name.
18 }
$
$ g++ -g -Wall -shared -o libtest-v0.so test-v0.cc
$ g++ -g -Wall -shared -o libtest-v1.so test-v1.cc
$
$ abidiff libtest-v0.so libtest-v1.so; echo "exit code: $?"
Functions changes summary: 0 Removed, 1 Changed, 0 Added function
Variables changes summary: 0 Removed, 0 Changed, 0 Added variable
1 function with some indirect sub-type change:
[C]'function void foo(S0*)' has some indirect sub-type changes:
parameter 0 of type 'S0*' has sub-type changes:
in pointed to type 'struct S0':
size changed from 32 to 64 bits
1 base class insertion:
struct type_base
1 data member change:
'int S0::m0' offset changed from 0 to 32
exit code: 4
$
note how the exit code is 4 β that means the third bit ABIDIFF_ABI_CHANGE, value 4, is set to 1 β¨ which means the tool categorizes the ABI change as harmful and thus requires a user review π like, go look at it, bestie.
2. Detecting an incompatible ABI change in the type of a function:
this one's the spicy one π₯ return type got thicc, and that is literally an ABI break π«
$ cat -n test-v0.cc
1 // Compile this with:
2 // g++ -g -Wall -shared -o libtest-v0.so test-v0.cc
3
4 struct S0
5 {
6 int m0;
7 };
8
9 S0
10 foo()
11 {
12 S0 s = {};
13 return s;
14 }
$
$ cat -n test-v1.cc
1 // Compile this with:
2 // g++ -g -Wall -shared -o libtest-v1.so test-v1.cc
3
4 struct type_base
5 {
6 int inserted;
7 };
8
9 struct S0 : public type_base
10 {
11 int m0;
12 };
13
14 S0
15 foo()
16 {
17 S0 s = {};
18 return s;
19 }
$
$ g++ -g -Wall -shared -o libtest-v0.so test-v0.cc
$ g++ -g -Wall -shared -o libtest-v1.so test-v1.cc
$
$ abidiff libtest-v0.so libtest-v1.so; echo "exit code: $?"
Functions changes summary: 0 Removed, 1 Changed, 0 Added function
Variables changes summary: 0 Removed, 0 Changed, 0 Added variable
1 function with incompatible sub-type changes:
[C] 'function S0 foo(void)' at test-v0.cc:10:1 has some sub-type changes:
return type changed:
type size changed from 32 to 64 (in bits)
1 base class insertion:
struct type_base at test-v1.cc:4:1
1 data member change:
'int m0' offset changed from 0 to 32 (in bits) (by +32 bits)
exit code: 12
$
note how the exit code is 12 β both the third bit ABIDIFF_ABI_CHANGE of value 4 and the fourth bit ABIDIFF_ABI_INCOMPATIBLE_CHANGE of value 8 are set to 1 π so the tool categorizes the ABI change as incompatible. it's an ABI break. periodt. π
3. Detecting another change in a sub-type of a function:
same vibe, different flavour β this time a member got inserted π
$ cat -n test-v0.cc
1 // Compile this with:
2 // g++ -g -Wall -shared -o libtest-v0.so test-v0.cc
3
4 struct S0
5 {
6 int m0;
7 };
8
9 void
10 foo(S0& /*parameter_name*/)
11 {
12 // do something with parameter_name.
13 }
$
$ cat -n test-v1.cc
1 // Compile this with:
2 // g++ -g -Wall -shared -o libtest-v1.so test-v1.cc
3
4 struct S0
5 {
6 char inserted_member;
7 int m0;
8 };
9
10 void
11 foo(S0& /*parameter_name*/)
12 {
13 // do something with parameter_name.
14 }
$
$ g++ -g -Wall -shared -o libtest-v0.so test-v0.cc
$ g++ -g -Wall -shared -o libtest-v1.so test-v1.cc
$
$ abidiff libtest-v0.so libtest-v1.so; echo "exit code: $?"
Functions changes summary: 0 Removed, 1 Changed, 0 Added function
Variables changes summary: 0 Removed, 0 Changed, 0 Added variable
1 function with some indirect sub-type change:
[C]'function void foo(S0&)' has some indirect sub-type changes:
parameter 0 of type 'S0&' has sub-type changes:
in referenced type 'struct S0':
size changed from 32 to 64 bits
1 data member insertion:
'char S0::inserted_member', at offset 0 (in bits)
1 data member change:
'int S0::m0' offset changed from 0 to 32
exit code: 4
$
4. Detecting that functions got removed or added to a library:
the way foo just left and bar showed up uninvited π main character energy from bar ngl
$ cat -n test-v0.cc
1 // Compile this with:
2 // g++ -g -Wall -shared -o libtest-v0.so test-v0.cc
3
4 struct S0
5 {
6 int m0;
7 };
8
9 void
10 foo(S0& /*parameter_name*/)
11 {
12 // do something with parameter_name.
13 }
$
$ cat -n test-v1.cc
1 // Compile this with:
2 // g++ -g -Wall -shared -o libtest-v1.so test-v1.cc
3
4 struct S0
5 {
6 char inserted_member;
7 int m0;
8 };
9
10 void
11 bar(S0& /*parameter_name*/)
12 {
13 // do something with parameter_name.
14 }
$
$ g++ -g -Wall -shared -o libtest-v0.so test-v0.cc
$ g++ -g -Wall -shared -o libtest-v1.so test-v1.cc
$
$ abidiff libtest-v0.so libtest-v1.so; echo "exit code: $?"
Functions changes summary: 1 Removed, 0 Changed, 1 Added functions
Variables changes summary: 0 Removed, 0 Changed, 0 Added variable
1 Removed function:
'function void foo(S0&)' {_Z3fooR2S0}
1 Added function:
'function void bar(S0&)' {_Z3barR2S0}
exit code: 12
$
5. Comparing two sets of binaries that are passed on the command line:
okay this one's lowkey the most extra invocation and I'm obsessed π
$ abidiff --add-binaries1=file2-v1 \
--add-binaries2=file2-v2,file2-v1 \
--added-binaries-dir1 dir1 \
--added-binaries-dir2 dir2 \
file1-v1 file1-v2
note that the files file2-v1, and file2-v2 are to be found in dir1 and dir2 or in the current directory. π (yes, the current directory counts too β she's flexible like that.)
6. Compare two libraries and their dependencies:
the full "bring your whole friend group" option π
$ abidiff --follow-dependencies \
--added-binaries-dir1 /some/where \
--added-binaries-dir2 /some/where/else \
foo bar
this compares the set of binaries comprised by foo and its dependencies against the set of binaries comprised by bar and its dependencies π«Ά like a whole friend-group vibe check.
β¨ AUTHOR β¨
Dodji Seketeli β the icon who wrote this, we stan π
π COPYRIGHT π
2014-2026, Red Hat, Inc. β slay, legally protected π
aaaand that's the whole page bestie!!! π¦ you made it to the end, I'm so proud π this was the ABIDIFF(1) manual page, dated Oct 08, 2026 β go forth and diff those ABIs responsibly, ilysm πβ¨πΈ
π¦ where this page comes from
- centos-stream 9: libabigail 3.0-1.el9 Β· Apache-2.0 WITH LLVM-exception
- centos-stream 9: libabigail 3.0-1.el9 Β· Apache-2.0 WITH LLVM-exception
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms