Documentation
¶
Overview ¶
Package tinybpf compiles Go source or pre-compiled LLVM IR into BPF ELF objects suitable for loading with cilium/ebpf or libbpf.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Request ¶
type Request struct {
// Package is a Go package path to compile via TinyGo.
// Mutually exclusive with Inputs.
Package string
// Inputs are pre-compiled LLVM IR/bitcode files to link.
// Supported extensions: .ll, .bc, .o, .a.
// Mutually exclusive with Package.
Inputs []string
// Output is the path for the resulting BPF ELF object.
// Defaults to "bpf.o" if empty.
Output string
// CPU is the BPF CPU version passed to llc (e.g. "v3").
// Defaults to "v3" if empty.
CPU string
// EnableBTF injects BTF type information via pahole.
EnableBTF bool
// ProgramType constrains section validation to a specific BPF program
// type (e.g. "kprobe", "xdp", "tracepoint").
ProgramType string
// Programs lists BPF program function names to keep.
// Auto-detected from IR if omitted.
Programs []string
// Sections maps program function names to ELF section names
// (e.g. "handle_connect" -> "tracepoint/syscalls/sys_enter_connect").
Sections map[string]string
// OptProfile selects a named optimization profile:
// "conservative", "default", "aggressive", or "verifier-safe".
// Defaults to "default" if empty.
OptProfile string
// PassPipeline is an explicit LLVM opt pass pipeline string.
// Overrides OptProfile when set.
PassPipeline string
// CustomPasses are additional LLVM pass names appended to the pipeline.
CustomPasses []string
// Timeout is the per-stage command timeout. Defaults to 30s.
Timeout time.Duration
// KeepTemp preserves intermediate artifacts after the run.
KeepTemp bool
// TempDir specifies a directory for intermediate artifacts.
// When set, artifacts are kept regardless of KeepTemp.
TempDir string
// Cache enables the content-addressed build cache.
Cache bool
// DumpIR writes intermediate IR after each transform stage.
DumpIR bool
// Verbose enables detailed stage logging to Stdout/Stderr.
Verbose bool
// Jobs controls parallel input normalization workers. Defaults to 1.
Jobs int
// Toolchain overrides default tool discovery for LLVM and TinyGo binaries.
Toolchain Toolchain
// Stdout receives verbose and informational output.
// Defaults to [io.Discard] if nil.
Stdout io.Writer
// Stderr receives warning and error detail output.
// Defaults to [io.Discard] if nil.
Stderr io.Writer
}
Request describes the inputs and options for a BPF compilation.
Directories
¶
| Path | Synopsis |
|---|---|
|
cmd
|
|
|
tinybpf
command
|
|
|
Package config loads tinybpf project configuration from a tinybpf.json file and converts it to github.com/kyleseneker/tinybpf.Request values.
|
Package config loads tinybpf project configuration from a tinybpf.json file and converts it to github.com/kyleseneker/tinybpf.Request values. |
|
Package diag provides structured, stage-attributed error types for the tinybpf pipeline.
|
Package diag provides structured, stage-attributed error types for the tinybpf pipeline. |
|
Package elfcheck validates that an output file is a well-formed eBPF ELF object.
|
Package elfcheck validates that an output file is a well-formed eBPF ELF object. |
|
internal
|
|
|
cache
Package cache provides a content-addressed build cache for pipeline artifacts.
|
Package cache provides a content-addressed build cache for pipeline artifacts. |
|
cli
Package cli implements the tinybpf command-line interface.
|
Package cli implements the tinybpf command-line interface. |
|
doctor
Package doctor implements the `tinybpf doctor` subcommand, which discovers and version-checks all LLVM toolchain binaries.
|
Package doctor implements the `tinybpf doctor` subcommand, which discovers and version-checks all LLVM toolchain binaries. |
|
ir
Package ir provides a lightweight AST and round-trip parser for the subset of LLVM IR that TinyGo emits.
|
Package ir provides a lightweight AST and round-trip parser for the subset of LLVM IR that TinyGo emits. |
|
llvm
Package llvm provides typed wrappers for discovering and executing LLVM toolchain binaries (llvm-link, opt, llc, and optional helpers).
|
Package llvm provides typed wrappers for discovering and executing LLVM toolchain binaries (llvm-link, opt, llc, and optional helpers). |
|
pipeline
Package pipeline orchestrates the LLVM tool stages that transform input IR/bitcode into a valid eBPF ELF object.
|
Package pipeline orchestrates the LLVM tool stages that transform input IR/bitcode into a valid eBPF ELF object. |
|
scaffold
Package scaffold generates the file structure for a new tinybpf project.
|
Package scaffold generates the file structure for a new tinybpf project. |
|
testutil
Package testutil provides shared, portable test helpers for internal packages.
|
Package testutil provides shared, portable test helpers for internal packages. |
|
transform
Package transform converts TinyGo-emitted LLVM IR into BPF-compatible IR via structured AST rewrites.
|
Package transform converts TinyGo-emitted LLVM IR into BPF-compatible IR via structured AST rewrites. |
Click to show internal directories.
Click to hide internal directories.