diff options
author | Keith Randall <khr@golang.org> | 2020-10-02 15:48:50 -0700 |
---|---|---|
committer | Keith Randall <khr@golang.org> | 2020-10-05 18:52:43 +0000 |
commit | a9c75ecd3da2d87ce08b2e75bd4f332185cd7fc8 (patch) | |
tree | f461d93747788bb5da133ed37bcf5814fb5bb7e6 /misc | |
parent | a65bc048bf388e399af9bcfd726cd0f11bba7c8e (diff) | |
download | go-a9c75ecd3da2d87ce08b2e75bd4f332185cd7fc8.tar.gz go-a9c75ecd3da2d87ce08b2e75bd4f332185cd7fc8.zip |
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 #41761
Change-Id: I541500cb1a03de954881aef659f96fc0b7738848
Reviewed-on: https://go-review.googlesource.com/c/go/+/259297
Trust: Keith Randall <khr@golang.org>
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Go Bot <gobot@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 0000000000..919c749251 --- /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 0000000000..ca5c18191e --- /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 +} |