Documentation
¶
Overview ¶
Package builder is the compiler driver of TinyGo. It takes in a package name and an output path, and outputs an executable. It manages the entire compilation pipeline in between.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var BoehmGC = Library{ // contains filtered or unexported fields }
Functions ¶
func LookupCommand ¶ added in v0.21.0
LookupCommand looks up the executable name for a given LLVM tool such as clang or wasm-ld. It returns the (relative) command that can be used to invoke the tool or an error if it could not be found.
func NewConfig ¶
func NewConfig(options *compileopts.Options) (*compileopts.Config, error)
NewConfig builds a new Config object from a set of compiler options. It also loads some information from the environment while doing that. For example, it uses the currently active GOPATH (from the goenv package) to determine the Go version to use.
func ReadBuildID ¶ added in v0.22.0
ReadBuildID reads the build ID from the currently running executable.
Types ¶
type BuildResult ¶ added in v0.15.0
type BuildResult struct { // The executable directly from the linker, usually including debug // information. Used for GDB for example. Executable string // A path to the output binary. It is stored in the tmpdir directory of the // Build function, so if it should be kept it must be copied or moved away. // It is often the same as Executable, but differs if the output format is // .hex for example (instead of the usual ELF). Binary string // The directory of the main package. This is useful for testing as the test // binary must be run in the directory of the tested package. MainDir string // The root of the Go module tree. This is used for running tests in emulator // that restrict file system access to allow them to grant access to the entire // source tree they're likely to need to read testdata from. ModuleRoot string // ImportPath is the import path of the main package. This is useful for // correctly printing test results: the import path isn't always the same as // the path listed on the command line. ImportPath string // Map from path to package name. It is needed to attribute binary size to // the right Go package. PackagePathMap map[string]string }
BuildResult is the output of a build. This includes the binary itself and some other metadata that is obtained while building the binary.
func Build ¶
func Build(pkgName, outpath, tmpdir string, config *compileopts.Config) (BuildResult, error)
Build performs a single package to executable Go build. It takes in a package name, an output path, and set of compile options and from that it manages the whole compilation process.
The error value may be of type *MultiError. Callers will likely want to check for this case and print such errors individually.
type Library ¶ added in v0.13.0
type Library struct {
// contains filtered or unexported fields
}
Library is a container for information about a single C library, such as a compiler runtime or libc.
type LinkerError ¶ added in v0.33.0
type LinkerError struct {
Msg string
}
LLD linker error that could not be parsed or doesn't refer to a source location.
func (LinkerError) Error ¶ added in v0.33.0
func (e LinkerError) Error() string
type MultiError ¶
MultiError is a list of multiple errors (actually: diagnostics) returned during LLVM IR generation.
func (*MultiError) Error ¶
func (e *MultiError) Error() string