Source file src/cmd/compile/internal/noder/export.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 noder
     6  
     7  import (
     8  	"bytes"
     9  	"fmt"
    10  	"io"
    11  
    12  	"cmd/compile/internal/base"
    13  	"cmd/internal/bio"
    14  )
    15  
    16  func WriteExports(out *bio.Writer) {
    17  	var data bytes.Buffer
    18  
    19  	data.WriteByte('u')
    20  	writeUnifiedExport(&data)
    21  
    22  	// The linker also looks for the $$ marker - use char after $$ to distinguish format.
    23  	out.WriteString("\n$$B\n") // indicate binary export format
    24  	io.Copy(out, &data)
    25  	out.WriteString("\n$$\n")
    26  
    27  	if base.Debug.Export != 0 {
    28  		fmt.Printf("BenchmarkExportSize:%s 1 %d bytes\n", base.Ctxt.Pkgpath, data.Len())
    29  	}
    30  }
    31  

View as plain text