1 2====== 3abidw 4====== 5 6abidw reads a shared library in `ELF`_ format and emits an XML 7representation of its ABI to standard output. The emitted 8representation format, named ``ABIXML``, includes all the globally 9defined functions and variables, along with a complete representation 10of their types. It also includes a representation of the globally 11defined ELF symbols of the file. 12 13When given the ``--linux-tree`` option, this program can also handle a 14`Linux kernel`_ tree. That is, a directory tree that contains both 15the vmlinux binary and `Linux Kernel`_ modules. It analyses those 16`Linux Kernel`_ binaries and emits an XML representation of the 17interface between the kernel and its module, to standard output. In 18this case, we don't call it an ABI, but a KMI (Kernel Module 19Interface). The emitted KMI includes all the globally defined 20functions and variables, along with a complete representation of their 21types. 22 23To generate either ABI or KMI representation, by default ``abidw`` 24uses debug information in the `DWARF`_ format, if present, otherwise 25it looks for debug information in `CTF`_ or `BTF`_ formats, if present. 26Finally, if no debug info in these formats is found, it only considers 27`ELF`_ symbols and report about their addition or removal. 28 29.. include:: tools-use-libabigail.txt 30 31.. _abidw_invocation_label: 32 33Invocation 34========== 35 36:: 37 38 abidw [options] [<path-to-elf-file>] 39 40Options 41======= 42 43 * ``--help | -h`` 44 45 Display a short help about the command and exit. 46 47 * ``--version | -v`` 48 49 Display the version of the program and exit. 50 51 * ``--abixml-version`` 52 53 Display the version of the ABIXML format emitted by this program and exit. 54 55 * ``--add-binaries`` <*bin1,bin2,...*> 56 57 For each of the comma-separated binaries given in argument to this 58 option, if the binary is found in the directory specified by the 59 `--added-binaries-dir` option, then load the ABI corpus of the 60 binary and add it to a set of ABI corpora (called a ABI Corpus 61 Group) made of the binary denoted by the Argument of 62 ``abidw``. That corpus group is then serialized out. 63 64 * ``--follow-dependencies`` 65 66 For each dependency of the input binary of ``abidw``, if it is 67 found in the directory specified by the ``--added-binaries-dir`` 68 option, then construct an ABI corpus out of the dependency and add 69 it to a set of ABI corpora (called an ABI Corpus Group) along with 70 the ABI corpus of the input binary of the program. The ABI Corpus 71 Group is then serialized out. 72 73 * ``--list-dependencies`` 74 75 For each dependency of the input binary of``abidw``, if it's found 76 in the directory specified by the ``--added-binaries-dir`` option, 77 then the name of the dependency is printed out. 78 79 * ``--added-binaries-dir | --abd`` <*dir-path*> 80 81 This option is to be used in conjunction with the 82 ``--add-binaries``, the ``--follow-dependencies`` or the 83 ``--list-dependencies`` option. Binaries listed as arguments of 84 the ``--add-binaries`` option or being dependencies of the input 85 binary in the case of the ``--follow-dependencies`` option and 86 found in the directory <*dir-path*> are going to be loaded as ABI 87 corpus and added to the set of ABI corpora (called an ABI corpus 88 group) built and serialized. 89 90 * ``--debug-info-dir | -d`` <*dir-path*> 91 92 In cases where the debug info for *path-to-elf-file* is in a 93 separate file that is located in a non-standard place, this tells 94 ``abidw`` where to look for that debug info file. 95 96 Note that *dir-path* must point to the root directory under which 97 the debug information is arranged in a tree-like manner. Under 98 Red Hat based systems, that directory is usually 99 ``<root>/usr/lib/debug``. 100 101 This option can be provided several times with different root 102 directories. In that case, ``abidw`` will potentially look into 103 all those root directories to find the split debug info for the 104 elf file. 105 106 Note that this option is not mandatory for split debug information 107 installed by your system's package manager because then 108 ``abidw`` knows where to find it. 109 110 * ``--out-file`` <*file-path*> 111 112 This option instructs ``abidw`` to emit the XML representation of 113 *path-to-elf-file* into the file *file-path*, rather than emitting 114 it to its standard output. 115 116 * ``--noout`` 117 118 This option instructs ``abidw`` to not emit the XML representation 119 of the ABI. So it only reads the ELF and debug information, 120 builds the internal representation of the ABI and exits. This 121 option is usually useful for debugging purposes. 122 123 * ``--no-corpus-path`` 124 125 Do not emit the path attribute for the ABI corpus. 126 127 * ``--suppressions | suppr`` <*path-to-suppression-specifications-file*> 128 129 Use a :ref:`suppression specification <suppr_spec_label>` file 130 located at *path-to-suppression-specifications-file*. Note that 131 this option can appear multiple times on the command line. In 132 that case, all of the provided suppression specification files are 133 taken into account. ABI artifacts matched by the suppression 134 specifications are suppressed from the output of this tool. 135 136 137 * ``--kmi-whitelist | -kaw`` <*path-to-whitelist*> 138 139 When analyzing a `Linux Kernel`_ binary, this option points to the 140 white list of names of ELF symbols of functions and variables 141 which ABI must be written out. That white list is called a " 142 Kernel Module Interface white list". This is because for the 143 Kernel, we don't talk about the ABI; we rather talk about the 144 interface between the Kernel and its module. Hence the term 145 ``KMI`` rather than ``ABI`` 146 147 Any other function or variable which ELF symbol are not present in 148 that white list will not be considered by the KMI writing process. 149 150 If this option is not provided -- thus if no white list is 151 provided -- then the entire KMI, that is, all publicly defined and 152 exported functions and global variables by the `Linux Kernel`_ 153 binaries is emitted. 154 155 * ``--linux-tree | --lt`` 156 157 Make ``abidw`` to consider the input path as a path to a directory 158 containing the vmlinux binary as several kernel modules binaries. 159 In that case, this program emits the representation of the Kernel 160 Module Interface (KMI) on the standard output. 161 162 Below is an example of usage of ``abidw`` on a `Linux Kernel`_ 163 tree. 164 165 First, checkout a `Linux Kernel`_ source tree and build it. Then 166 install the kernel modules in a directory somewhere. Copy the 167 vmlinux binary into that directory too. And then serialize the 168 KMI of that kernel to disk, using ``abidw``: :: 169 170 $ git clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 171 $ cd linux && git checkout v4.5 172 $ make allyesconfig all 173 $ mkdir build-output 174 $ make INSTALL_MOD_PATH=./build-output modules_install 175 $ cp vmlinux build-output/modules/4.5.0 176 $ abidw --linux-tree build-output/modules/4.5.0 > build-output/linux-4.5.0.kmi 177 178 * ``--headers-dir | --hd`` <headers-directory-path-1> 179 180 Specifies where to find the public headers of the binary that the 181 tool has to consider. The tool will thus filter out types that 182 are not defined in public headers. 183 184 Note that several public header directories can be specified for 185 the binary to consider. In that case the ``--header-dir`` option 186 should be present several times on the command line, like in the 187 following example: :: 188 189 $ abidw --header-dir /some/path \ 190 --header-dir /some/other/path \ 191 binary > binary.abi 192 193 * ``--header-file | --hf`` <header-file-path> 194 195 Specifies where to find one of the public headers of the abi file 196 that the tool has to consider. The tool will thus filter out 197 types that are not defined in public headers. 198 199 * ``--drop-private-types`` 200 201 This option is to be used with the ``--headers-dir`` and/or 202 ``header-file`` options. With this option, types that are *NOT* 203 defined in the headers are entirely dropped from the internal 204 representation build by Libabigail to represent the ABI and will 205 not end up in the abi XML file. 206 207 * ``--no-elf-needed`` 208 209 Do not include the list of DT_NEEDED dependency names in the 210 corpus. 211 212 * ``--drop-undefined-syms`` 213 214 With this option functions or variables for which the (exported) 215 ELF symbol is undefined are dropped from the internal 216 representation build by Libabigail to represent the ABI and will 217 not end up in the abi XML file. 218 219 * ``--exported-interfaces-only`` 220 221 By default, when looking at the debug information accompanying a 222 binary, this tool analyzes the descriptions of the types reachable 223 by the interfaces (functions and variables) that are visible 224 outside of their translation unit. Once that analysis is done, an 225 ABI corpus is constructed by only considering the subset of types 226 reachable from interfaces associated to `ELF`_ symbols that are 227 defined and exported by the binary. It's that final ABI corpus 228 which textual representation is saved as ``ABIXML``. 229 230 The problem with that approach however is that analyzing all the 231 interfaces that are visible from outside their translation unit 232 can amount to a lot of data, especially when those binaries are 233 applications, as opposed to shared libraries. One example of such 234 applications is the `Linux Kernel`_. Analyzing massive ABI 235 corpora like these can be extremely slow. 236 237 To mitigate that performance issue, this option allows libabigail 238 to only analyze types that are reachable from interfaces 239 associated with defined and exported `ELF`_ symbols. 240 241 Note that this option is turned on by default when analyzing the 242 `Linux Kernel`_. Otherwise, it's turned off by default. 243 244 * ``--allow-non-exported-interfaces`` 245 246 When looking at the debug information accompanying a binary, this 247 tool analyzes the descriptions of the types reachable by the 248 interfaces (functions and variables) that are visible outside of 249 their translation unit. Once that analysis is done, an ABI corpus 250 is constructed by only considering the subset of types reachable 251 from interfaces associated to `ELF`_ symbols that are defined and 252 exported by the binary. It's that final ABI corpus which textual 253 representation is saved as ``ABIXML``. 254 255 The problem with that approach however is that analyzing all the 256 interfaces that are visible from outside their translation unit 257 can amount to a lot of data, especially when those binaries are 258 applications, as opposed to shared libraries. One example of such 259 applications is the `Linux Kernel`_. Analyzing massive ABI 260 corpora like these can be extremely slow. 261 262 In the presence of an "average sized" binary however one can 263 afford having libabigail analyze all interfaces that are visible 264 outside of their translation unit, using this option. 265 266 Note that this option is turned on by default, unless we are in 267 the presence of the `Linux Kernel`_. 268 269 * ``--no-linux-kernel-mode`` 270 271 Without this option, if abipkgiff detects that the binaries it is 272 looking at are Linux Kernel binaries (either vmlinux or modules) 273 then it only considers functions and variables which ELF symbols 274 are listed in the __ksymtab and __ksymtab_gpl sections. 275 276 With this option, abipkgdiff considers the binary as a non-special 277 ELF binary. It thus considers functions and variables which are 278 defined and exported in the ELF sense. 279 280 * ``--check-alternate-debug-info`` <*elf-path*> 281 282 If the debug info for the file *elf-path* contains a reference to 283 an `alternate debug info <alt-di-label>`_ file, ``abidw`` checks 284 that it can find that alternate debug info file. In that case, it 285 emits a meaningful success message mentioning the full path to the 286 alternate debug info file found. Otherwise, it emits an error 287 code. 288 289 * ``--no-show-locs`` 290 291 In the emitted ABI representation, do not show file, line or column 292 where ABI artifacts are defined. 293 294 * ``--no-parameter-names`` 295 296 In the emitted ABI representation, do not show names of function 297 parameters, just the types. 298 299 * ``--no-write-default-sizes`` 300 301 In the XML ABI representation, do not write the size-in-bits for 302 pointer type definitions, reference type definitions, function 303 declarations and function types when they are equal to the default 304 address size of the translation unit. Note that libabigail before 305 1.8 will not set the default size and will interpret types without 306 a size-in-bits attribute as zero sized. 307 308 * ``--type-id-style`` <``sequence``|``hash``> 309 310 This option controls how types are idenfied in the generated XML 311 files. The default ``sequence`` style just numbers (with 312 ``type-id-`` as prefix) the types in the order they are 313 encountered. The ``hash`` style uses a (stable, portable) hash of 314 libabigail's internal type names and is intended to make the XML 315 files easier to diff. 316 317 * ``--check-alternate-debug-info-base-name`` <*elf-path*> 318 319 320 Like ``--check-alternate-debug-info``, but in the success message, 321 only mention the base name of the debug info file; not its full path. 322 323 * ``--load-all-types`` 324 325 By default, ``libabigail`` (and thus ``abidw``) only loads types 326 that are reachable from functions and variables declarations that 327 are publicly defined and exported by the binary. So only those 328 types are present in the output of ``abidw``. This option however 329 makes ``abidw`` load *all* the types defined in the binaries, even 330 those that are not reachable from public declarations. 331 332 * ``--abidiff`` 333 334 Load the ABI of the ELF binary given in argument, save it in 335 libabigail's XML format in a temporary file; read the ABI from the 336 temporary XML file and compare the ABI that has been read back 337 against the ABI of the ELF binary given in argument. The ABIs 338 should compare equal. If they don't, the program emits a 339 diagnostic and exits with a non-zero code. 340 341 This is a debugging and sanity check option. 342 343 * ``--debug-abidiff`` 344 345 Same as ``--abidiff`` but in debug mode. In this mode, error 346 messages are emitted for types which fail type canonicalization. 347 348 This is an optional debugging and sanity check option. To enable 349 it the libabigail package needs to be configured with 350 the --enable-debug-self-comparison option. 351 352 * ``--debug-type-canonicalization | --debug-tc`` 353 354 Debug the type canonicalization process. This is done by using 355 structural and canonical equality when canonicalizing every single 356 type. Structural and canonical equality should yield the same 357 result. If they don't yield the same result for a given type, 358 then it means that the canonicalization of that type went wrong. 359 In that case, an error message is emitted and the execution of the 360 program is aborted. 361 362 This option is available only if the package was configured with 363 the --enable-debug-type-canonicalization option. 364 365 * ``--no-assume-odr-for-cplusplus`` 366 367 When analysing a binary originating from C++ code using `DWARF`_ 368 debug information, libabigail assumes the `One Definition Rule`_ 369 to speed-up the analysis. In that case, when several types have 370 the same name in the binary, they are assumed to all be equal. 371 372 This option disables that assumption and instructs libabigail to 373 actually actually compare the types to determine if they are 374 equal. 375 376 * ``--no-leverage-dwarf-factorization`` 377 378 When analysing a binary which `DWARF`_ debug information was 379 processed with the `DWZ`_ tool, the type information is supposed 380 to be already factorized. That context is used by libabigail to 381 perform some speed optimizations. 382 383 This option disables those optimizations. 384 385 * ``--ctf`` 386 387 Extract ABI information from `CTF`_ debug information, if present in 388 the given object. 389 390 * ``--annotate`` 391 392 Annotate the ABIXML output with comments above most elements. The 393 comments are made of the pretty-printed form types, declaration or 394 even ELF symbols. The purpose is to make the ABIXML output more 395 human-readable for debugging or documenting purposes. 396 397 * ``--stats`` 398 399 Emit statistics about various internal things. 400 401 * ``--verbose`` 402 403 Emit verbose logs about the progress of miscellaneous internal 404 things. 405 406Usage examples 407============== 408 409 1. Emitting an ``ABIXML`` representation of a binary: :: 410 411 $ abidw binary > binary.abi 412 413 414 2. Emitting an ``ABIXML`` representation of a set of binaries 415 specified on the command line: :: 416 417 $ abidw --added-binaries=bin1,bin2,bin3 \ 418 --added-binaries-dir /some/where \ 419 binary > binaries.abi 420 421 Note that the binaries bin1, bin2 and bin3 are to be found in the 422 directory ``/some/where``. A representation of the ABI of the 423 set of binaries ``binary, bin1, bin2`` and ``bin3`` called an 424 ``ABI corpus group`` is serialized in the file binaries.abi. 425 426 3. Emitting an ``ABIXML`` representation of a binary and its 427 dependencies: :: 428 429 $ abidw --follow-dependencies \ 430 --added-binaries-dir /some/where \ 431 binary > binary.abi 432 433 Note that only the dependencies that are found in the directory 434 ``/some/where`` are analysed. Their ABIs, along with the ABI the 435 binary named ``binary`` are represented as an ABI corpus group 436 and serialized in the file ``binary.abi``, in the ABIXML format. 437 438 439Notes 440===== 441 442.. _alt-di-label: 443 444Alternate debug info files 445-------------------------- 446 447As of the version 4 of the DWARF specification, `Alternate debug 448information <http://www.dwarfstd.org/ShowIssue.php?issue=120604.1>`_ 449is a `GNU`_ extension to the DWARF specification. It has however been 450proposed for inclusion into the upcoming version 5 of the DWARF 451standard. You can read more about the GNU extensions to the DWARF 452standard `here 453<https://fedorahosted.org/elfutils/wiki/DwarfExtensions>`_. 454 455.. _ELF: http://en.wikipedia.org/wiki/Executable_and_Linkable_Format 456.. _DWARF: http://www.dwarfstd.org 457.. _GNU: http://www.gnu.org 458.. _Linux Kernel: https://kernel.org/ 459.. _CTF: https://raw.githubusercontent.com/wiki/oracle/binutils-gdb/files/ctf-spec.pdf 460.. _BTF: https://docs.kernel.org/bpf/btf.html 461.. _ODR: https://en.wikipedia.org/wiki/One_Definition_Rule 462.. _One Definition Rule: https://en.wikipedia.org/wiki/One_Definition_Rule 463.. _DWZ: https://sourceware.org/dwz 464