Documentation
¶
Overview ¶
Package elftest builds minimal, REAL ELF64 files for tests.
⛔ IT EXISTS BECAUSE A PLACEHOLDER FIXTURE CANNOT WITNESS A CHECK THAT READS BYTES. In go-pkgx/bk, every "shared library" in the tests of `bk unlinked` contained the single byte "x". The suite was green, coverage was complete and every mutation was caught — while the shipped command counted `libstdc++.so.6.0.33-gdb.py` (a Python script) as a library in v0.43, and then refused `libfolly.so.0.58.0-dev` (an ELF shared object) in v0.44.0. Two opposite errors in one day, both invisible to fixtures that were not ELF files.
The builders here are deliberately hand-assembled rather than produced by a linker: a test that needs a toolchain to make its input does not run on the lane where the input is foreign, which is exactly the lane a cross-platform reader has to be right on.
Each builder verifies its own output with debug/elf before returning, so a malformed fixture fails as a fixture rather than as the thing under test.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WriteExports ¶
WriteExports writes an ELF64 whose .dynsym DEFINES the given symbols, and leaves `undef` as undefined references.
⛔ THE SPLIT IS THE POINT. An undefined symbol is one the file NEEDS; a defined one is what it PROVIDES. A reader that does not separate them answers "does it use gettext" when asked "does it provide gettext", and those have opposite consequences for a dependency.
Types ¶
This section is empty.