aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/internal/objabi
diff options
context:
space:
mode:
authorAustin Clements <austin@google.com>2021-04-07 09:27:11 -0400
committerAustin Clements <austin@google.com>2021-04-08 02:17:19 +0000
commit89ca1ce9a8fbb70800fe24cc13aa267c3c90aadb (patch)
tree28c104d1c920b690ae0e3de1eca2027a35c58a0e /src/cmd/internal/objabi
parentb675e52e9592ba3db1a3cf2dc9c4bc02c89e03a8 (diff)
downloadgo-89ca1ce9a8fbb70800fe24cc13aa267c3c90aadb.tar.xz
cmd/compile,cmd/internal/objabi: abstract out object header string
Change-Id: Idbbb4cb7127b93afa34a8aa18bbdaad1f206ab6a Reviewed-on: https://go-review.googlesource.com/c/go/+/308090 Trust: Austin Clements <austin@google.com> Run-TryBot: Austin Clements <austin@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Diffstat (limited to 'src/cmd/internal/objabi')
-rw-r--r--src/cmd/internal/objabi/util.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/cmd/internal/objabi/util.go b/src/cmd/internal/objabi/util.go
index 76c56dab27..c2c05bd1b2 100644
--- a/src/cmd/internal/objabi/util.go
+++ b/src/cmd/internal/objabi/util.go
@@ -5,6 +5,7 @@
package objabi
import (
+ "fmt"
"log"
"os"
"strings"
@@ -121,3 +122,11 @@ func gowasm() (f gowasmFeatures) {
func Getgoextlinkenabled() string {
return envOr("GO_EXTLINK_ENABLED", defaultGO_EXTLINK_ENABLED)
}
+
+// 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 %s\n", GOOS, GOARCH, Version, Expstring())
+}