diff options
| author | David Crawshaw <crawshaw@golang.org> | 2017-10-01 20:28:53 -0400 |
|---|---|---|
| committer | David Crawshaw <crawshaw@golang.org> | 2017-10-04 00:46:06 +0000 |
| commit | 273b657b4e970f510afb258aa73dc2e264a701e3 (patch) | |
| tree | 073164ae68d916ae18899f30251943eb5aa3252d /misc/cgo/testplugin/src | |
| parent | 5fe9bbcf6312b32e0c9df10a5ea6ba18e929de72 (diff) | |
| download | go-273b657b4e970f510afb258aa73dc2e264a701e3.tar.xz | |
cmd/link: support -X values for main.* in plugins
Fixes #19418
Change-Id: I98205f40c1915cd68a5d20438469ba06f1efb160
Reviewed-on: https://go-review.googlesource.com/67432
Run-TryBot: David Crawshaw <crawshaw@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Diffstat (limited to 'misc/cgo/testplugin/src')
| -rw-r--r-- | misc/cgo/testplugin/src/issue19418/main.go | 29 | ||||
| -rw-r--r-- | misc/cgo/testplugin/src/issue19418/plugin.go | 7 |
2 files changed, 36 insertions, 0 deletions
diff --git a/misc/cgo/testplugin/src/issue19418/main.go b/misc/cgo/testplugin/src/issue19418/main.go new file mode 100644 index 0000000000..2ec9f9aaaa --- /dev/null +++ b/misc/cgo/testplugin/src/issue19418/main.go @@ -0,0 +1,29 @@ +// Copyright 2017 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 main + +import ( + "fmt" + "os" + "plugin" +) + +func main() { + p, err := plugin.Open("plugin.so") + if err != nil { + panic(err) + } + + val, err := p.Lookup("Val") + if err != nil { + panic(err) + } + got := *val.(*string) + const want = "linkstr" + if got != want { + fmt.Fprintf(os.Stderr, "issue19418 value is %q, want %q\n", got, want) + os.Exit(2) + } +} diff --git a/misc/cgo/testplugin/src/issue19418/plugin.go b/misc/cgo/testplugin/src/issue19418/plugin.go new file mode 100644 index 0000000000..fe93b16143 --- /dev/null +++ b/misc/cgo/testplugin/src/issue19418/plugin.go @@ -0,0 +1,7 @@ +// Copyright 2017 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 main + +var Val = "val-unset" |
