diff options
author | Cherry Zhang <cherryyz@google.com> | 2020-06-30 19:09:38 +0000 |
---|---|---|
committer | Austin Clements <austin@google.com> | 2020-06-30 20:14:48 +0000 |
commit | 96e83664378918980bd8f60822c4bc39befcb668 (patch) | |
tree | 7325478dbfef81e5e294140aa61bfee9286cdf1d /misc | |
parent | 5779bb4e92911271583faa1365fd12be2c3894ee (diff) | |
download | go-96e83664378918980bd8f60822c4bc39befcb668.tar.gz go-96e83664378918980bd8f60822c4bc39befcb668.zip |
Revert "cmd/link: fix GC data reading from shared library"
This reverts CL 240462.
Reason for revert: test fails on PPC64LE.
Updates #39927.
Change-Id: I4f14fd0c36e604a80ae9f2f86d1e643e28945e93
Reviewed-on: https://go-review.googlesource.com/c/go/+/240616
Reviewed-by: Austin Clements <austin@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
Diffstat (limited to 'misc')
-rw-r--r-- | misc/cgo/testshared/shared_test.go | 16 | ||||
-rw-r--r-- | misc/cgo/testshared/testdata/gcdata/main/main.go | 37 | ||||
-rw-r--r-- | misc/cgo/testshared/testdata/gcdata/p/p.go | 7 |
3 files changed, 0 insertions, 60 deletions
diff --git a/misc/cgo/testshared/shared_test.go b/misc/cgo/testshared/shared_test.go index f8dabbe7a0..fda3d2ce76 100644 --- a/misc/cgo/testshared/shared_test.go +++ b/misc/cgo/testshared/shared_test.go @@ -38,15 +38,7 @@ var testWork = flag.Bool("testwork", false, "if true, log and do not delete the // run runs a command and calls t.Errorf if it fails. func run(t *testing.T, msg string, args ...string) { - runWithEnv(t, msg, nil, args...) -} - -// runWithEnv runs a command under the given environment and calls t.Errorf if it fails. -func runWithEnv(t *testing.T, msg string, env []string, args ...string) { c := exec.Command(args[0], args[1:]...) - if len(env) != 0 { - c.Env = append(os.Environ(), env...) - } if output, err := c.CombinedOutput(); err != nil { t.Errorf("executing %s (%s) failed %s:\n%s", strings.Join(args, " "), msg, err, output) } @@ -1042,11 +1034,3 @@ func TestGeneratedHash(t *testing.T) { func TestPackageOrder(t *testing.T) { goCmd(t, "install", "-buildmode=shared", "-linkshared", "./issue39777/a", "./issue39777/b") } - -// Test that GC data are generated correctly by the linker when it needs a type defined in -// a shared library. See issue 39927. -func TestGCData(t *testing.T) { - goCmd(t, "install", "-buildmode=shared", "-linkshared", "./gcdata/p") - goCmd(t, "build", "-linkshared", "./gcdata/main") - runWithEnv(t, "running gcdata/main", []string{"GODEBUG=clobberfree=1"}, "./main") -} diff --git a/misc/cgo/testshared/testdata/gcdata/main/main.go b/misc/cgo/testshared/testdata/gcdata/main/main.go deleted file mode 100644 index 394862fd94..0000000000 --- a/misc/cgo/testshared/testdata/gcdata/main/main.go +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2020 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. - -// Test that GC data is generated correctly for global -// variables with types defined in a shared library. -// See issue 39927. - -// This test run under GODEBUG=clobberfree=1. The check -// *x[i] == 12345 depends on this debug mode to clobber -// the value if the object is freed prematurely. - -package main - -import ( - "fmt" - "runtime" - "testshared/gcdata/p" -) - -var x p.T - -func main() { - for i := range x { - x[i] = new(int) - *x[i] = 12345 - } - runtime.GC() - runtime.GC() - runtime.GC() - for i := range x { - if *x[i] != 12345 { - fmt.Printf("x[%d] == %d, want 12345\n", i, *x[i]) - panic("FAIL") - } - } -} diff --git a/misc/cgo/testshared/testdata/gcdata/p/p.go b/misc/cgo/testshared/testdata/gcdata/p/p.go deleted file mode 100644 index 1fee75429e..0000000000 --- a/misc/cgo/testshared/testdata/gcdata/p/p.go +++ /dev/null @@ -1,7 +0,0 @@ -// Copyright 2020 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 p - -type T [10]*int |