1e01aa904Sopenharmony_ci.. _abidiff_label:
2e01aa904Sopenharmony_ci
3e01aa904Sopenharmony_ci=======
4e01aa904Sopenharmony_ciabidiff
5e01aa904Sopenharmony_ci=======
6e01aa904Sopenharmony_ci
7e01aa904Sopenharmony_ciabidiff compares the Application Binary Interfaces (ABI) of two shared
8e01aa904Sopenharmony_cilibraries in `ELF`_ format.  It emits a meaningful report describing the
9e01aa904Sopenharmony_cidifferences between the two ABIs.
10e01aa904Sopenharmony_ci
11e01aa904Sopenharmony_ciThis tool can also compare the textual representations of the ABI of
12e01aa904Sopenharmony_citwo ELF binaries (as emitted by ``abidw``) or an ELF binary against a
13e01aa904Sopenharmony_citextual representation of another ELF binary.
14e01aa904Sopenharmony_ci
15e01aa904Sopenharmony_ciFor a comprehensive ABI change report between two input shared
16e01aa904Sopenharmony_cilibraries that includes changes about function and variable sub-types,
17e01aa904Sopenharmony_ci``abidiff`` uses by default, debug information in `DWARF`_ format, if
18e01aa904Sopenharmony_cipresent, otherwise it compares interfaces using debug information in
19e01aa904Sopenharmony_ci`CTF`_ format, if present, finally, if neither is found, it uses only
20e01aa904Sopenharmony_ci`ELF`_ symbols to report which of them were added or removed.
21e01aa904Sopenharmony_ci
22e01aa904Sopenharmony_ci.. include:: tools-use-libabigail.txt
23e01aa904Sopenharmony_ci
24e01aa904Sopenharmony_ci.. _abidiff_invocation_label:
25e01aa904Sopenharmony_ci
26e01aa904Sopenharmony_ciInvocation
27e01aa904Sopenharmony_ci==========
28e01aa904Sopenharmony_ci
29e01aa904Sopenharmony_ci::
30e01aa904Sopenharmony_ci
31e01aa904Sopenharmony_ci  abidiff [options] <first-shared-library> <second-shared-library>
32e01aa904Sopenharmony_ci
33e01aa904Sopenharmony_ci
34e01aa904Sopenharmony_ciEnvironment
35e01aa904Sopenharmony_ci===========
36e01aa904Sopenharmony_ci
37e01aa904Sopenharmony_ci.. _abidiff_default_supprs_label:
38e01aa904Sopenharmony_ci
39e01aa904Sopenharmony_ciabidiff loads two default :ref:`suppression specifications files
40e01aa904Sopenharmony_ci<suppr_spec_label>`, merges their content and use it to filter out ABI
41e01aa904Sopenharmony_cichange reports that might be considered as false positives to users.
42e01aa904Sopenharmony_ci
43e01aa904Sopenharmony_ci* Default system-wide suppression specification file
44e01aa904Sopenharmony_ci
45e01aa904Sopenharmony_ci  It's located by the optional environment variable
46e01aa904Sopenharmony_ci  LIBABIGAIL_DEFAULT_SYSTEM_SUPPRESSION_FILE.  If that environment
47e01aa904Sopenharmony_ci  variable is not set, then abidiff tries to load the suppression file
48e01aa904Sopenharmony_ci  $libdir/libabigail/libabigail-default.abignore.  If that file is not
49e01aa904Sopenharmony_ci  present, then no default system-wide suppression specification file
50e01aa904Sopenharmony_ci  is loaded.
51e01aa904Sopenharmony_ci
52e01aa904Sopenharmony_ci* Default user suppression specification file.
53e01aa904Sopenharmony_ci
54e01aa904Sopenharmony_ci  It's located by the optional environment
55e01aa904Sopenharmony_ci  LIBABIGAIL_DEFAULT_USER_SUPPRESSION_FILE.  If that environment
56e01aa904Sopenharmony_ci  variable is not set, then abidiff tries to load the suppression file
57e01aa904Sopenharmony_ci  $HOME/.abignore.  If that file is not present, then no default user
58e01aa904Sopenharmony_ci  suppression specification is loaded.
59e01aa904Sopenharmony_ci
60e01aa904Sopenharmony_ci.. _abidiff_options_label:
61e01aa904Sopenharmony_ci
62e01aa904Sopenharmony_ciOptions
63e01aa904Sopenharmony_ci=======
64e01aa904Sopenharmony_ci
65e01aa904Sopenharmony_ci  * ``--help | -h``
66e01aa904Sopenharmony_ci
67e01aa904Sopenharmony_ci    Display a short help about the command and exit.
68e01aa904Sopenharmony_ci
69e01aa904Sopenharmony_ci  * ``--debug-self-comparison``
70e01aa904Sopenharmony_ci
71e01aa904Sopenharmony_ci    In this mode, error messages are emitted for types which fail type
72e01aa904Sopenharmony_ci    canonicalization, in some circumstances, when comparing a binary
73e01aa904Sopenharmony_ci    against itself.
74e01aa904Sopenharmony_ci
75e01aa904Sopenharmony_ci    When comparing a binary against itself, canonical types of the
76e01aa904Sopenharmony_ci    second binary should be equal (as much as possible) to canonical
77e01aa904Sopenharmony_ci    types of the first binary.  When some discrepancies are detected
78e01aa904Sopenharmony_ci    in this mode, an abort signal is emitted and execution is halted.
79e01aa904Sopenharmony_ci    This option should be used while executing the tool in a debugger,
80e01aa904Sopenharmony_ci    for troubleshooting purposes.
81e01aa904Sopenharmony_ci
82e01aa904Sopenharmony_ci    This is an optional debugging and sanity check option.  To enable
83e01aa904Sopenharmony_ci    it the libabigail package needs to be configured with
84e01aa904Sopenharmony_ci    the --enable-debug-self-comparison configure option.
85e01aa904Sopenharmony_ci
86e01aa904Sopenharmony_ci  * ``--debug-tc``
87e01aa904Sopenharmony_ci
88e01aa904Sopenharmony_ci    In this mode, the process of type canonicalization is put under
89e01aa904Sopenharmony_ci    heavy scrutiny.  Basically, during type canonicalization, each
90e01aa904Sopenharmony_ci    type comparison is performed twice: once in a structural mode
91e01aa904Sopenharmony_ci    (comparing every sub-type member-wise), and once using canonical
92e01aa904Sopenharmony_ci    comparison.  The two comparisons should yield the same result.
93e01aa904Sopenharmony_ci    Otherwise, an abort signal is emitted and the process can be
94e01aa904Sopenharmony_ci    debugged to understand why the two kinds of comparison yield
95e01aa904Sopenharmony_ci    different results.
96e01aa904Sopenharmony_ci
97e01aa904Sopenharmony_ci    This is an optional debugging and sanity check option.  To enable
98e01aa904Sopenharmony_ci    it the libabigail package needs to be configured with
99e01aa904Sopenharmony_ci    the --enable-debug-type-canonicalization configure option.
100e01aa904Sopenharmony_ci
101e01aa904Sopenharmony_ci  * ``--version | -v``
102e01aa904Sopenharmony_ci
103e01aa904Sopenharmony_ci    Display the version of the program and exit.
104e01aa904Sopenharmony_ci
105e01aa904Sopenharmony_ci  * ``--debug-info-dir1 | --d1`` <*di-path1*>
106e01aa904Sopenharmony_ci
107e01aa904Sopenharmony_ci    For cases where the debug information for *first-shared-library*
108e01aa904Sopenharmony_ci    is split out into a separate file, tells ``abidiff`` where to find
109e01aa904Sopenharmony_ci    that separate debug information file.
110e01aa904Sopenharmony_ci
111e01aa904Sopenharmony_ci    Note that *di-path* must point to the root directory under which
112e01aa904Sopenharmony_ci    the debug information is arranged in a tree-like manner.  Under
113e01aa904Sopenharmony_ci    Red Hat based systems, that directory is usually
114e01aa904Sopenharmony_ci    ``<root>/usr/lib/debug``.
115e01aa904Sopenharmony_ci
116e01aa904Sopenharmony_ci    This option can be provided several times with different root
117e01aa904Sopenharmony_ci    directories.  In that case, ``abidiff`` will potentially look into
118e01aa904Sopenharmony_ci    all those root directories to find the split debug info for
119e01aa904Sopenharmony_ci    *first-shared-library*.
120e01aa904Sopenharmony_ci
121e01aa904Sopenharmony_ci    Note also that this option is not mandatory for split debug
122e01aa904Sopenharmony_ci    information installed by your system's package manager because
123e01aa904Sopenharmony_ci    then ``abidiff`` knows where to find it.
124e01aa904Sopenharmony_ci
125e01aa904Sopenharmony_ci  * ``--debug-info-dir2 | --d2`` <*di-path2*>
126e01aa904Sopenharmony_ci
127e01aa904Sopenharmony_ci    Like ``--debug-info-dir1``, this options tells ``abidiff`` where
128e01aa904Sopenharmony_ci    to find the split debug information for the
129e01aa904Sopenharmony_ci    *second-shared-library* file.
130e01aa904Sopenharmony_ci
131e01aa904Sopenharmony_ci    This option can be provided several times with different root
132e01aa904Sopenharmony_ci    directories.  In that case, ``abidiff`` will potentially look into
133e01aa904Sopenharmony_ci    all those root directories to find the split debug info for
134e01aa904Sopenharmony_ci    *second-shared-library*.
135e01aa904Sopenharmony_ci
136e01aa904Sopenharmony_ci  * ``--headers-dir1 | --hd1`` <headers-directory-path-1>
137e01aa904Sopenharmony_ci
138e01aa904Sopenharmony_ci    Specifies where to find the public headers of the first shared
139e01aa904Sopenharmony_ci    library (or binary in general) that the tool has to consider.  The
140e01aa904Sopenharmony_ci    tool will thus filter out ABI changes on types that are not
141e01aa904Sopenharmony_ci    defined in public headers.
142e01aa904Sopenharmony_ci
143e01aa904Sopenharmony_ci    Note that several public header directories can be specified for
144e01aa904Sopenharmony_ci    the first shared library.  In that case the ``--headers-dir1``
145e01aa904Sopenharmony_ci    option should be present several times on the command line, like
146e01aa904Sopenharmony_ci    in the following example: ::
147e01aa904Sopenharmony_ci
148e01aa904Sopenharmony_ci      $ abidiff --headers-dir1 /some/path       \
149e01aa904Sopenharmony_ci                --headers-dir1 /some/other/path \
150e01aa904Sopenharmony_ci		binary-version-1 binary-version-2
151e01aa904Sopenharmony_ci
152e01aa904Sopenharmony_ci  * ``--header-file1 | --hf1`` <header-file-path-1>
153e01aa904Sopenharmony_ci
154e01aa904Sopenharmony_ci    Specifies where to find one public header of the first shared
155e01aa904Sopenharmony_ci    library that the tool has to consider.  The tool will thus filter
156e01aa904Sopenharmony_ci    out ABI changes on types that are not defined in public headers.
157e01aa904Sopenharmony_ci
158e01aa904Sopenharmony_ci  * ``--headers-dir2 | --hd2`` <headers-directory-path-2>
159e01aa904Sopenharmony_ci
160e01aa904Sopenharmony_ci    Specifies where to find the public headers of the second shared
161e01aa904Sopenharmony_ci    library that the tool has to consider.  The tool will thus filter
162e01aa904Sopenharmony_ci    out ABI changes on types that are not defined in public headers.
163e01aa904Sopenharmony_ci
164e01aa904Sopenharmony_ci    Note that several public header directories can be specified for
165e01aa904Sopenharmony_ci    the second shared library.  In that case the ``--headers-dir2``
166e01aa904Sopenharmony_ci    option should be present several times like in the following
167e01aa904Sopenharmony_ci    example: ::
168e01aa904Sopenharmony_ci
169e01aa904Sopenharmony_ci      $ abidiff --headers-dir2 /some/path       \
170e01aa904Sopenharmony_ci                --headers-dir2 /some/other/path \
171e01aa904Sopenharmony_ci		binary-version-1 binary-version-2
172e01aa904Sopenharmony_ci
173e01aa904Sopenharmony_ci  * ``--header-file2 | --hf2`` <header-file-path-2>
174e01aa904Sopenharmony_ci
175e01aa904Sopenharmony_ci    Specifies where to find one public header of the second shared
176e01aa904Sopenharmony_ci    library that the tool has to consider.  The tool will thus filter
177e01aa904Sopenharmony_ci    out ABI changes on types that are not defined in public headers.
178e01aa904Sopenharmony_ci
179e01aa904Sopenharmony_ci  * ``--no-linux-kernel-mode``
180e01aa904Sopenharmony_ci
181e01aa904Sopenharmony_ci    Without this option, if abidiff detects that the binaries it is
182e01aa904Sopenharmony_ci    looking at are Linux Kernel binaries (either vmlinux or modules)
183e01aa904Sopenharmony_ci    then it only considers functions and variables which ELF symbols
184e01aa904Sopenharmony_ci    are listed in the __ksymtab and __ksymtab_gpl sections.
185e01aa904Sopenharmony_ci
186e01aa904Sopenharmony_ci    With this option, abidiff considers the binary as a non-special
187e01aa904Sopenharmony_ci    ELF binary.  It thus considers functions and variables which are
188e01aa904Sopenharmony_ci    defined and exported in the ELF sense.
189e01aa904Sopenharmony_ci
190e01aa904Sopenharmony_ci  * ``--kmi-whitelist | -kaw`` <*path-to-whitelist*>
191e01aa904Sopenharmony_ci
192e01aa904Sopenharmony_ci    When analyzing a Linux kernel binary, this option points to the
193e01aa904Sopenharmony_ci    white list of names of ELF symbols of functions and variables
194e01aa904Sopenharmony_ci    which ABI must be considered.  That white list is called a "Kernel
195e01aa904Sopenharmony_ci    Module Interface white list".  This is because for the Kernel, we
196e01aa904Sopenharmony_ci    don't talk about ``ABI``; we rather talk about the interface
197e01aa904Sopenharmony_ci    between the Kernel and its module. Hence the term ``KMI`` rather
198e01aa904Sopenharmony_ci    than ``ABI``.
199e01aa904Sopenharmony_ci
200e01aa904Sopenharmony_ci    Any other function or variable which ELF symbol are not present in
201e01aa904Sopenharmony_ci    that white list will not be considered by this tool.
202e01aa904Sopenharmony_ci
203e01aa904Sopenharmony_ci    If this option is not provided -- thus if no white list is
204e01aa904Sopenharmony_ci    provided -- then the entire KMI, that is, the set of all publicly
205e01aa904Sopenharmony_ci    defined and exported functions and global variables by the Linux
206e01aa904Sopenharmony_ci    Kernel binaries, is considered.
207e01aa904Sopenharmony_ci
208e01aa904Sopenharmony_ci  * ``--drop-private-types``
209e01aa904Sopenharmony_ci
210e01aa904Sopenharmony_ci    This option is to be used with the ``--headers-dir1``,
211e01aa904Sopenharmony_ci    ``header-file1``, ``header-file2`` and ``--headers-dir2`` options.
212e01aa904Sopenharmony_ci    With this option, types that are *NOT* defined in the headers are
213e01aa904Sopenharmony_ci    entirely dropped from the internal representation build by
214e01aa904Sopenharmony_ci    Libabigail to represent the ABI.  They thus don't have to be
215e01aa904Sopenharmony_ci    filtered out from the final ABI change report because they are not
216e01aa904Sopenharmony_ci    even present in Libabigail's representation.
217e01aa904Sopenharmony_ci
218e01aa904Sopenharmony_ci    Without this option however, those private types are kept in the
219e01aa904Sopenharmony_ci    internal representation and later filtered out from the report.
220e01aa904Sopenharmony_ci
221e01aa904Sopenharmony_ci    This options thus potentially makes Libabigail consume less
222e01aa904Sopenharmony_ci    memory.  It's meant to be mainly used to optimize the memory
223e01aa904Sopenharmony_ci    consumption of the tool on binaries with a lot of publicly defined
224e01aa904Sopenharmony_ci    and exported types.
225e01aa904Sopenharmony_ci
226e01aa904Sopenharmony_ci  * ``--exported-interfaces-only``
227e01aa904Sopenharmony_ci
228e01aa904Sopenharmony_ci    By default, when looking at the debug information accompanying a
229e01aa904Sopenharmony_ci    binary, this tool analyzes the descriptions of the types reachable
230e01aa904Sopenharmony_ci    by the interfaces (functions and variables) that are visible
231e01aa904Sopenharmony_ci    outside of their translation unit.  Once that analysis is done, an
232e01aa904Sopenharmony_ci    ABI corpus is constructed by only considering the subset of types
233e01aa904Sopenharmony_ci    reachable from interfaces associated to `ELF`_ symbols that are
234e01aa904Sopenharmony_ci    defined and exported by the binary.  It's those final ABI Corpora
235e01aa904Sopenharmony_ci    that are compared by this tool.
236e01aa904Sopenharmony_ci
237e01aa904Sopenharmony_ci    The problem with that approach however is that analyzing all the
238e01aa904Sopenharmony_ci    interfaces that are visible from outside their translation unit
239e01aa904Sopenharmony_ci    can amount to a lot of data, especially when those binaries are
240e01aa904Sopenharmony_ci    applications, as opposed to shared libraries.  One example of such
241e01aa904Sopenharmony_ci    applications is the `Linux Kernel`_.  Analyzing massive ABI
242e01aa904Sopenharmony_ci    corpora like these can be extremely slow.
243e01aa904Sopenharmony_ci
244e01aa904Sopenharmony_ci    To mitigate that performance issue, this option allows libabigail
245e01aa904Sopenharmony_ci    to only analyze types that are reachable from interfaces
246e01aa904Sopenharmony_ci    associated with defined and exported `ELF`_ symbols.
247e01aa904Sopenharmony_ci
248e01aa904Sopenharmony_ci    Note that this option is turned on by default when analyzing the
249e01aa904Sopenharmony_ci    `Linux Kernel`_.  Otherwise, it's turned off by default.
250e01aa904Sopenharmony_ci
251e01aa904Sopenharmony_ci  * ``--allow-non-exported-interfaces``
252e01aa904Sopenharmony_ci
253e01aa904Sopenharmony_ci    When looking at the debug information accompanying a binary, this
254e01aa904Sopenharmony_ci    tool analyzes the descriptions of the types reachable by the
255e01aa904Sopenharmony_ci    interfaces (functions and variables) that are visible outside of
256e01aa904Sopenharmony_ci    their translation unit.  Once that analysis is done, an ABI corpus
257e01aa904Sopenharmony_ci    is constructed by only considering the subset of types reachable
258e01aa904Sopenharmony_ci    from interfaces associated to `ELF`_ symbols that are defined and
259e01aa904Sopenharmony_ci    exported by the binary.  It's those final ABI Corpora that are
260e01aa904Sopenharmony_ci    compared by this tool.
261e01aa904Sopenharmony_ci
262e01aa904Sopenharmony_ci    The problem with that approach however is that analyzing all the
263e01aa904Sopenharmony_ci    interfaces that are visible from outside their translation unit
264e01aa904Sopenharmony_ci    can amount to a lot of data, especially when those binaries are
265e01aa904Sopenharmony_ci    applications, as opposed to shared libraries.  One example of such
266e01aa904Sopenharmony_ci    applications is the `Linux Kernel`_.  Analyzing massive ABI
267e01aa904Sopenharmony_ci    Corpora like these can be extremely slow.
268e01aa904Sopenharmony_ci
269e01aa904Sopenharmony_ci    In the presence of an "average sized" binary however one can
270e01aa904Sopenharmony_ci    afford having libabigail analyze all interfaces that are visible
271e01aa904Sopenharmony_ci    outside of their translation unit, using this option.
272e01aa904Sopenharmony_ci
273e01aa904Sopenharmony_ci    Note that this option is turned on by default, unless we are in
274e01aa904Sopenharmony_ci    the presence of the `Linux Kernel`_.
275e01aa904Sopenharmony_ci
276e01aa904Sopenharmony_ci  * ``--stat``
277e01aa904Sopenharmony_ci
278e01aa904Sopenharmony_ci    Rather than displaying the detailed ABI differences between
279e01aa904Sopenharmony_ci    *first-shared-library* and *second-shared-library*, just display
280e01aa904Sopenharmony_ci    some summary statistics about these differences.
281e01aa904Sopenharmony_ci
282e01aa904Sopenharmony_ci  * ``--symtabs``
283e01aa904Sopenharmony_ci
284e01aa904Sopenharmony_ci    Only display the symbol tables of the *first-shared-library* and
285e01aa904Sopenharmony_ci    *second-shared-library*.
286e01aa904Sopenharmony_ci
287e01aa904Sopenharmony_ci  * ``--deleted-fns``
288e01aa904Sopenharmony_ci
289e01aa904Sopenharmony_ci    In the resulting report about the differences between
290e01aa904Sopenharmony_ci    *first-shared-library* and *second-shared-library*, only display
291e01aa904Sopenharmony_ci    the globally defined functions that got deleted from
292e01aa904Sopenharmony_ci    *first-shared-library*.
293e01aa904Sopenharmony_ci
294e01aa904Sopenharmony_ci  * ``--changed-fns``
295e01aa904Sopenharmony_ci
296e01aa904Sopenharmony_ci    In the resulting report about the differences between
297e01aa904Sopenharmony_ci    *first-shared-library* and *second-shared-library*, only display
298e01aa904Sopenharmony_ci    the changes in sub-types of the global functions defined in
299e01aa904Sopenharmony_ci    *first-shared-library*.
300e01aa904Sopenharmony_ci
301e01aa904Sopenharmony_ci  * ``--added-fns``
302e01aa904Sopenharmony_ci
303e01aa904Sopenharmony_ci    In the resulting report about the differences between
304e01aa904Sopenharmony_ci    *first-shared-library* and *second-shared-library*, only display
305e01aa904Sopenharmony_ci    the globally defined functions that were added to
306e01aa904Sopenharmony_ci    *second-shared-library*.
307e01aa904Sopenharmony_ci
308e01aa904Sopenharmony_ci  * ``--deleted-vars``
309e01aa904Sopenharmony_ci
310e01aa904Sopenharmony_ci    In the resulting report about the differences between
311e01aa904Sopenharmony_ci    *first-shared-library* and *second-shared-library*, only display
312e01aa904Sopenharmony_ci    the globally defined variables that were deleted from
313e01aa904Sopenharmony_ci    *first-shared-library*.
314e01aa904Sopenharmony_ci
315e01aa904Sopenharmony_ci  * ``--changed-vars``
316e01aa904Sopenharmony_ci
317e01aa904Sopenharmony_ci    In the resulting report about the differences between
318e01aa904Sopenharmony_ci    *first-shared-library* and *second-shared-library*, only display
319e01aa904Sopenharmony_ci    the changes in the sub-types of the global variables defined in
320e01aa904Sopenharmony_ci    *first-shared-library*
321e01aa904Sopenharmony_ci
322e01aa904Sopenharmony_ci  * ``--added-vars``
323e01aa904Sopenharmony_ci
324e01aa904Sopenharmony_ci    In the resulting report about the differences between
325e01aa904Sopenharmony_ci    *first-shared-library* and *second-shared-library*, only display
326e01aa904Sopenharmony_ci    the global variables that were added (defined) to
327e01aa904Sopenharmony_ci    *second-shared-library*.
328e01aa904Sopenharmony_ci
329e01aa904Sopenharmony_ci  * ``--non-reachable-types|-t``
330e01aa904Sopenharmony_ci
331e01aa904Sopenharmony_ci    Analyze and emit change reports for all the types of the binary,
332e01aa904Sopenharmony_ci    including those that are not reachable from global functions and
333e01aa904Sopenharmony_ci    variables.
334e01aa904Sopenharmony_ci
335e01aa904Sopenharmony_ci    This option might incur some serious performance degradation as
336e01aa904Sopenharmony_ci    the number of types analyzed can be huge.  However, if paired with
337e01aa904Sopenharmony_ci    the ``--headers-dir{1,2}`` and/or ``header-file{1,2}`` options,
338e01aa904Sopenharmony_ci    the additional non-reachable types analyzed are restricted to
339e01aa904Sopenharmony_ci    those defined in public headers files, thus hopefully making the
340e01aa904Sopenharmony_ci    performance hit acceptable.
341e01aa904Sopenharmony_ci
342e01aa904Sopenharmony_ci    Also, using this option alongside suppression specifications (by
343e01aa904Sopenharmony_ci    also using the ``--suppressions`` option) might help keep the number of
344e01aa904Sopenharmony_ci    analyzed types (and the potential performance degradation) in
345e01aa904Sopenharmony_ci    control.
346e01aa904Sopenharmony_ci
347e01aa904Sopenharmony_ci    Note that without this option, only types that are reachable from
348e01aa904Sopenharmony_ci    global functions and variables are analyzed, so the tool detects
349e01aa904Sopenharmony_ci    and reports changes on these reachable types only.
350e01aa904Sopenharmony_ci
351e01aa904Sopenharmony_ci  * ``--no-added-syms``
352e01aa904Sopenharmony_ci
353e01aa904Sopenharmony_ci    In the resulting report about the differences between
354e01aa904Sopenharmony_ci    *first-shared-library* and *second-shared-library*, do not display
355e01aa904Sopenharmony_ci    added functions or variables.  Do not display added functions or
356e01aa904Sopenharmony_ci    variables ELF symbols either.  All other kinds of changes are
357e01aa904Sopenharmony_ci    displayed unless they are explicitely forbidden by other options
358e01aa904Sopenharmony_ci    on the command line.
359e01aa904Sopenharmony_ci
360e01aa904Sopenharmony_ci  * ``--no-linkage-name``
361e01aa904Sopenharmony_ci
362e01aa904Sopenharmony_ci    In the resulting report, do not display the linkage names of
363e01aa904Sopenharmony_ci    the added, removed, or changed functions or variables.
364e01aa904Sopenharmony_ci
365e01aa904Sopenharmony_ci  * ``--no-show-locs``
366e01aa904Sopenharmony_ci
367e01aa904Sopenharmony_ci   Do not show information about where in the *second shared library*
368e01aa904Sopenharmony_ci   the respective type was changed.
369e01aa904Sopenharmony_ci
370e01aa904Sopenharmony_ci  * ``--show-bytes``
371e01aa904Sopenharmony_ci
372e01aa904Sopenharmony_ci    Show sizes and offsets in bytes, not bits.  By default, sizes and
373e01aa904Sopenharmony_ci    offsets are shown in bits.
374e01aa904Sopenharmony_ci
375e01aa904Sopenharmony_ci  * ``--show-bits``
376e01aa904Sopenharmony_ci
377e01aa904Sopenharmony_ci    Show sizes and offsets in bits, not bytes.  This option is
378e01aa904Sopenharmony_ci    activated by default.
379e01aa904Sopenharmony_ci
380e01aa904Sopenharmony_ci  * ``--show-hex``
381e01aa904Sopenharmony_ci
382e01aa904Sopenharmony_ci    Show sizes and offsets in hexadecimal base.
383e01aa904Sopenharmony_ci
384e01aa904Sopenharmony_ci  * ``--show-dec``
385e01aa904Sopenharmony_ci
386e01aa904Sopenharmony_ci    Show sizes and offsets in decimal base.  This option is activated
387e01aa904Sopenharmony_ci    by default.
388e01aa904Sopenharmony_ci
389e01aa904Sopenharmony_ci  * ``--ignore-soname``
390e01aa904Sopenharmony_ci
391e01aa904Sopenharmony_ci    Ignore differences in the SONAME when doing a comparison
392e01aa904Sopenharmony_ci
393e01aa904Sopenharmony_ci  *  ``--no-show-relative-offset-changes``
394e01aa904Sopenharmony_ci
395e01aa904Sopenharmony_ci     Without this option, when the offset of a data member changes,
396e01aa904Sopenharmony_ci     the change report not only mentions the older and newer offset,
397e01aa904Sopenharmony_ci     but it also mentions by how many bits the data member changes.
398e01aa904Sopenharmony_ci     With this option, the latter is not shown.
399e01aa904Sopenharmony_ci
400e01aa904Sopenharmony_ci  * ``--no-unreferenced-symbols``
401e01aa904Sopenharmony_ci
402e01aa904Sopenharmony_ci    In the resulting report, do not display change information about
403e01aa904Sopenharmony_ci    function and variable symbols that are not referenced by any debug
404e01aa904Sopenharmony_ci    information.  Note that for these symbols not referenced by any
405e01aa904Sopenharmony_ci    debug information, the change information displayed is either
406e01aa904Sopenharmony_ci    added or removed symbols.
407e01aa904Sopenharmony_ci
408e01aa904Sopenharmony_ci  * ``--no-default-suppression``
409e01aa904Sopenharmony_ci
410e01aa904Sopenharmony_ci    Do not load the :ref:`default suppression specification files
411e01aa904Sopenharmony_ci    <abidiff_default_supprs_label>`.
412e01aa904Sopenharmony_ci
413e01aa904Sopenharmony_ci  * ``--suppressions | --suppr`` <*path-to-suppressions*>
414e01aa904Sopenharmony_ci
415e01aa904Sopenharmony_ci    Use a :ref:`suppression specification <suppr_spec_label>` file
416e01aa904Sopenharmony_ci    located at *path-to-suppressions*.  Note that this option can
417e01aa904Sopenharmony_ci    appear multiple times on the command line.  In that case, all of
418e01aa904Sopenharmony_ci    the provided suppression specification files are taken into
419e01aa904Sopenharmony_ci    account.
420e01aa904Sopenharmony_ci
421e01aa904Sopenharmony_ci    Please note that, by default, if this option is not provided, then
422e01aa904Sopenharmony_ci    the :ref:`default suppression specification files
423e01aa904Sopenharmony_ci    <abidiff_default_supprs_label>` are loaded .
424e01aa904Sopenharmony_ci
425e01aa904Sopenharmony_ci  * ``--drop`` <*regex*>
426e01aa904Sopenharmony_ci
427e01aa904Sopenharmony_ci    When reading the *first-shared-library* and
428e01aa904Sopenharmony_ci    *second-shared-library* ELF input files, drop the globally defined
429e01aa904Sopenharmony_ci    functions and variables which name match the regular expression
430e01aa904Sopenharmony_ci    *regex*.  As a result, no change involving these functions or
431e01aa904Sopenharmony_ci    variables will be emitted in the diff report.
432e01aa904Sopenharmony_ci
433e01aa904Sopenharmony_ci  * ``--drop-fn`` <*regex*>
434e01aa904Sopenharmony_ci
435e01aa904Sopenharmony_ci    When reading the *first-shared-library* and
436e01aa904Sopenharmony_ci    *second-shared-library* ELF input files, drop the globally defined
437e01aa904Sopenharmony_ci    functions which name match the regular expression *regex*.  As a
438e01aa904Sopenharmony_ci    result, no change involving these functions will be emitted in the
439e01aa904Sopenharmony_ci    diff report.
440e01aa904Sopenharmony_ci
441e01aa904Sopenharmony_ci  * ``--drop-var`` <*regex*>
442e01aa904Sopenharmony_ci
443e01aa904Sopenharmony_ci    When reading the *first-shared-library* and
444e01aa904Sopenharmony_ci    *second-shared-library* ELF input files, drop the globally defined
445e01aa904Sopenharmony_ci    variables matching a the regular expression *regex*.
446e01aa904Sopenharmony_ci
447e01aa904Sopenharmony_ci  * ``--keep`` <*regex*>
448e01aa904Sopenharmony_ci
449e01aa904Sopenharmony_ci    When reading the *first-shared-library* and
450e01aa904Sopenharmony_ci    *second-shared-library* ELF input files, keep the globally defined
451e01aa904Sopenharmony_ci    functions and variables which names match the regular expression
452e01aa904Sopenharmony_ci    *regex*.  All other functions and variables are dropped on the
453e01aa904Sopenharmony_ci    floor and will thus not appear in the resulting diff report.
454e01aa904Sopenharmony_ci
455e01aa904Sopenharmony_ci  * ``--keep-fn`` <*regex*>
456e01aa904Sopenharmony_ci
457e01aa904Sopenharmony_ci    When reading the *first-shared-library* and
458e01aa904Sopenharmony_ci    *second-shared-library* ELF input files, keep the globally defined
459e01aa904Sopenharmony_ci    functions which name match the regular expression *regex*.  All
460e01aa904Sopenharmony_ci    other functions are dropped on the floor and will thus not appear
461e01aa904Sopenharmony_ci    in the resulting diff report.
462e01aa904Sopenharmony_ci
463e01aa904Sopenharmony_ci  * ``--keep-var`` <*regex*>
464e01aa904Sopenharmony_ci
465e01aa904Sopenharmony_ci    When reading the *first-shared-library* and
466e01aa904Sopenharmony_ci    *second-shared-library* ELF input files, keep the globally defined
467e01aa904Sopenharmony_ci    which names match the regular expression *regex*.  All other
468e01aa904Sopenharmony_ci    variables are dropped on the floor and will thus not appear in the
469e01aa904Sopenharmony_ci    resulting diff report.
470e01aa904Sopenharmony_ci
471e01aa904Sopenharmony_ci  * ``--harmless``
472e01aa904Sopenharmony_ci
473e01aa904Sopenharmony_ci    In the diff report, display only the :ref:`harmless
474e01aa904Sopenharmony_ci    <harmlesschangeconcept_label>` changes.  By default, the harmless
475e01aa904Sopenharmony_ci    changes are filtered out of the diff report keep the clutter to a
476e01aa904Sopenharmony_ci    minimum and have a greater chance to spot real ABI issues.
477e01aa904Sopenharmony_ci
478e01aa904Sopenharmony_ci  * ``--no-harmful``
479e01aa904Sopenharmony_ci
480e01aa904Sopenharmony_ci    In the diff report, do not display the :ref:`harmful
481e01aa904Sopenharmony_ci    <harmfulchangeconcept_label>` changes.  By default, only the
482e01aa904Sopenharmony_ci    harmful changes are displayed in diff report.
483e01aa904Sopenharmony_ci
484e01aa904Sopenharmony_ci  * ``--redundant``
485e01aa904Sopenharmony_ci
486e01aa904Sopenharmony_ci    In the diff report, do display redundant changes.  A redundant
487e01aa904Sopenharmony_ci    change is a change that has been displayed elsewhere in the
488e01aa904Sopenharmony_ci    report.
489e01aa904Sopenharmony_ci
490e01aa904Sopenharmony_ci  * ``--no-redundant``
491e01aa904Sopenharmony_ci
492e01aa904Sopenharmony_ci    In the diff report, do *NOT* display redundant changes.  A
493e01aa904Sopenharmony_ci    redundant change is a change that has been displayed elsewhere in
494e01aa904Sopenharmony_ci    the report.  This option is switched on by default.
495e01aa904Sopenharmony_ci
496e01aa904Sopenharmony_ci  * ``--no-architecture``
497e01aa904Sopenharmony_ci
498e01aa904Sopenharmony_ci    Do not take architecture in account when comparing ABIs.
499e01aa904Sopenharmony_ci
500e01aa904Sopenharmony_ci  * ``--no-corpus-path``
501e01aa904Sopenharmony_ci
502e01aa904Sopenharmony_ci    Do not emit the path attribute for the ABI corpus.
503e01aa904Sopenharmony_ci
504e01aa904Sopenharmony_ci  * ``--fail-no-debug-info``
505e01aa904Sopenharmony_ci
506e01aa904Sopenharmony_ci    If no debug info was found, then this option makes the program to
507e01aa904Sopenharmony_ci    fail.  Otherwise, without this option, the program will attempt to
508e01aa904Sopenharmony_ci    compare properties of the binaries that are not related to debug
509e01aa904Sopenharmony_ci    info, like pure ELF properties.
510e01aa904Sopenharmony_ci
511e01aa904Sopenharmony_ci  * ``--leaf-changes-only|-l`` only show leaf changes, so don't show
512e01aa904Sopenharmony_ci    impact analysis report.  This option implies ``--redundant``.
513e01aa904Sopenharmony_ci
514e01aa904Sopenharmony_ci    The typical output of abidiff when comparing two binaries looks
515e01aa904Sopenharmony_ci    like this ::
516e01aa904Sopenharmony_ci
517e01aa904Sopenharmony_ci	$ abidiff libtest-v0.so libtest-v1.so
518e01aa904Sopenharmony_ci	Functions changes summary: 0 Removed, 1 Changed, 0 Added function
519e01aa904Sopenharmony_ci	Variables changes summary: 0 Removed, 0 Changed, 0 Added variable
520e01aa904Sopenharmony_ci
521e01aa904Sopenharmony_ci	1 function with some indirect sub-type change:
522e01aa904Sopenharmony_ci
523e01aa904Sopenharmony_ci	  [C]'function void fn(C&)' at test-v1.cc:13:1 has some indirect sub-type changes:
524e01aa904Sopenharmony_ci	    parameter 1 of type 'C&' has sub-type changes:
525e01aa904Sopenharmony_ci	      in referenced type 'struct C' at test-v1.cc:7:1:
526e01aa904Sopenharmony_ci		type size hasn't changed
527e01aa904Sopenharmony_ci		1 data member change:
528e01aa904Sopenharmony_ci		 type of 'leaf* C::m0' changed:
529e01aa904Sopenharmony_ci		   in pointed to type 'struct leaf' at test-v1.cc:1:1:
530e01aa904Sopenharmony_ci		     type size changed from 32 to 64 bits
531e01aa904Sopenharmony_ci		     1 data member insertion:
532e01aa904Sopenharmony_ci		       'char leaf::m1', at offset 32 (in bits) at test-v1.cc:4:1
533e01aa904Sopenharmony_ci
534e01aa904Sopenharmony_ci	$
535e01aa904Sopenharmony_ci
536e01aa904Sopenharmony_ci    So in that example the report emits information about how the data
537e01aa904Sopenharmony_ci    member insertion change of "struct leaf" is reachable from
538e01aa904Sopenharmony_ci    function "void fn(C&)".  In other words, the report not only shows
539e01aa904Sopenharmony_ci    the data member change on "struct leaf", but it also shows the
540e01aa904Sopenharmony_ci    impact of that change on the function "void fn(C&)".
541e01aa904Sopenharmony_ci
542e01aa904Sopenharmony_ci    In abidiff parlance, the change on "struct leaf" is called a leaf
543e01aa904Sopenharmony_ci    change.  So the ``--leaf-changes-only --impacted-interfaces``
544e01aa904Sopenharmony_ci    options show, well, only the leaf change.  And it goes like this:
545e01aa904Sopenharmony_ci    ::
546e01aa904Sopenharmony_ci
547e01aa904Sopenharmony_ci	$ abidiff -l libtest-v0.so libtest-v1.so
548e01aa904Sopenharmony_ci	'struct leaf' changed:
549e01aa904Sopenharmony_ci	  type size changed from 32 to 64 bits
550e01aa904Sopenharmony_ci	  1 data member insertion:
551e01aa904Sopenharmony_ci	    'char leaf::m1', at offset 32 (in bits) at test-v1.cc:4:1
552e01aa904Sopenharmony_ci
553e01aa904Sopenharmony_ci	  one impacted interface:
554e01aa904Sopenharmony_ci	    function void fn(C&)
555e01aa904Sopenharmony_ci	$
556e01aa904Sopenharmony_ci
557e01aa904Sopenharmony_ci    Note how the report ends by showing the list of interfaces
558e01aa904Sopenharmony_ci    impacted by the leaf change.
559e01aa904Sopenharmony_ci
560e01aa904Sopenharmony_ci    Now if you don't want to see that list of impacted interfaces,
561e01aa904Sopenharmony_ci    then you can just avoid using the ``--impacted-interface`` option.
562e01aa904Sopenharmony_ci    You can learn about that option below, in any case.
563e01aa904Sopenharmony_ci
564e01aa904Sopenharmony_ci
565e01aa904Sopenharmony_ci  * ``--impacted-interfaces``
566e01aa904Sopenharmony_ci
567e01aa904Sopenharmony_ci    When showing leaf changes, this option instructs abidiff to show
568e01aa904Sopenharmony_ci    the list of impacted interfaces.  This option is thus to be used
569e01aa904Sopenharmony_ci    in addition the ``--leaf-changes-only`` option, otherwise, it's
570e01aa904Sopenharmony_ci    ignored.
571e01aa904Sopenharmony_ci
572e01aa904Sopenharmony_ci
573e01aa904Sopenharmony_ci  *  ``--dump-diff-tree``
574e01aa904Sopenharmony_ci
575e01aa904Sopenharmony_ci    After the diff report, emit a textual representation of the diff
576e01aa904Sopenharmony_ci    nodes tree used by the comparison engine to represent the changed
577e01aa904Sopenharmony_ci    functions and variables.  That representation is emitted to the
578e01aa904Sopenharmony_ci    error output for debugging purposes.  Note that this diff tree is
579e01aa904Sopenharmony_ci    relevant only to functions and variables that have some sub-type
580e01aa904Sopenharmony_ci    changes.  Added or removed functions and variables do not have any
581e01aa904Sopenharmony_ci    diff nodes tree associated to them.
582e01aa904Sopenharmony_ci
583e01aa904Sopenharmony_ci  * ``--no-assume-odr-for-cplusplus``
584e01aa904Sopenharmony_ci
585e01aa904Sopenharmony_ci    When analysing a binary originating from C++ code using `DWARF`_
586e01aa904Sopenharmony_ci    debug information, libabigail assumes the `One Definition Rule`_
587e01aa904Sopenharmony_ci    to speed-up the analysis.  In that case, when several types have
588e01aa904Sopenharmony_ci    the same name in the binary, they are assumed to all be equal.
589e01aa904Sopenharmony_ci
590e01aa904Sopenharmony_ci    This option disables that assumption and instructs libabigail to
591e01aa904Sopenharmony_ci    actually actually compare the types to determine if they are
592e01aa904Sopenharmony_ci    equal.
593e01aa904Sopenharmony_ci
594e01aa904Sopenharmony_ci  * ``--no-leverage-dwarf-factorization``
595e01aa904Sopenharmony_ci
596e01aa904Sopenharmony_ci    When analysing a binary which `DWARF`_ debug information was
597e01aa904Sopenharmony_ci    processed with the `DWZ`_ tool, the type information is supposed
598e01aa904Sopenharmony_ci    to be already factorized.  That context is used by libabigail to
599e01aa904Sopenharmony_ci    perform some speed optimizations.
600e01aa904Sopenharmony_ci
601e01aa904Sopenharmony_ci    This option disables those optimizations.
602e01aa904Sopenharmony_ci
603e01aa904Sopenharmony_ci  * ``--ctf``
604e01aa904Sopenharmony_ci
605e01aa904Sopenharmony_ci    When comparing binaries, extract ABI information from `CTF`_ debug
606e01aa904Sopenharmony_ci    information, if present.
607e01aa904Sopenharmony_ci
608e01aa904Sopenharmony_ci  * ``--stats``
609e01aa904Sopenharmony_ci
610e01aa904Sopenharmony_ci    Emit statistics about various internal things.
611e01aa904Sopenharmony_ci
612e01aa904Sopenharmony_ci  * ``--verbose``
613e01aa904Sopenharmony_ci
614e01aa904Sopenharmony_ci    Emit verbose logs about the progress of miscellaneous internal
615e01aa904Sopenharmony_ci    things.
616e01aa904Sopenharmony_ci
617e01aa904Sopenharmony_ci.. _abidiff_return_value_label:
618e01aa904Sopenharmony_ci
619e01aa904Sopenharmony_ciReturn values
620e01aa904Sopenharmony_ci=============
621e01aa904Sopenharmony_ci
622e01aa904Sopenharmony_ciThe exit code of the ``abidiff`` command is either 0 if the ABI of the
623e01aa904Sopenharmony_cibinaries being compared are equal, or non-zero if they differ or if
624e01aa904Sopenharmony_cithe tool encountered an error.
625e01aa904Sopenharmony_ci
626e01aa904Sopenharmony_ciIn the later case, the exit code is a 8-bits-wide bit field in which
627e01aa904Sopenharmony_cieach bit has a specific meaning.
628e01aa904Sopenharmony_ci
629e01aa904Sopenharmony_ciThe first bit, of value 1, named ``ABIDIFF_ERROR`` means there was an
630e01aa904Sopenharmony_cierror.
631e01aa904Sopenharmony_ci
632e01aa904Sopenharmony_ciThe second bit, of value 2, named ``ABIDIFF_USAGE_ERROR`` means there
633e01aa904Sopenharmony_ciwas an error in the way the user invoked the tool.  It might be set,
634e01aa904Sopenharmony_cifor instance, if the user invoked the tool with an unknown command
635e01aa904Sopenharmony_ciline switch, with a wrong number or argument, etc.  If this bit is
636e01aa904Sopenharmony_ciset, then the ``ABIDIFF_ERROR`` bit must be set as well.
637e01aa904Sopenharmony_ci
638e01aa904Sopenharmony_ciThe third bit, of value 4, named ``ABIDIFF_ABI_CHANGE`` means the ABI
639e01aa904Sopenharmony_ciof the binaries being compared are different.  
640e01aa904Sopenharmony_ci
641e01aa904Sopenharmony_ciThe fourth bit, of value 8, named ``ABIDIFF_ABI_INCOMPATIBLE_CHANGE``
642e01aa904Sopenharmony_cimeans the ABI of the binaries compared are different in an
643e01aa904Sopenharmony_ciincompatible way.  If this bit is set, then the ``ABIDIFF_ABI_CHANGE``
644e01aa904Sopenharmony_cibit must be set as well.  If the ``ABIDIFF_ABI_CHANGE`` is set and the
645e01aa904Sopenharmony_ci``ABIDIFF_INCOMPATIBLE_CHANGE`` is *NOT* set, then it means that the
646e01aa904Sopenharmony_ciABIs being compared might or might not be compatible.  In that case, a
647e01aa904Sopenharmony_cihuman being needs to review the ABI changes to decide if they are
648e01aa904Sopenharmony_cicompatible or not.
649e01aa904Sopenharmony_ci
650e01aa904Sopenharmony_ciNote that, at the moment, there are only a few kinds of ABI changes
651e01aa904Sopenharmony_cithat would result in setting the flag ``ABIDIFF_ABI_INCOMPATIBLE_CHANGE``.
652e01aa904Sopenharmony_ciThose ABI changes are either:
653e01aa904Sopenharmony_ci
654e01aa904Sopenharmony_ci  - the removal of the symbol of a function or variable that has been
655e01aa904Sopenharmony_ci    defined and exported.
656e01aa904Sopenharmony_ci  - the modification of the index of a member of a virtual function
657e01aa904Sopenharmony_ci    table (for C++ programs and libraries).
658e01aa904Sopenharmony_ci
659e01aa904Sopenharmony_ciWith time, when more ABI change patterns are found to *always*
660e01aa904Sopenharmony_ciconstitute incompatible ABI changes, we will adapt the code to
661e01aa904Sopenharmony_cirecognize those cases and set the ``ABIDIFF_ABI_INCOMPATIBLE_CHANGE``
662e01aa904Sopenharmony_ciaccordingly.  So, if you find such patterns, please let us know.
663e01aa904Sopenharmony_ci
664e01aa904Sopenharmony_ciThe remaining bits are not used for the moment.
665e01aa904Sopenharmony_ci
666e01aa904Sopenharmony_ci.. _abidiff_usage_example_label:
667e01aa904Sopenharmony_ci
668e01aa904Sopenharmony_ciUsage examples
669e01aa904Sopenharmony_ci==============
670e01aa904Sopenharmony_ci
671e01aa904Sopenharmony_ci  1. Detecting a change in a sub-type of a function: ::
672e01aa904Sopenharmony_ci
673e01aa904Sopenharmony_ci	$ cat -n test-v0.cc
674e01aa904Sopenharmony_ci		 1	// Compile this with:
675e01aa904Sopenharmony_ci		 2	//   g++ -g -Wall -shared -o libtest-v0.so test-v0.cc
676e01aa904Sopenharmony_ci		 3	
677e01aa904Sopenharmony_ci		 4	struct S0
678e01aa904Sopenharmony_ci		 5	{
679e01aa904Sopenharmony_ci		 6	  int m0;
680e01aa904Sopenharmony_ci		 7	};
681e01aa904Sopenharmony_ci		 8	
682e01aa904Sopenharmony_ci		 9	void
683e01aa904Sopenharmony_ci		10	foo(S0* /*parameter_name*/)
684e01aa904Sopenharmony_ci		11	{
685e01aa904Sopenharmony_ci		12	  // do something with parameter_name.
686e01aa904Sopenharmony_ci		13	}
687e01aa904Sopenharmony_ci	$ 
688e01aa904Sopenharmony_ci	$ cat -n test-v1.cc
689e01aa904Sopenharmony_ci		 1	// Compile this with:
690e01aa904Sopenharmony_ci		 2	//   g++ -g -Wall -shared -o libtest-v1.so test-v1.cc
691e01aa904Sopenharmony_ci		 3	
692e01aa904Sopenharmony_ci		 4	struct type_base
693e01aa904Sopenharmony_ci		 5	{
694e01aa904Sopenharmony_ci		 6	  int inserted;
695e01aa904Sopenharmony_ci		 7	};
696e01aa904Sopenharmony_ci		 8	
697e01aa904Sopenharmony_ci		 9	struct S0 : public type_base
698e01aa904Sopenharmony_ci		10	{
699e01aa904Sopenharmony_ci		11	  int m0;
700e01aa904Sopenharmony_ci		12	};
701e01aa904Sopenharmony_ci		13	
702e01aa904Sopenharmony_ci		14	void
703e01aa904Sopenharmony_ci		15	foo(S0* /*parameter_name*/)
704e01aa904Sopenharmony_ci		16	{
705e01aa904Sopenharmony_ci		17	  // do something with parameter_name.
706e01aa904Sopenharmony_ci		18	}
707e01aa904Sopenharmony_ci	$ 
708e01aa904Sopenharmony_ci	$ g++ -g -Wall -shared -o libtest-v0.so test-v0.cc
709e01aa904Sopenharmony_ci	$ g++ -g -Wall -shared -o libtest-v1.so test-v1.cc
710e01aa904Sopenharmony_ci	$ 
711e01aa904Sopenharmony_ci	$ ../build/tools/abidiff libtest-v0.so libtest-v1.so
712e01aa904Sopenharmony_ci	Functions changes summary: 0 Removed, 1 Changed, 0 Added function
713e01aa904Sopenharmony_ci	Variables changes summary: 0 Removed, 0 Changed, 0 Added variable
714e01aa904Sopenharmony_ci
715e01aa904Sopenharmony_ci	1 function with some indirect sub-type change:
716e01aa904Sopenharmony_ci
717e01aa904Sopenharmony_ci	  [C]'function void foo(S0*)' has some indirect sub-type changes:
718e01aa904Sopenharmony_ci		parameter 0 of type 'S0*' has sub-type changes:
719e01aa904Sopenharmony_ci		  in pointed to type 'struct S0':
720e01aa904Sopenharmony_ci		    size changed from 32 to 64 bits
721e01aa904Sopenharmony_ci		    1 base class insertion:
722e01aa904Sopenharmony_ci		      struct type_base
723e01aa904Sopenharmony_ci		    1 data member change:
724e01aa904Sopenharmony_ci		     'int S0::m0' offset changed from 0 to 32
725e01aa904Sopenharmony_ci	$
726e01aa904Sopenharmony_ci
727e01aa904Sopenharmony_ci
728e01aa904Sopenharmony_ci  2. Detecting another change in a sub-type of a function: ::
729e01aa904Sopenharmony_ci
730e01aa904Sopenharmony_ci	$ cat -n test-v0.cc
731e01aa904Sopenharmony_ci		 1	// Compile this with:
732e01aa904Sopenharmony_ci		 2	//   g++ -g -Wall -shared -o libtest-v0.so test-v0.cc
733e01aa904Sopenharmony_ci		 3	
734e01aa904Sopenharmony_ci		 4	struct S0
735e01aa904Sopenharmony_ci		 5	{
736e01aa904Sopenharmony_ci		 6	  int m0;
737e01aa904Sopenharmony_ci		 7	};
738e01aa904Sopenharmony_ci		 8	
739e01aa904Sopenharmony_ci		 9	void
740e01aa904Sopenharmony_ci		10	foo(S0& /*parameter_name*/)
741e01aa904Sopenharmony_ci		11	{
742e01aa904Sopenharmony_ci		12	  // do something with parameter_name.
743e01aa904Sopenharmony_ci		13	}
744e01aa904Sopenharmony_ci	$ 
745e01aa904Sopenharmony_ci	$ cat -n test-v1.cc
746e01aa904Sopenharmony_ci		 1	// Compile this with:
747e01aa904Sopenharmony_ci		 2	//   g++ -g -Wall -shared -o libtest-v1.so test-v1.cc
748e01aa904Sopenharmony_ci		 3	
749e01aa904Sopenharmony_ci		 4	struct S0
750e01aa904Sopenharmony_ci		 5	{
751e01aa904Sopenharmony_ci		 6	  char inserted_member;
752e01aa904Sopenharmony_ci		 7	  int m0;
753e01aa904Sopenharmony_ci		 8	};
754e01aa904Sopenharmony_ci		 9	
755e01aa904Sopenharmony_ci		10	void
756e01aa904Sopenharmony_ci		11	foo(S0& /*parameter_name*/)
757e01aa904Sopenharmony_ci		12	{
758e01aa904Sopenharmony_ci		13	  // do something with parameter_name.
759e01aa904Sopenharmony_ci		14	}
760e01aa904Sopenharmony_ci	$ 
761e01aa904Sopenharmony_ci	$ g++ -g -Wall -shared -o libtest-v0.so test-v0.cc
762e01aa904Sopenharmony_ci	$ g++ -g -Wall -shared -o libtest-v1.so test-v1.cc
763e01aa904Sopenharmony_ci	$ 
764e01aa904Sopenharmony_ci	$ ../build/tools/abidiff libtest-v0.so libtest-v1.so
765e01aa904Sopenharmony_ci	Functions changes summary: 0 Removed, 1 Changed, 0 Added function
766e01aa904Sopenharmony_ci	Variables changes summary: 0 Removed, 0 Changed, 0 Added variable
767e01aa904Sopenharmony_ci
768e01aa904Sopenharmony_ci	1 function with some indirect sub-type change:
769e01aa904Sopenharmony_ci
770e01aa904Sopenharmony_ci	  [C]'function void foo(S0&)' has some indirect sub-type changes:
771e01aa904Sopenharmony_ci		parameter 0 of type 'S0&' has sub-type changes:
772e01aa904Sopenharmony_ci		  in referenced type 'struct S0':
773e01aa904Sopenharmony_ci		    size changed from 32 to 64 bits
774e01aa904Sopenharmony_ci		    1 data member insertion:
775e01aa904Sopenharmony_ci		      'char S0::inserted_member', at offset 0 (in bits)
776e01aa904Sopenharmony_ci		    1 data member change:
777e01aa904Sopenharmony_ci		     'int S0::m0' offset changed from 0 to 32
778e01aa904Sopenharmony_ci
779e01aa904Sopenharmony_ci
780e01aa904Sopenharmony_ci	$
781e01aa904Sopenharmony_ci
782e01aa904Sopenharmony_ci  3. Detecting that functions got removed or added to a library: ::
783e01aa904Sopenharmony_ci
784e01aa904Sopenharmony_ci	$ cat -n test-v0.cc
785e01aa904Sopenharmony_ci		 1	// Compile this with:
786e01aa904Sopenharmony_ci		 2	//   g++ -g -Wall -shared -o libtest-v0.so test-v0.cc
787e01aa904Sopenharmony_ci		 3	
788e01aa904Sopenharmony_ci		 4	struct S0
789e01aa904Sopenharmony_ci		 5	{
790e01aa904Sopenharmony_ci		 6	  int m0;
791e01aa904Sopenharmony_ci		 7	};
792e01aa904Sopenharmony_ci		 8	
793e01aa904Sopenharmony_ci		 9	void
794e01aa904Sopenharmony_ci		10	foo(S0& /*parameter_name*/)
795e01aa904Sopenharmony_ci		11	{
796e01aa904Sopenharmony_ci		12	  // do something with parameter_name.
797e01aa904Sopenharmony_ci		13	}
798e01aa904Sopenharmony_ci	$ 
799e01aa904Sopenharmony_ci	$ cat -n test-v1.cc
800e01aa904Sopenharmony_ci		 1	// Compile this with:
801e01aa904Sopenharmony_ci		 2	//   g++ -g -Wall -shared -o libtest-v1.so test-v1.cc
802e01aa904Sopenharmony_ci		 3	
803e01aa904Sopenharmony_ci		 4	struct S0
804e01aa904Sopenharmony_ci		 5	{
805e01aa904Sopenharmony_ci		 6	  char inserted_member;
806e01aa904Sopenharmony_ci		 7	  int m0;
807e01aa904Sopenharmony_ci		 8	};
808e01aa904Sopenharmony_ci		 9	
809e01aa904Sopenharmony_ci		10	void
810e01aa904Sopenharmony_ci		11	bar(S0& /*parameter_name*/)
811e01aa904Sopenharmony_ci		12	{
812e01aa904Sopenharmony_ci		13	  // do something with parameter_name.
813e01aa904Sopenharmony_ci		14	}
814e01aa904Sopenharmony_ci	$ 
815e01aa904Sopenharmony_ci	$ g++ -g -Wall -shared -o libtest-v0.so test-v0.cc
816e01aa904Sopenharmony_ci	$ g++ -g -Wall -shared -o libtest-v1.so test-v1.cc
817e01aa904Sopenharmony_ci	$ 
818e01aa904Sopenharmony_ci	$ ../build/tools/abidiff libtest-v0.so libtest-v1.so
819e01aa904Sopenharmony_ci	Functions changes summary: 1 Removed, 0 Changed, 1 Added functions
820e01aa904Sopenharmony_ci	Variables changes summary: 0 Removed, 0 Changed, 0 Added variable
821e01aa904Sopenharmony_ci
822e01aa904Sopenharmony_ci	1 Removed function:
823e01aa904Sopenharmony_ci	  'function void foo(S0&)'    {_Z3fooR2S0}
824e01aa904Sopenharmony_ci
825e01aa904Sopenharmony_ci	1 Added function:
826e01aa904Sopenharmony_ci	  'function void bar(S0&)'    {_Z3barR2S0}
827e01aa904Sopenharmony_ci
828e01aa904Sopenharmony_ci	$
829e01aa904Sopenharmony_ci
830e01aa904Sopenharmony_ci.. _ELF: http://en.wikipedia.org/wiki/Executable_and_Linkable_Format
831e01aa904Sopenharmony_ci.. _DWARF: http://www.dwarfstd.org
832e01aa904Sopenharmony_ci.. _CTF: https://raw.githubusercontent.com/wiki/oracle/binutils-gdb/files/ctf-spec.pdf
833e01aa904Sopenharmony_ci.. _ODR: https://en.wikipedia.org/wiki/One_Definition_Rule
834e01aa904Sopenharmony_ci.. _One Definition Rule: https://en.wikipedia.org/wiki/One_Definition_Rule
835e01aa904Sopenharmony_ci.. _DWZ: https://sourceware.org/dwz
836