Documentation
¶
Overview ¶
Package testbin builds the small binaries the Brotli detector's tests read: decoder error tables exactly as each upstream release lays them out, and ELF, PE and Mach-O files that define or import decoder symbols.
Index ¶
- Variables
- func DecoderTables(gap int) []byte
- func ELF(syms []Symbol, extra []byte) []byte
- func ELFAt(syms []Symbol, extra []byte, addr, value uint64, machine uint16) []byte
- func Executable(extra ...[]byte) []byte
- func MachO(syms []Symbol, extra []byte) []byte
- func PE(exports []string, extra []byte) []byte
- func Table(release string) []byte
- type Symbol
Constants ¶
This section is empty.
Variables ¶
var Releases = map[string]struct { Names []string Prefixed bool }{ "1.0.2": {list(success, common, compound, tail), false}, "1.0.3": {list(success, common, distance, compound, tail), false}, "1.0.9": {list(success, common, distance, tail), false}, "1.0.10": {list(success, common, distance, blockSwitch, tail), false}, "1.1.0": {list(success, common, distance, compound, tail), true}, "1.1.1": {list(success, common, distance, blockSwitch, compound, tail), true}, "1.2.0": {list(success, common, distance, compound, tail), true}, "1.2.1": {list(success, common, distance, blockSwitch, compound, tail), true}, }
Releases maps a Brotli release to its error names and whether it stores them prefixed. 1.0.4 to 1.0.9 dropped COMPOUND_DICTIONARY; 1.1.0 brought it back and the prefixed form.
Functions ¶
func DecoderTables ¶
DecoderTables returns the decoder's two code-length tables (kCodeLengthPrefixLength, then kCodeLengthPrefixValue) as a compiler lays them out, with gap bytes between them.
func ELF ¶
ELF returns a little-endian ELF64 shared object whose .dynsym holds syms, followed by extra (a table, a version stamp) in a data section.
func ELFAt ¶
ELFAt is ELF with the data section loaded at addr (0: not loaded), each defined symbol's value set to value, and the given machine (62 x86-64, 183 arm64). The data section is also marked executable, so extra can hold code.
func Executable ¶
Executable returns extra behind an ELF header and padding: a file the engine reads as an executable, with no symbol tables.
func MachO ¶
MachO returns a 64-bit Mach-O dylib whose symbol table holds syms (defined ones as exported N_SECT symbols), followed by extra.