.\" Man page generated from reStructuredText. . .TH "ABIDIFF" "1" "Nov 10, 2018" "" "Libabigail" .SH NAME abidiff \- compare ABIs of ELF files . .nr rst2man-indent-level 0 . .de1 rstReportMargin \\$1 \\n[an-margin] level \\n[rst2man-indent-level] level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] - \\n[rst2man-indent0] \\n[rst2man-indent1] \\n[rst2man-indent2] .. .de1 INDENT .\" .rstReportMargin pre: . RS \\$1 . nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] . nr rst2man-indent-level +1 .\" .rstReportMargin post: .. .de UNINDENT . RE .\" indent \\n[an-margin] .\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] .nr rst2man-indent-level -1 .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] .in \\n[rst2man-indent\\n[rst2man-indent-level]]u .. .sp abidiff compares the Application Binary Interfaces (ABI) of two shared libraries in \fI\%ELF\fP format. It emits a meaningful report describing the differences between the two ABIs. .sp This tool can also compare the textual representations of the ABI of two ELF binaries (as emitted by \fBabidw\fP) or an ELF binary against a textual representation of another ELF binary. .sp For a comprehensive ABI change report that includes changes about function and variable sub\-types, the two input shared libraries must be accompanied with their debug information in \fI\%DWARF\fP format. Otherwise, only \fI\%ELF\fP symbols that were added or removed are reported. .SH INVOCATION .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C abidiff [options] .ft P .fi .UNINDENT .UNINDENT .SH ENVIRONMENT .sp 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. .INDENT 0.0 .IP \(bu 2 Default system\-wide suppression specification file .sp 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. .IP \(bu 2 Default user suppression specification file. .sp 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. .UNINDENT .SH OPTIONS .INDENT 0.0 .INDENT 3.5 .INDENT 0.0 .IP \(bu 2 \fB\-\-help | \-h\fP .sp Display a short help about the command and exit. .IP \(bu 2 \fB\-\-version | \-v\fP .sp Display the version of the program and exit. .IP \(bu 2 \fB\-\-debug\-info\-dir1 | \-\-d1\fP <\fIdi\-path1\fP> .sp For cases where the debug information for \fIfirst\-shared\-library\fP is split out into a separate file, tells \fBabidiff\fP where to find that separate debug information file. .sp Note that \fIdi\-path\fP 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 \fB/usr/lib/debug\fP\&. .sp Note also that this option is not mandatory for split debug information installed by your system’s package manager because then \fBabidiff\fP knows where to find it. .IP \(bu 2 \fB\-\-debug\-info\-dir2 | \-\-d2\fP <\fIdi\-path2\fP> .sp Like \fB\-\-debug\-info\-dir1\fP, this options tells \fBabidiff\fP where to find the split debug information for the \fIsecond\-shared\-library\fP file. .IP \(bu 2 \fB\-\-headers\-dir1 | \-\-hd1\fP .sp Specifies where to find the public headers 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. .IP \(bu 2 \fB\-\-headers\-dir2 | \-\-hd2\fP .sp 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. .IP \(bu 2 \fB\-\-no\-linux\-kernel\-mode\fP .sp 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 which ELF symbols are listed in the __ksymtab and __ksymtab_gpl sections. .sp With this option, abidiff considers the binary as a non\-special ELF binary. It thus considers functions and variables which are defined and exported in the ELF sense. .IP \(bu 2 \fB\-\-kmi\-whitelist | \-kaw\fP <\fIpath\-to\-whitelist\fP> .sp When analyzing a Linux kernel binary, this option points to the white list of names of ELF symbols of functions and variables which 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 \fBABI\fP; we rather talk about the interface between the Kernel and its module. Hence the term \fBKMI\fP rather than \fBABI\fP\&. .sp Any other function or variable which ELF symbol are not present in that white list will not be considered by this tool. .sp 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. .IP \(bu 2 \fB\-\-drop\-private\-types\fP .sp This option is to be used with the \fB\-\-headers\-dir1\fP and \fB\-\-headers\-dir2\fP options. With this option, types that are \fINOT\fP 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. .sp Without this option however, those private types are kept in the internal representation and later filtered out from the report. .sp This options 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. .IP \(bu 2 \fB\-\-stat\fP .sp Rather than displaying the detailed ABI differences between \fIfirst\-shared\-library\fP and \fIsecond\-shared\-library\fP, just display some summary statistics about these differences. .IP \(bu 2 \fB\-\-symtabs\fP .sp Only display the symbol tables of the \fIfirst\-shared\-library\fP and \fIsecond\-shared\-library\fP\&. .IP \(bu 2 \fB\-\-deleted\-fns\fP .sp In the resulting report about the differences between \fIfirst\-shared\-library\fP and \fIsecond\-shared\-library\fP, only display the globally defined functions that got deleted from \fIfirst\-shared\-library\fP\&. .IP \(bu 2 \fB\-\-changed\-fns\fP .sp In the resulting report about the differences between \fIfirst\-shared\-library\fP and \fIsecond\-shared\-library\fP, only display the changes in sub\-types of the global functions defined in \fIfirst\-shared\-library\fP\&. .IP \(bu 2 \fB\-\-added\-fns\fP .sp In the resulting report about the differences between \fIfirst\-shared\-library\fP and \fIsecond\-shared\-library\fP, only display the globally defined functions that were added to \fIsecond\-shared\-library\fP\&. .IP \(bu 2 \fB\-\-deleted\-vars\fP .sp In the resulting report about the differences between \fIfirst\-shared\-library\fP and \fIsecond\-shared\-library\fP, only display the globally defined variables that were deleted from \fIfirst\-shared\-library\fP\&. .IP \(bu 2 \fB\-\-changed\-vars\fP .sp In the resulting report about the differences between \fIfirst\-shared\-library\fP and \fIsecond\-shared\-library\fP, only display the changes in the sub\-types of the global variables defined in \fIfirst\-shared\-library\fP .IP \(bu 2 \fB\-\-added\-vars\fP .sp In the resulting report about the differences between \fIfirst\-shared\-library\fP and \fIsecond\-shared\-library\fP, only display the global variables that were added (defined) to \fIsecond\-shared\-library\fP\&. .IP \(bu 2 \fB\-\-no\-added\-syms\fP .sp In the resulting report about the differences between \fIfirst\-shared\-library\fP and \fIsecond\-shared\-library\fP, do not display added functions or variables. Do not display added functions or variables ELF symbols either. All other kinds of changes are displayed unless they are explicitely forbidden by other options on the command line. .IP \(bu 2 \fB\-\-no\-linkage\-name\fP .sp In the resulting report, do not display the linkage names of the added, removed, or changed functions or variables. .IP \(bu 2 \fB\-\-no\-show\-locs\fP .UNINDENT .INDENT 0.0 .INDENT 3.5 Do not show information about where in the \fIsecond shared library\fP the respective type was changed. .UNINDENT .UNINDENT .INDENT 0.0 .IP \(bu 2 \fB\-\-show\-bytes\fP .sp Show sizes and offsets in bytes, not bits. By default, sizes and offsets are shown in bits. .IP \(bu 2 \fB\-\-show\-bits\fP .sp Show sizes and offsets in bits, not bytes. This option is activated by default. .IP \(bu 2 \fB\-\-show\-hex\fP .sp Show sizes and offsets in hexadecimal base. .IP \(bu 2 \fB\-\-show\-dec\fP .sp Show sizes and offsets in decimal base. This option is activated by default. .IP \(bu 2 \fB\-\-no\-show\-relative\-offset\-changes\fP .sp Without this option, when the offset of a data member changes, the change report not only mentions the older and newer offset, but it also mentions by how many bits the data member changes. With this option, the latter is not shown. .IP \(bu 2 \fB\-\-no\-unreferenced\-symbols\fP .sp 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. .IP \(bu 2 \fB\-\-no\-default\-suppression\fP .sp Do not load the \fI\%default suppression specification files\fP\&. .IP \(bu 2 \fB\-\-suppressions | \-\-suppr\fP <\fIpath\-to\-suppressions\fP> .sp Use a suppression specification file located at \fIpath\-to\-suppressions\fP\&. 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. .sp Please note that, by default, if this option is not provided, then the \fI\%default suppression specification files\fP are loaded . .IP \(bu 2 \fB\-\-drop\fP <\fIregex\fP> .sp When reading the \fIfirst\-shared\-library\fP and \fIsecond\-shared\-library\fP ELF input files, drop the globally defined functions and variables which name match the regular expression \fIregex\fP\&. As a result, no change involving these functions or variables will be emitted in the diff report. .IP \(bu 2 \fB\-\-drop\-fn\fP <\fIregex\fP> .sp When reading the \fIfirst\-shared\-library\fP and \fIsecond\-shared\-library\fP ELF input files, drop the globally defined functions which name match the regular expression \fIregex\fP\&. As a result, no change involving these functions will be emitted in the diff report. .IP \(bu 2 \fB\-\-drop\-var\fP <\fIregex\fP> .sp When reading the \fIfirst\-shared\-library\fP and \fIsecond\-shared\-library\fP ELF input files, drop the globally defined variables matching a the regular expression \fIregex\fP\&. .IP \(bu 2 \fB\-\-keep\fP <\fIregex\fP> .sp When reading the \fIfirst\-shared\-library\fP and \fIsecond\-shared\-library\fP ELF input files, keep the globally defined functions and variables which names match the regular expression \fIregex\fP\&. All other functions and variables are dropped on the floor and will thus not appear in the resulting diff report. .IP \(bu 2 \fB\-\-keep\-fn\fP <\fIregex\fP> .sp When reading the \fIfirst\-shared\-library\fP and \fIsecond\-shared\-library\fP ELF input files, keep the globally defined functions which name match the regular expression \fIregex\fP\&. All other functions are dropped on the floor and will thus not appear in the resulting diff report. .IP \(bu 2 \fB\-\-keep\-var\fP <\fIregex\fP> .sp When reading the \fIfirst\-shared\-library\fP and \fIsecond\-shared\-library\fP ELF input files, keep the globally defined which names match the regular expression \fIregex\fP\&. All other variables are dropped on the floor and will thus not appear in the resulting diff report. .IP \(bu 2 \fB\-\-harmless\fP .sp In the diff report, display only the harmless changes. By default, the harmless changes are filtered out of the diff report keep the clutter to a minimum and have a greater chance to spot real ABI issues. .IP \(bu 2 \fB\-\-no\-harmful\fP .sp In the diff report, do not display the harmful changes. By default, only the harmful changes are displayed in diff report. .IP \(bu 2 \fB\-\-redundant\fP .sp In the diff report, do display redundant changes. A redundant change is a change that has been displayed elsewhere in the report. .IP \(bu 2 \fB\-\-no\-redundant\fP .sp In the diff report, do \fINOT\fP display redundant changes. A redundant change is a change that has been displayed elsewhere in the report. This option is switched on by default. .IP \(bu 2 \fB\-\-no\-architecture\fP .sp Do not take architecture in account when comparing ABIs. .IP \(bu 2 \fB\-\-no\-corpus\-path\fP .sp Do not emit the path attribute for the ABI corpus. .IP \(bu 2 \fB\-\-leaf\-changes\-only|\-l\fP only show leaf changes, so don’t show impact analysis report. .sp The typical output of abidiff when comparing two binaries looks like this .INDENT 2.0 .INDENT 3.5 .sp .nf .ft C $ 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]\(aqfunction void fn(C&)\(aq at test\-v1.cc:13:1 has some indirect sub\-type changes: parameter 1 of type \(aqC&\(aq has sub\-type changes: in referenced type \(aqstruct C\(aq at test\-v1.cc:7:1: type size hasn\(aqt changed 1 data member change: type of \(aqleaf* C::m0\(aq changed: in pointed to type \(aqstruct leaf\(aq at test\-v1.cc:1:1: type size changed from 32 to 64 bits 1 data member insertion: \(aqchar leaf::m1\(aq, at offset 32 (in bits) at test\-v1.cc:4:1 $ .ft P .fi .UNINDENT .UNINDENT .sp 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&)”. .sp In abidiff parlance, the change on “struct leaf” is called a leaf change. So the \fB\-\-leaf\-changes\-only \-\-impacted\-interfaces\fP options show, well, only the leaf change. And it goes like this: .INDENT 2.0 .INDENT 3.5 .sp .nf .ft C $ abidiff \-l libtest\-v0.so libtest\-v1.so \(aqstruct leaf\(aq changed: type size changed from 32 to 64 bits 1 data member insertion: \(aqchar leaf::m1\(aq, at offset 32 (in bits) at test\-v1.cc:4:1 one impacted interface: function void fn(C&) $ .ft P .fi .UNINDENT .UNINDENT .sp Note how the report ends by showing the list of interfaces impacted by the leaf change. .sp Now if you don’t want to see that list of impacted interfaces, then you can just avoid using the \fB\-\-impacted\-interface\fP option. You can learn about that option below, in any case. .IP \(bu 2 \fB\-\-impacted\-interfaces\fP .sp When showing leaf changes, this option instructs abidiff to show the list of impacted interfaces. This option is thus to be used in addition the \fB\-\-leaf\-changes\-only\fP option, otherwise, it’s ignored. .IP \(bu 2 \fB\-\-dump\-diff\-tree\fP .UNINDENT .INDENT 0.0 .INDENT 3.5 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. .UNINDENT .UNINDENT .INDENT 0.0 .IP \(bu 2 \fB\-\-stats\fP .sp Emit statistics about various internal things. .IP \(bu 2 \fB\-\-verbose\fP .sp Emit verbose logs about the progress of miscellaneous internal things. .UNINDENT .UNINDENT .UNINDENT .SH RETURN VALUES .sp The exit code of the \fBabidiff\fP 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. .sp In the later case, the exit code is a 8\-bits\-wide bit field in which each bit has a specific meaning. .sp The first bit, of value 1, named \fBABIDIFF_ERROR\fP means there was an error. .sp The second bit, of value 2, named \fBABIDIFF_USAGE_ERROR\fP 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 the \fBABIDIFF_ERROR\fP bit must be set as well. .sp The third bit, of value 4, named \fBABIDIFF_ABI_CHANGE\fP means the ABI of the binaries being compared are different. .sp The fourth bit, of value 8, named \fBABIDIFF_ABI_INCOMPATIBLE_CHANGE\fP means the ABI of the binaries compared are different in an incompatible way. If this bit is set, then the \fBABIDIFF_ABI_CHANGE\fP bit must be set as well. If the \fBABIDIFF_ABI_CHANGE\fP is set and the \fBABIDIFF_INCOMPATIBLE_CHANGE\fP is \fINOT\fP set, then it means that 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. .sp Note that, at the moment, there are only a few kinds of ABI changes that would result in setting the flag \fBABIDIFF_ABI_INCOMPATIBLE_CHANGE\fP\&. Those ABI changes are either: .INDENT 0.0 .INDENT 3.5 .INDENT 0.0 .IP \(bu 2 the removal of the symbol of a function or variable that has been defined and exported. .IP \(bu 2 the modification of the index of a member of a virtual function table (for C++ programs and libraries). .UNINDENT .UNINDENT .UNINDENT .sp With time, when more ABI change patterns are found to \fIalways\fP constitute incompatible ABI changes, we will adapt the code to recognize those cases and set the \fBABIDIFF_ABI_INCOMPATIBLE_CHANGE\fP accordingly. So, if you find such patterns, please let us know. .sp The remaining bits are not used for the moment. .SH USAGE EXAMPLES .INDENT 0.0 .INDENT 3.5 .INDENT 0.0 .IP 1. 3 Detecting a change in a sub\-type of a function: .INDENT 3.0 .INDENT 3.5 .sp .nf .ft C $ 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 $ $ ../build/tools/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]\(aqfunction void foo(S0*)\(aq has some indirect sub\-type changes: parameter 0 of type \(aqS0*\(aq has sub\-type changes: in pointed to type \(aqstruct S0\(aq: size changed from 32 to 64 bits 1 base class insertion: struct type_base 1 data member change: \(aqint S0::m0\(aq offset changed from 0 to 32 $ .ft P .fi .UNINDENT .UNINDENT .IP 2. 3 Detecting another change in a sub\-type of a function: .INDENT 3.0 .INDENT 3.5 .sp .nf .ft C $ 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 $ $ ../build/tools/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]\(aqfunction void foo(S0&)\(aq has some indirect sub\-type changes: parameter 0 of type \(aqS0&\(aq has sub\-type changes: in referenced type \(aqstruct S0\(aq: size changed from 32 to 64 bits 1 data member insertion: \(aqchar S0::inserted_member\(aq, at offset 0 (in bits) 1 data member change: \(aqint S0::m0\(aq offset changed from 0 to 32 $ .ft P .fi .UNINDENT .UNINDENT .IP 3. 3 Detecting that functions got removed or added to a library: .INDENT 3.0 .INDENT 3.5 .sp .nf .ft C $ 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 $ $ ../build/tools/abidiff libtest\-v0.so libtest\-v1.so Functions changes summary: 1 Removed, 0 Changed, 1 Added functions Variables changes summary: 0 Removed, 0 Changed, 0 Added variable 1 Removed function: \(aqfunction void foo(S0&)\(aq {_Z3fooR2S0} 1 Added function: \(aqfunction void bar(S0&)\(aq {_Z3barR2S0} $ .ft P .fi .UNINDENT .UNINDENT .UNINDENT .UNINDENT .UNINDENT .SH AUTHOR Dodji Seketeli .SH COPYRIGHT 2014-2018, Red Hat, Inc. .\" Generated by docutils manpage writer. .