diff options
author | Keith Randall <khr@golang.org> | 2020-10-02 16:04:12 -0700 |
---|---|---|
committer | Dmitri Shuralyov <dmitshur@golang.org> | 2020-10-12 15:15:57 +0000 |
commit | 76a2c87a2c4e78f40f0f70bda3da93c773630179 (patch) | |
tree | ed83964a927d7db80325c3254b532c60685f57f0 /misc | |
parent | cfeb16ddec5b2134198dcc029cdd501ed11a7c01 (diff) | |
download | go-76a2c87a2c4e78f40f0f70bda3da93c773630179.tar.gz go-76a2c87a2c4e78f40f0f70bda3da93c773630179.zip |
[release-branch.go1.15] cmd/compile: export notinheap annotation to object file
In the rare case when a cgo type makes it into an object file, we need
the go:notinheap annotation to go with it.
Fixes #41432.
Change-Id: Ie2ef241ee49661792e0d8c8c46c51b2fe5c6fa7c
Reviewed-on: https://go-review.googlesource.com/c/go/+/259300
Trust: Keith Randall <khr@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Diffstat (limited to 'misc')
-rw-r--r-- | misc/cgo/test/testdata/issue41761.go | 20 | ||||
-rw-r--r-- | misc/cgo/test/testdata/issue41761a/a.go | 14 |
2 files changed, 34 insertions, 0 deletions
diff --git a/misc/cgo/test/testdata/issue41761.go b/misc/cgo/test/testdata/issue41761.go new file mode 100644 index 00000000000..919c7492510 --- /dev/null +++ b/misc/cgo/test/testdata/issue41761.go @@ -0,0 +1,20 @@ +// 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 cgotest + +/* + typedef struct S S; +*/ +import "C" + +import ( + "cgotest/issue41761a" + "testing" +) + +func test41761(t *testing.T) { + var x issue41761a.T + _ = (*C.struct_S)(x.X) +} diff --git a/misc/cgo/test/testdata/issue41761a/a.go b/misc/cgo/test/testdata/issue41761a/a.go new file mode 100644 index 00000000000..ca5c18191eb --- /dev/null +++ b/misc/cgo/test/testdata/issue41761a/a.go @@ -0,0 +1,14 @@ +// 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 issue41761a + +/* + typedef struct S S; +*/ +import "C" + +type T struct { + X *C.S +} |