Source file src/internal/pkgbits/reloc.go

     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 pkgbits
     6  
     7  // A SectionKind indicates a section, as well as the ordering of sections within
     8  // unified export data. Any object given a dedicated section can be referred to
     9  // via a section / index pair (and thus dereferenced) in other sections.
    10  type SectionKind int32 // TODO(markfreeman): Replace with uint8.
    11  
    12  const (
    13  	RelocString SectionKind = iota
    14  	RelocMeta
    15  	RelocPosBase
    16  	RelocPkg
    17  	RelocName
    18  	RelocType
    19  	RelocObj
    20  	RelocObjExt
    21  	RelocObjDict
    22  	RelocBody
    23  
    24  	numRelocs = iota
    25  )
    26  
    27  // An Index represents a bitstream element index *within* (i.e., relative to) a
    28  // particular section.
    29  type Index int32
    30  
    31  // TODO(markfreeman): Make RelIndex its own named type once we point external
    32  // references from Index to RelIndex.
    33  type RelIndex = Index
    34  
    35  // A RelocEnt, or relocation entry, is an entry in an element's reference
    36  // table. All elements are preceded by a reference table which provides
    37  // locations for all dereferences that the element may use.
    38  type RelocEnt struct {
    39  	Kind SectionKind
    40  	Idx  RelIndex
    41  }
    42  
    43  // Reserved indices within the [RelocMeta] section.
    44  const (
    45  	PublicRootIdx  RelIndex = 0
    46  	PrivateRootIdx RelIndex = 1
    47  )
    48  

View as plain text