builder

package
v0.13.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 13, 2020 License: BSD-3-Clause Imports: 24 Imported by: 0

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

View Source
var CompilerRT = Library{
	// contains filtered or unexported fields
}

CompilerRT is a library with symbols required by programs compiled with LLVM. These symbols are for operations that cannot be emitted with a single instruction or a short sequence of instructions for that target.

For more information, see: https://compiler-rt.llvm.org/

View Source
var Picolibc = Library{
	// contains filtered or unexported fields
}

Picolibc is a C library for bare metal embedded devices. It was originally based on newlib.

Functions

func Build

func Build(pkgName, outpath string, config *compileopts.Config, action func(string) error) 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.

func GorootVersionString

func GorootVersionString(goroot string) (string, error)

GorootVersionString returns the version string as reported by the Go toolchain for the given GOROOT path. It is usually of the form `go1.x.y` but can have some variations (for beta releases, for example).

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 RunTool added in v0.13.0

func RunTool(tool string, args ...string) error

RunTool runs the given tool (such as clang).

This version doesn't actually run the tool: TinyGo has not been compiled by statically linking to LLVM.

Types

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.

func (*Library) Load added in v0.13.0

func (l *Library) Load(target string) (path string, err error)

Load the library archive, possibly generating and caching it if needed.

type MultiError

type MultiError struct {
	Errs []error
}

MultiError is a list of multiple errors (actually: diagnostics) returned during LLVM IR generation.

func (*MultiError) Error

func (e *MultiError) Error() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL