github.com/shogo82148/std@v1.22.1-0.20240327122250-4e474527810c/cmd/compile/internal/base/link.go (about)

     1  // Copyright 2021 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  package base
     6  
     7  import (
     8  	"github.com/shogo82148/std/cmd/internal/obj"
     9  )
    10  
    11  // ReservedImports are import paths used internally for generated
    12  // symbols by the compiler.
    13  //
    14  // The linker uses the magic symbol prefixes "go:" and "type:".
    15  // Avoid potential confusion between import paths and symbols
    16  // by rejecting these reserved imports for now. Also, people
    17  // "can do weird things in GOPATH and we'd prefer they didn't
    18  // do _that_ weird thing" (per rsc). See also #4257.
    19  var ReservedImports = map[string]bool{
    20  	"go":   true,
    21  	"type": true,
    22  }
    23  
    24  var Ctxt *obj.Link
    25  
    26  // PkgLinksym returns the linker symbol for name within the given
    27  // package prefix. For user packages, prefix should be the package
    28  // path encoded with objabi.PathToPrefix.
    29  func PkgLinksym(prefix, name string, abi obj.ABI) *obj.LSym
    30  
    31  // Linkname returns the linker symbol for the given name as it might
    32  // appear within a //go:linkname directive.
    33  func Linkname(name string, abi obj.ABI) *obj.LSym