]> Cypherpunks repositories - gostls13.git/commit
cmd/link, runtime: put hasmain bit in moduledata
authorDavid Crawshaw <crawshaw@golang.org>
Mon, 9 Oct 2017 20:04:44 +0000 (16:04 -0400)
committerDavid Crawshaw <crawshaw@golang.org>
Fri, 13 Oct 2017 01:13:33 +0000 (01:13 +0000)
commitc58b98b2d617ab2dfe839c4e5ef1e2008c9b60cf
treec81802d52b2d633d7e416b32fc2a3c5f409626bc
parentd06815ba3f0a196adeacfbf5cc963fe2b7d42f46
cmd/link, runtime: put hasmain bit in moduledata

Currently we look to see if the main.main symbol address is in the
module data text range. This requires access to the main.main
symbol, which usually the runtime has, but does not when building
a plugin.

To avoid a dynamic relocation to main.main (which I haven't worked
out how to have the linker generate on darwin), stop using the
symbol. Instead record a boolean in the moduledata if the module
has the main function.

Fixes #22175

Change-Id: If313a118f17ab499d0a760bbc2519771ed654530
Reviewed-on: https://go-review.googlesource.com/69370
Run-TryBot: David Crawshaw <crawshaw@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
misc/cgo/testplugin/src/issue22175/main.go [new file with mode: 0644]
misc/cgo/testplugin/src/issue22175/plugin1.go [new file with mode: 0644]
misc/cgo/testplugin/src/issue22175/plugin2.go [new file with mode: 0644]
misc/cgo/testplugin/test.bash
src/cmd/link/internal/ld/symtab.go
src/runtime/symtab.go