go util 源码

  • 2022-07-15
  • 浏览 (867)

golang util 代码

文件路径:/src/cmd/internal/objabi/util.go

// Copyright 2015 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package objabi

import (
	"fmt"
	"strings"

	"internal/buildcfg"
)

const (
	ElfRelocOffset   = 256
	MachoRelocOffset = 2048    // reserve enough space for ELF relocations
	GlobalDictPrefix = ".dict" // prefix for names of global dictionaries
)

// HeaderString returns the toolchain configuration string written in
// Go object headers. This string ensures we don't attempt to import
// or link object files that are incompatible with each other. This
// string always starts with "go object ".
func HeaderString() string {
	return fmt.Sprintf("go object %s %s %s X:%s\n", buildcfg.GOOS, buildcfg.GOARCH, buildcfg.Version, strings.Join(buildcfg.Experiment.Enabled(), ","))
}

相关信息

go 源码目录

相关文章

go autotype 源码

go flag 源码

go flag_test 源码

go funcdata 源码

go funcid 源码

go head 源码

go line 源码

go line_test 源码

go path 源码

go path_test 源码

0  赞