github.com/shogo82148/std@v1.22.1-0.20240327122250-4e474527810c/cmd/internal/obj/sym.go (about)

     1  // Derived from Inferno utils/6l/obj.c and utils/6l/span.c
     2  // https://bitbucket.org/inferno-os/inferno-os/src/master/utils/6l/obj.c
     3  // https://bitbucket.org/inferno-os/inferno-os/src/master/utils/6l/span.c
     4  //
     5  //	Copyright © 1994-1999 Lucent Technologies Inc.  All rights reserved.
     6  //	Portions Copyright © 1995-1997 C H Forsyth (forsyth@terzarima.net)
     7  //	Portions Copyright © 1997-1999 Vita Nuova Limited
     8  //	Portions Copyright © 2000-2007 Vita Nuova Holdings Limited (www.vitanuova.com)
     9  //	Portions Copyright © 2004,2006 Bruce Ellis
    10  //	Portions Copyright © 2005-2007 C H Forsyth (forsyth@terzarima.net)
    11  //	Revisions Copyright © 2000-2007 Lucent Technologies Inc. and others
    12  //	Portions Copyright © 2009 The Go Authors. All rights reserved.
    13  //
    14  // Permission is hereby granted, free of charge, to any person obtaining a copy
    15  // of this software and associated documentation files (the "Software"), to deal
    16  // in the Software without restriction, including without limitation the rights
    17  // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
    18  // copies of the Software, and to permit persons to whom the Software is
    19  // furnished to do so, subject to the following conditions:
    20  //
    21  // The above copyright notice and this permission notice shall be included in
    22  // all copies or substantial portions of the Software.
    23  //
    24  // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    25  // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    26  // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
    27  // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    28  // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
    29  // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
    30  // THE SOFTWARE.
    31  
    32  package obj
    33  
    34  func Linknew(arch *LinkArch) *Link
    35  
    36  // LookupDerived looks up or creates the symbol with name derived from symbol s.
    37  // The resulting symbol will be static iff s is.
    38  func (ctxt *Link) LookupDerived(s *LSym, name string) *LSym
    39  
    40  // LookupStatic looks up the static symbol with name name.
    41  // If it does not exist, it creates it.
    42  func (ctxt *Link) LookupStatic(name string) *LSym
    43  
    44  // LookupABI looks up a symbol with the given ABI.
    45  // If it does not exist, it creates it.
    46  func (ctxt *Link) LookupABI(name string, abi ABI) *LSym
    47  
    48  // LookupABIInit looks up a symbol with the given ABI.
    49  // If it does not exist, it creates it and
    50  // passes it to init for one-time initialization.
    51  func (ctxt *Link) LookupABIInit(name string, abi ABI, init func(s *LSym)) *LSym
    52  
    53  // Lookup looks up the symbol with name name.
    54  // If it does not exist, it creates it.
    55  func (ctxt *Link) Lookup(name string) *LSym
    56  
    57  // LookupInit looks up the symbol with name name.
    58  // If it does not exist, it creates it and
    59  // passes it to init for one-time initialization.
    60  func (ctxt *Link) LookupInit(name string, init func(s *LSym)) *LSym
    61  
    62  func (ctxt *Link) Float32Sym(f float32) *LSym
    63  
    64  func (ctxt *Link) Float64Sym(f float64) *LSym
    65  
    66  func (ctxt *Link) Int32Sym(i int64) *LSym
    67  
    68  func (ctxt *Link) Int64Sym(i int64) *LSym
    69  
    70  func (ctxt *Link) Int128Sym(hi, lo int64) *LSym
    71  
    72  // GCLocalsSym generates a content-addressable sym containing data.
    73  func (ctxt *Link) GCLocalsSym(data []byte) *LSym
    74  
    75  // Assign index to symbols.
    76  // asm is set to true if this is called by the assembler (i.e. not the compiler),
    77  // in which case all the symbols are non-package (for now).
    78  func (ctxt *Link) NumberSyms()
    79  
    80  // StaticNamePref is the prefix the front end applies to static temporary
    81  // variables. When turned into LSyms, these can be tagged as static so
    82  // as to avoid inserting them into the linker's name lookup tables.
    83  const StaticNamePref = ".stmp_"