...

Package gccgoexportdata

import "golang.org/x/tools/go/gccgoexportdata"
Overview
Index

Overview ▾

Package gccgoexportdata provides functions for reading export data files containing type information produced by the gccgo compiler.

This package is a stop-gap until such time as gccgo uses the same export data format as gc; see Go issue 17573. Once that occurs, this package will be deprecated and eventually deleted.

func CompilerInfo

func CompilerInfo(gccgo string, args ...string) (version, triple string, dirs []string, err error)

CompilerInfo executes the specified gccgo compiler and returns information about it: its version (e.g. "4.8.0"), its target triple (e.g. "x86_64-unknown-linux-gnu"), and the list of directories it searches to find standard packages. The given arguments are passed directly to calls to the specified gccgo compiler.

func NewReader

func NewReader(r io.Reader) (io.Reader, error)

NewReader returns a reader for the export data section of an object (.o) or archive (.a) file read from r.

func Read

func Read(in io.Reader, _ *token.FileSet, imports map[string]*types.Package, path string) (*types.Package, error)

Read reads export data from in, decodes it, and returns type information for the package. The package name is specified by path.

The FileSet parameter is currently unused but exists for symmetry with gcexportdata.

Read may inspect and add to the imports map to ensure that references within the export data to other packages are consistent. The caller must ensure that imports[path] does not exist, or exists but is incomplete (see types.Package.Complete), and Read inserts the resulting package into this map entry.

On return, the state of the reader is undefined.