aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/link
diff options
context:
space:
mode:
authorThan McIntosh <thanm@google.com>2022-10-04 09:00:31 -0400
committerThan McIntosh <thanm@google.com>2022-10-04 18:08:15 +0000
commit8bd803fd4ea3a549a9124f5a4e18af9596ef35df (patch)
tree078970e7e27d0f3d48e0dfae4d7a5ba49bb3c01c /src/cmd/link
parentdfd8aa461be982533e01867ab002fb83ba3cc943 (diff)
downloadgo-8bd803fd4ea3a549a9124f5a4e18af9596ef35df.tar.xz
cmd/internal/sys: migrate support.go functions to new internal pkg
Separate out the functions from cmd/internal/sys/support.go and migrate them to a new package internal/platform, so that functions such as "RaceDetectorSupported" can be called from tests in std as well as in cmd. This isn't a complete move of everything in cmd/internal/sys; there are still many functions left. The original version of this CL (patch set 1) called the new package "internal/sys", but for packages that needed both "internal/sys" and "cmd/internal/sys" the import of the former had to be done with a different name, which was confusing and also required a hack in cmd/dist. Updates #56006. Change-Id: I866d62e75adbf3a640a06e2c7386a6e9e2a18d91 Reviewed-on: https://go-review.googlesource.com/c/go/+/438475 Reviewed-by: Bryan Mills <bcmills@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Cherry Mui <cherryyz@google.com> Run-TryBot: Than McIntosh <thanm@google.com>
Diffstat (limited to 'src/cmd/link')
-rw-r--r--src/cmd/link/elf_test.go5
-rw-r--r--src/cmd/link/internal/ld/config.go3
-rw-r--r--src/cmd/link/link_test.go5
3 files changed, 6 insertions, 7 deletions
diff --git a/src/cmd/link/elf_test.go b/src/cmd/link/elf_test.go
index 5037f5b6c0..a75f35bf5d 100644
--- a/src/cmd/link/elf_test.go
+++ b/src/cmd/link/elf_test.go
@@ -10,6 +10,7 @@ package main
import (
"debug/elf"
"fmt"
+ "internal/platform"
"internal/testenv"
"os"
"os/exec"
@@ -19,8 +20,6 @@ import (
"sync"
"testing"
"text/template"
-
- "cmd/internal/sys"
)
func getCCAndCCFLAGS(t *testing.T, env []string) (string, []string) {
@@ -280,7 +279,7 @@ func TestPIESize(t *testing.T) {
// always skip the test if cgo is not supported.
testenv.MustHaveCGO(t)
- if !sys.BuildModeSupported(runtime.Compiler, "pie", runtime.GOOS, runtime.GOARCH) {
+ if !platform.BuildModeSupported(runtime.Compiler, "pie", runtime.GOOS, runtime.GOARCH) {
t.Skip("-buildmode=pie not supported")
}
diff --git a/src/cmd/link/internal/ld/config.go b/src/cmd/link/internal/ld/config.go
index 4dd43a16ab..336cb33e3b 100644
--- a/src/cmd/link/internal/ld/config.go
+++ b/src/cmd/link/internal/ld/config.go
@@ -8,6 +8,7 @@ import (
"cmd/internal/sys"
"fmt"
"internal/buildcfg"
+ "internal/platform"
)
// A BuildMode indicates the sort of object we are building.
@@ -185,7 +186,7 @@ func mustLinkExternal(ctxt *Link) (res bool, reason string) {
}()
}
- if sys.MustLinkExternal(buildcfg.GOOS, buildcfg.GOARCH) {
+ if platform.MustLinkExternal(buildcfg.GOOS, buildcfg.GOARCH) {
return true, fmt.Sprintf("%s/%s requires external linking", buildcfg.GOOS, buildcfg.GOARCH)
}
diff --git a/src/cmd/link/link_test.go b/src/cmd/link/link_test.go
index c1a30363cb..35babe61fc 100644
--- a/src/cmd/link/link_test.go
+++ b/src/cmd/link/link_test.go
@@ -9,6 +9,7 @@ import (
"bytes"
"debug/macho"
"internal/buildcfg"
+ "internal/platform"
"internal/testenv"
"os"
"os/exec"
@@ -17,8 +18,6 @@ import (
"runtime"
"strings"
"testing"
-
- "cmd/internal/sys"
)
var AuthorPaidByTheColumnInch struct {
@@ -976,7 +975,7 @@ func main() {
func TestIssue42396(t *testing.T) {
testenv.MustHaveGoBuild(t)
- if !sys.RaceDetectorSupported(runtime.GOOS, runtime.GOARCH) {
+ if !platform.RaceDetectorSupported(runtime.GOOS, runtime.GOARCH) {
t.Skip("no race detector support")
}