Black Lives Matter. Support the Equal Justice Initiative.

Source file src/cmd/link/internal/sym/symbol.go

Documentation: cmd/link/internal/sym

     1  // Copyright 2017 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 sym
     6  
     7  import (
     8  	"cmd/internal/obj"
     9  )
    10  
    11  const (
    12  	SymVerABI0        = 0
    13  	SymVerABIInternal = 1
    14  	SymVerStatic      = 10 // Minimum version used by static (file-local) syms
    15  )
    16  
    17  func ABIToVersion(abi obj.ABI) int {
    18  	switch abi {
    19  	case obj.ABI0:
    20  		return SymVerABI0
    21  	case obj.ABIInternal:
    22  		return SymVerABIInternal
    23  	}
    24  	return -1
    25  }
    26  
    27  func VersionToABI(v int) (obj.ABI, bool) {
    28  	switch v {
    29  	case SymVerABI0:
    30  		return obj.ABI0, true
    31  	case SymVerABIInternal:
    32  		return obj.ABIInternal, true
    33  	}
    34  	return ^obj.ABI(0), false
    35  }
    36  

View as plain text