Functions
FuncLinksym
function
#
FuncLinksym returns n·f, the function value symbol for n.
func FuncLinksym(n *ir.Name) *obj.LSym
GlobalLinksym
function
#
func GlobalLinksym(n *ir.Name) *obj.LSym
InitAddr
function
#
InitAddr is InitAddrOffset, with offset fixed to 0.
func InitAddr(n *ir.Name, noff int64, lsym *obj.LSym)
InitAddrOffset
function
#
InitAddrOffset writes the static name symbol lsym to n, it does not modify n.
It's the caller responsibility to make sure lsym is from ONAME/PEXTERN node.
func InitAddrOffset(n *ir.Name, noff int64, lsym *obj.LSym, off int64)
InitConst
function
#
InitConst writes the static literal c to n.
Neither n nor c is modified.
func InitConst(n *ir.Name, noff int64, c ir.Node, wid int)
InitSlice
function
#
InitSlice writes a static slice symbol {lsym, lencap, lencap} to n+noff, it does not modify n.
It's the caller responsibility to make sure lsym is from ONAME node.
func InitSlice(n *ir.Name, noff int64, lsym *obj.LSym, lencap int64)
InitSliceBytes
function
#
func InitSliceBytes(nam *ir.Name, off int64, s string)
StringSym
function
#
StringSym returns a symbol containing the string s.
The symbol contains the string data, not a string header.
func StringSym(pos src.XPos, s string) (data *obj.LSym)
StringSymNoCommon
function
#
StringSymNoCommon is like StringSym, but produces a symbol that is not content-
addressable. This symbol is not supposed to appear in the final binary, it is
only used to pass string arguments to the linker like R_USENAMEDMETHOD does.
func StringSymNoCommon(s string) (data *obj.LSym)
WriteEmbed
function
#
WriteEmbed emits the init data for a //go:embed variable,
which is either a string, a []byte, or an embed.FS.
func WriteEmbed(v *ir.Name)
WriteFuncSyms
function
#
func WriteFuncSyms()
dstringdata
function
#
func dstringdata(s *obj.LSym, off int, t string, pos src.XPos, what string) int
embedFileLess
function
#
embedFileLess implements the sort order for a list of embedded files.
See the comment inside ../../../../embed/embed.go's Files struct for rationale.
func embedFileLess(x string, y string) bool
embedFileList
function
#
func embedFileList(v *ir.Name, kind int) []string
embedFileNameSplit
function
#
func embedFileNameSplit(name string) (dir string, elem string, isDir bool)
embedKind
function
#
embedKind determines the kind of embedding variable.
func embedKind(typ *types.Type) int
fileStringSym
function
#
fileStringSym returns a symbol for the contents and the size of file.
If readonly is true, the symbol shares storage with any literal string
or other file with the same content and is placed in a read-only section.
If readonly is false, the symbol is a read-write copy separate from any other,
for use as the backing store of a []byte.
The content hash of file is copied into hashBytes. (If hash is nil, nothing is copied.)
The returned symbol contains the data itself, not a string header.
func fileStringSym(pos src.XPos, file string, readonly bool, hashBytes []byte) (*obj.LSym, int64, error)
shortHashString
function
#
shortHashString converts the hash to a string for use with stringSymPattern.
We cut it to 16 bytes and then base64-encode to make it even smaller.
func shortHashString(hash []byte) string
slicedata
function
#
func slicedata(pos src.XPos, s string) *obj.LSym