Clone this repo:
  1. 1207080 Merge branch 'upstream-main' into 'main' by Giuliano Procida · 7 days ago main master
  2. f821549 DWARF processor: handle DW_TAG_GNU_formal_parameter_pack DIEs by Giuliano Procida · 7 days ago
  3. eed00c2 rust: delegate DWARF processing for `variant_part` to variant DWARF processor by Sid Nayyar · 8 days ago
  4. f1448a2 rust: add DWARF processor for `Variant` node by Sid Nayyar · 8 days ago
  5. 41ede4d rust: add DWARF processor for `VariantMember` nodes by Sid Nayyar · 8 days ago

Symbol-Type Graph (STG)

The STG (symbol-type graph) is an ABI representation and this project contains tools for the creation and comparison of such representations.

The ABI extraction tool, stg, emits a native ABI format. Parsers exist for libabigail's XML format, BTF and ELF / DWARF.

The ABI diff tool, stgdiff, supports multiple reporting options.

STG has a versioned native file format. Older formats can be read and rewritten as the latest.

NOTE: STG is under active developement. Tool arguments and behaviour are subject to change.

Getting STG

Distributions

We intend to package STG for major distributions. Currently we have packages as follows:

DistributionPackage
Arch Linux (AUR)stg-git

Source Code

This source code is available at https://android.googlesource.com/platform/external/stg/.

Building from Source

Instructions are included for local and Docker builds.

Dependencies

STG is written in C++20. It is known to compile with GCC 11, Clang 15 or later versions. Mininum requirements for a local build are:

DependencyDebianRedHatVersion
buildcmakecmake3.14
ELF, BTFlibelf-develfutils-devel0.189
DWARFlibdw-develfutils-devel0.189
XMLlibxml2-devlibxml2-devel2.9
BTFlinux-libc-devkernel-headers5.19
native formatlibprotobuf-devprotobuf-devel3.19
native formatprotobuf-compilerprotobuf-compiler3.19
allocator[^1]libjemalloc-devjemalloc-devel5
catch2[^2]catch2catch2-devel2 (only)

[^1]: jemalloc is optional, but will likely improve performance. [^2]: catch2 is optional, but required to build the test suite.

Local Build

Build STG using CMake as follows:

$ mkdir build && cd build
$ cmake ..
$ cmake --build . --parallel

Run the STG unit test suite:

$ ctest

Docker Build

A Dockerfile is provided to build a container with the STG tools:

$ docker build -t stg .

And then enter the container:

$ docker run -it stg

Note that the Dockerfile provides only a production image. To use Docker as a development environment, you can comment out everything after the line # second stage.

After that you may 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.

Contributions

See CONTRIBUTING.md for details.

Contact Information

Please send feedback, questions and bug reports to kernel-team@android.com.