mirror of
https://github.com/golang/go
synced 2024-11-26 00:48:01 -07:00
cmd/link: write buildid to plugin
Currently, in plugin build mode we don't write the build ID. This is disabled in CL 29394 since plugin is supported on Darwin. Maybe it caused some problem with the Darwin dynamic linker. But it seems no problem currently. Enabled it. Fixes #59845. Change-Id: I60589ffc7937e4d30055960d391cac1e7cd0cd42 Reviewed-on: https://go-review.googlesource.com/c/go/+/489457 TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Than McIntosh <thanm@google.com> Run-TryBot: Cherry Mui <cherryyz@google.com>
This commit is contained in:
parent
ff059add10
commit
6c8ea391cf
@ -116,11 +116,15 @@ func testMain(m *testing.M) int {
|
|||||||
return m.Run()
|
return m.Run()
|
||||||
}
|
}
|
||||||
|
|
||||||
func goCmd(t *testing.T, op string, args ...string) {
|
func goCmd(t *testing.T, op string, args ...string) string {
|
||||||
if t != nil {
|
if t != nil {
|
||||||
t.Helper()
|
t.Helper()
|
||||||
}
|
}
|
||||||
run(t, filepath.Join(goroot, "bin", "go"), append([]string{op, "-gcflags", gcflags}, args...)...)
|
var flags []string
|
||||||
|
if op != "tool" {
|
||||||
|
flags = []string{"-gcflags", gcflags}
|
||||||
|
}
|
||||||
|
return run(t, filepath.Join(goroot, "bin", "go"), append(append([]string{op}, flags...), args...)...)
|
||||||
}
|
}
|
||||||
|
|
||||||
// escape converts a string to something suitable for a shell command line.
|
// escape converts a string to something suitable for a shell command line.
|
||||||
@ -190,6 +194,14 @@ func TestDWARFSections(t *testing.T) {
|
|||||||
goCmd(t, "run", "./checkdwarf/main.go", "./host.exe", "main.main")
|
goCmd(t, "run", "./checkdwarf/main.go", "./host.exe", "main.main")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestBuildID(t *testing.T) {
|
||||||
|
// check that plugin has build ID.
|
||||||
|
b := goCmd(t, "tool", "buildid", "plugin1.so")
|
||||||
|
if len(b) == 0 {
|
||||||
|
t.Errorf("build id not found")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func TestRunHost(t *testing.T) {
|
func TestRunHost(t *testing.T) {
|
||||||
run(t, "./host.exe")
|
run(t, "./host.exe")
|
||||||
}
|
}
|
||||||
|
@ -2248,7 +2248,7 @@ func (state *dodataState) dodataSect(ctxt *Link, symn sym.SymKind, syms []loader
|
|||||||
// at the very beginning of the text segment.
|
// at the very beginning of the text segment.
|
||||||
// This “header” is read by cmd/go.
|
// This “header” is read by cmd/go.
|
||||||
func (ctxt *Link) textbuildid() {
|
func (ctxt *Link) textbuildid() {
|
||||||
if ctxt.IsELF || ctxt.BuildMode == BuildModePlugin || *flagBuildid == "" {
|
if ctxt.IsELF || *flagBuildid == "" {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user