commit | 31dfe987b837d343a6435407ed2a68c1729bb435 | [log] [tgz] |
---|---|---|
author | Vanessa Sochat <vsochat@gmail.com> | Fri May 06 06:36:16 2022 -0600 |
committer | Vanessa Sochat <vsochat@gmail.com> | Thu May 19 10:41:13 2022 -0600 |
tree | 558600c61c4df005e9724101d225f37063931597 | |
parent | a4a879a11485dfd4bf6c1cc41b204c235570dff1 [diff] |
adding Dockerfile, Makefile, and documentation There is currently no instruction or build file to make it easy to develop STG tools. This changeset adds a basic Makefile, automated container build, and associated documentation as the start of work to help with that. Note that it is not intended to be a final solution, but to empower interested developers to build STG tools. Note that the Dockerfile uses a Fedora base, and this is done for the libabigail build, which would take quite a bit of extra work to figure out on a debian slim base. This Dockerfile base can be updated to debian-slim (a more stable container) when the libabigail dependency is removed. Signed-off-by: Vanessa Sochat <vsochat@gmail.com> Change-Id: Ifa6528cc738e7a694a3b4470894ab9d3484d8394
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 libabigail for ELF symbol functionality, on libxml2 for XML parsing and on Linux UAPI headers for BTF types.
To build from source, you will need several dependencies on your host, mentioned in the Dockerfile. Importantly, you will need a cloned and compiled libabigail, which can be done as follows:
git clone git://sourceware.org/git/libabigail.git cd libabigail
Note that if you want to checkout a particular tag, you can do git tag
and then git checkout <tag>
to ensure you aren't working with a moving target. Next, prepare your build directory, and build:
mkdir -p build autoreconf -i cd build VISIBILITY_FLAGS=default ../configure --prefix=/opt/libabigail make -j $(nproc) all make install
In the above, setting the visibility flags variable is important as will not work without it - symbols that need to be found in the final compiled library will be hidden, and the build of STG tools will fail due to missing symbols:
undefined reference to `abigail::symtab_reader::symtab::make_filter() const' undefined reference to `abigail::elf_helpers::find_section(Elf*, ... collect2: error: ld returned 1 exit status make: *** [Makefile:17: stgdiff] Error 1
Specifically the symtab reader is an internal header and internal source file, and the interface is not exposed. You can read more about visibility in libabigail here. Note that this particular issue has been reported to the libabigail maintainers, specifically a suggestion that these functions should not be private by default.
You can then provide the libabigail source path to the Makefile as follows. Let's say you installed libabigail to the path /abigail
, you might run:
LIBABIGAIL_SRC=/abigail make -j $(nproc)
And that‘s it! If you want a portable environment ready to go, it’s recommended to build the container.
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
Libabigail (a current dependency) is on the path, and the code for the repository should be in the present working directory. You can build as follows:
$ make
Note that libabigail has source code and a build under /code
, and this path is default in the Makefile. If you want to bind your development code to the container:
$ docker run -v $PWD:/src -it stg
And then you can make changes on the host and build / test in the container.
See CONTRIBUTING.md for details.