Repository: go
Issue: plugin: using stdlib package plugin from c-archive package doesn't work as expected
Labels: compiler/runtime

Please answer these questions before submitting your issue. Thanks!

### What version of Go are you using (`go version`)?

`go version devel +5d1b53a Wed Nov 30 19:46:00 2016 +0000 linux/amd64`

### What operating system and processor architecture are you using (`go env`)?

```
GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/erwo/golang-plugin"
GORACE=""
GOROOT="/home/erwo/go-devel"
GOTOOLDIR="/home/erwo/go-devel/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build451133793=/tmp/go-build -gno-record-gcc-switches"
CXX="g++"
CGO_ENABLED="1"
PKG_CONFIG="pkg-config"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
```

### What did you do?
Wrote a main package to be used as c-archive within a c host app, which uses stdlib package plugin to load other go plugins.

https://github.com/erwo42/golang-plugin

Just run from within a workdir of above repo
```
go build -buildmode=plugin testplugin
go build -buildmode=c-archive indirect_with_c
gcc -o indirect_with_c c_host_app.c indirect_with_c.a -ldl -lpthread
./indirect_with_c
```

### What did you expect to see?
```
Yay!

```

### What did you see instead?

```
fatal error: runtime: no plugin module data

goroutine 17 [running, locked to thread]:
runtime.throw(0x4a9ba3, 0x1e)
        /home/erwo/go-devel/src/runtime/panic.go:596 +0x97 fp=0xc42003ca70 sp=0xc42003ca50
plugin.lastmoduleinit(0xebe420, 0xc42000e028, 0xebf460, 0x26, 0x766f00)
        /home/erwo/go-devel/src/runtime/plugin.go:13 +0xc27 fp=0xc42003cba0 sp=0xc42003ca70
plugin.open(0x4a6a5f, 0xd, 0x0, 0x0, 0x0)
        /home/erwo/go-devel/src/plugin/plugin_dlopen.go:72 +0x25f fp=0xc42003cde0 sp=0xc42003cba0
plugin.Open(0x4a6a5f, 0xd, 0x0, 0x2, 0x3)
        /home/erwo/go-devel/src/plugin/plugin.go:30 +0x37 fp=0xc42003ce18 sp=0xc42003cde0
main.RunGoPlugin()
        /home/erwo/golang-plugin/src/indirect_with_c/indirect_with_c.go:12 +0x52 fp=0xc42003cea8 sp=0xc42003ce18
main._cgoexpwrap_8c4bdecea134_RunGoPlugin()
        indirect_with_c/_obj/_cgo_gotypes.go:45 +0x16 fp=0xc42003ceb0 sp=0xc42003cea8
runtime.call32(0x0, 0x7fff7c9c1108, 0x7fff7c9c11af, 0x0)
        /home/erwo/go-devel/src/runtime/asm_amd64.s:501 +0x4a fp=0xc42003cee0 sp=0xc42003ceb0
runtime.cgocallbackg1(0x0)
        /home/erwo/go-devel/src/runtime/cgocall.go:297 +0x1a1 fp=0xc42003cf58 sp=0xc42003cee0
runtime.cgocallbackg(0x0)
        /home/erwo/go-devel/src/runtime/cgocall.go:184 +0x86 fp=0xc42003cfc0 sp=0xc42003cf58
runtime.cgocallback_gofunc(0x0, 0x0, 0x0, 0x0)
        /home/erwo/go-devel/src/runtime/asm_amd64.s:754 +0x71 fp=0xc42003cfe0 sp=0xc42003cfc0
runtime.goexit()
        /home/erwo/go-devel/src/runtime/asm_amd64.s:2184 +0x1 fp=0xc42003cfe8 sp=0xc42003cfe0

goroutine 18 [syscall, locked to thread]:
runtime.goexit()
        /home/erwo/go-devel/src/runtime/asm_amd64.s:2184 +0x1
Aborted
```

### Other maybe related issues
#17928
#17150
#18120