build

package
v0.0.0-...-b9f4f56 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2021 License: BSD-3-Clause Imports: 13 Imported by: 0

README

build

build is a small set of helper libraries used in kbuild. The functionality here is only separated into another library so that it can be used both by kbuild and gen-version-data.go (which is a one-file tool).

Documentation

Overview

Package build is used to help build data for kbuild.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GoVersion

func GoVersion(gotool string) (version string, err error)

GoVersion returns gotool's version in the form goX.Y, provided gotool is the path to the Go tool.

func OverrideEnv

func OverrideEnv(environ []string, overrides ...string) []string

OverrideEnv takes the current environ and a set of overrides. OverrideEnv ensures that the variables in overrides are set, with their corresponding values, whether they appear in the original environ or not. OverrideEnv does not modify environ.

Typical use:

env := OverrideEnv(os.Environ(), "GOOS=linux", "GOARCH=amd64")

func WriteOffsets

func WriteOffsets(name, pkg, goversion, goarch string, entries []*Entry) error

WriteOffsets writes entries to name, in the form of a Go file containing the entry data.

Types

type Entry

type Entry struct {
	Symbol string
	Offset uintptr
}

Entry maps a symbol name to a memory offset.

func DeriveOffsets

func DeriveOffsets(gotool, goversion, goarch string) ([]*Entry, error)

DeriveOffsets returns the offsets in memory for the important parts of a Go binary for a given version.

The gotool should be a path to the Go tool. The goversion should be the Go version supported by gotool, in the form "goX.Y". The goarch should be the chosen machine architecture. The goarch must be a valid value for GOARCH, supported by Linux, according to `gotool tool dist list`.

Jump to

Keyboard shortcuts

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