commit | c8fd656312c16e90e55be2fea090dad8fa2034e7 | [log] [tgz] |
---|---|---|
author | Aleksei Vetrov <vvvvvv@google.com> | Mon Jan 09 15:43:56 2023 +0000 |
committer | Giuliano Procida <gprocida@google.com> | Mon Jan 09 16:04:32 2023 +0000 |
tree | 5e97e9ce230d2e6d0293200fa273138bbbab71a9 | |
parent | 01ac5f1b740c78ccc70f8fd8eed3ce758b953947 [diff] |
ELF reading: implement `__ksymtab` symbol restriction STG should extract from Linux kernel only symbols, which have entry in `__ksymtab`. Such symbol named `X` would have sibling with name `__ksymtab_X`. To filter these symbols we pass through all symbols, filling `std::unordered_set` with `X` from `__ksymtab_X` entries. Then this set is checked in `IsPublicFunctionOrVariable`. PiperOrigin-RevId: 500710544 Change-Id: Ib1d3d1a6963397273869912b387273510513c591
The STG (symbol-type graph) is an ABI representation and this project contains tools for the creation and comparison of such representations. At present parsers exist for libabigail's ABI XML (C types only) and BTF. The ABI diff tool, stgdiff, supports multiple reporting options.
This software currently depends on libxml2 for XML parsing, on libelf to find .BTF sections and on Linux UAPI headers for BTF types.
To build from source, you will need a few dependencies:
Debian | RedHat |
---|---|
libelf-dev | elfutils-devel |
libxml2-dev | libxml2-devel |
linux-libc-dev | kernel-headers |
Instructions are included for local and Docker builds.
You can build as follows:
$ make
A Dockerfile is provided to build a container with libabigail to easily compile the STG tools:
$ docker build -t stg .
And then enter the container:
$ docker run -it stg
If you want to bind your development code to the container:
$ docker run -it $PWD:/src -it stg
The source code is added to /src
, so when your code is bound you can edit on your host and re-compile in the container.
Note that the Dockerfile can provide a development environment (non multi-stage build with the source code) or a production image (a multi-stage build with only the final binary). By default we provide the first, and you can uncomment the final lines of the file for the latter.
See CONTRIBUTING.md for details.