mirror of
git://sourceware.org/git/libabigail.git
synced 2025-03-10 16:47:52 +00:00
This adds support for the BTF debug information format. It provides a new BTF front-end which can be instantiated by the function tools::create_best_elf_based_reader(). For now, the BTF front-end supports the basic types (integers, pointers, qualified types, typedefs, struct and unions and function pointers) for functions and variables as emitted for the C language by GCC. It seems to be able to support the BTF debug information emitted for the vmlinux kernel by the pahole tool as well. When configured with the --enable-btf option, the WITH_BTF pre-processor macro is defined, enabling the BTF support. That option is turned on by default if the /usr/include/bpf/btf.h header is found on the system. To disable this, one can use the --disable-btf option. The abidw and abidiff programs have been adapted to use the BTF front-end when provided with the '--btf' option, or if BTF debug information is the only one present in the binary. * configure.ac: If the header /usr/include/bpf/btf.h exists, then define the WITH_BTF pre-processor macro, unless --disable-btf was provided. * doc/manuals/abidiff.rst: Document the new --btf option. * doc/manuals/abidw.rst: Likewise. * doc/manuals/kmidiff.rst: Likewise. * doc/manuals/abipkgdiff.rst: Likewise. * include/abg-btf-reader.h: New header file. Contains the declaration of the new btf::reader class. * src/abg-btf-reader.cc: New source file. Contains the definitions of the new btf::reader class. * include/Makefile.am: Add the new include/abg-btf-reader.h header file to source distribution. * include/abg-corpus.h (enum origin): Add a new BTF_ORIGIN enumerator. * include/abg-tools-utils.h (file_has_btf_debug_info): Declare new function. * src/abg-tools-utils.cc (file_has_btf_debug_info): Define new function. (create_best_elf_based_reader): Adapt to support BTF input. If the user requested the BTF front-end, instantiate it. Otherwise, if the input file has only BTF debug info, instantiate the BTF front end. * include/abg-elf-reader.h (elf::reader::find_btf_section): Declare new member function. (elf::reader::{function, variable}_symbol_is_exported): Add new overloads. * src/abg-elf-reader.cc (reader::priv::btf_section): New data member. (reader::find_btf_section): Define new member function. * src/Makefile.am: Add the new abg-ctf-reader.cc file to source distribution. * tools/abidw.cc (options::use_btf): New data member. (display_usage): Add a help string for the new --btf option. (parse_command_line): Support the new --btf option. (load_corpus_and_write_abixml): If the user asked to use the btf front-end then use that one. * tools/abidiff.cc (options::use_btf): New data member. (options::options): Initialize it. (display_usage):: Add a help string to the new --btf options. (parse_command_line): Support the new --btf options. (main): If the user asked to use the btf front-end, then use that one. * tools/abidw.cc (options::use_btf): New data member. (options::options): Initialize it. (parse_command_line): Add a help string to the new --btf options. (load_corpus_and_write_abixml): If the user asked to use the btf front-end, then use that one. * tools/kmidiff.cc (options::use_btf): New data member. (options::options): Initialize it. (display_usage): Add a help string to the new --btf options. (parse_command_line): Add a help string to the new --btf options. (main): If the user asked to use the btf front-end, then use that one. * tools/abipkgdiff.cc (options::use_btf): New data member. (options::options): Initialize it. (display_usage): Add a help string to the new --btf options. (parse_command_line): Add a help string to the new --btf options. (compare, compare_to_self) (compare_prepared_linux_kernel_packages): If the user asked to use the btf front-end, then use that one. * tests/data/test-read-btf/test{0,1}.o: New binary test input file. * tests/data/test-read-btf/test{0,1}.c: Source code of the binary input file above. * tests/data/test-read-btf/test{0,1}.o.abi: Reference ABIXML output. * tests/data/test-abidiff-exit/btf/test0-report-{1,2}.txt: New test reference output. * tests/data/test-abidiff-exit/btf/test0-v{0,1}.o: New binary test input. * tests/data/test-abidiff-exit/btf/test0-v{0,1}.c: The source files of the binary inputs above. * tests/test-read-btf.cc: New test file to run the btf/abixml tests. * tests/Makefile.am: Add the new test files to the source distribution. Signed-off-by: Dodji Seketeli <dodji@redhat.com>
24 lines
1.2 KiB
Plaintext
24 lines
1.2 KiB
Plaintext
<abi-corpus version='2.1' path='data/test-read-btf/test1.o'>
|
|
<elf-function-symbols>
|
|
<elf-symbol name='fn0' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
|
|
</elf-function-symbols>
|
|
<abi-instr address-size='64'>
|
|
<typedef-decl name='S' type-id='type-id-1' id='type-id-2'/>
|
|
<typedef-decl name='U' type-id='type-id-3' id='type-id-4'/>
|
|
<pointer-type-def type-id='type-id-2' size-in-bits='64' id='type-id-5'/>
|
|
<pointer-type-def type-id='type-id-4' size-in-bits='64' id='type-id-6'/>
|
|
<function-decl name='fn0' mangled-name='fn0' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='fn0'>
|
|
<parameter type-id='type-id-5' name='p'/>
|
|
<parameter type-id='type-id-6' name='u'/>
|
|
<return type-id='type-id-5'/>
|
|
</function-decl>
|
|
<class-decl name='S' size-in-bits='48' is-struct='yes' visibility='default' is-declaration-only='yes' id='type-id-1'/>
|
|
<union-decl name='U' visibility='default' is-declaration-only='yes' id='type-id-3'/>
|
|
<function-type size-in-bits='64' id='type-id-7'>
|
|
<parameter type-id='type-id-5' name='p'/>
|
|
<parameter type-id='type-id-6' name='u'/>
|
|
<return type-id='type-id-5'/>
|
|
</function-type>
|
|
</abi-instr>
|
|
</abi-corpus>
|