mirror of
https://github.com/golang/go
synced 2024-11-19 15:05:00 -07:00
cmd/go: trim objdir, not just workdir, from object files
Otherwise the new numbered directories like b028/ appear in the objects, and they can change from run to run. Fixes #22514. Change-Id: I8d0cf65f3622e48b2547d5757febe0ee1301e2ed Reviewed-on: https://go-review.googlesource.com/74791 Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org> Reviewed-by: David Crawshaw <crawshaw@golang.org>
This commit is contained in:
parent
2f170520aa
commit
bf21c67b1e
@ -106,7 +106,7 @@ func (gcToolchain) gc(b *Builder, a *Action, archive string, importcfg []byte, a
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
args := []interface{}{cfg.BuildToolexec, base.Tool("compile"), "-o", ofile, "-trimpath", b.WorkDir, gcflags, gcargs, "-D", p.Internal.LocalPrefix}
|
args := []interface{}{cfg.BuildToolexec, base.Tool("compile"), "-o", ofile, "-trimpath", trimDir(a.Objdir), gcflags, gcargs, "-D", p.Internal.LocalPrefix}
|
||||||
if importcfg != nil {
|
if importcfg != nil {
|
||||||
if err := b.writeFile(objdir+"importcfg", importcfg); err != nil {
|
if err := b.writeFile(objdir+"importcfg", importcfg); err != nil {
|
||||||
return "", nil, err
|
return "", nil, err
|
||||||
@ -204,11 +204,18 @@ CheckFlags:
|
|||||||
return c
|
return c
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func trimDir(dir string) string {
|
||||||
|
if len(dir) > 1 && dir[len(dir)-1] == filepath.Separator {
|
||||||
|
dir = dir[:len(dir)-1]
|
||||||
|
}
|
||||||
|
return dir
|
||||||
|
}
|
||||||
|
|
||||||
func (gcToolchain) asm(b *Builder, a *Action, sfiles []string) ([]string, error) {
|
func (gcToolchain) asm(b *Builder, a *Action, sfiles []string) ([]string, error) {
|
||||||
p := a.Package
|
p := a.Package
|
||||||
// Add -I pkg/GOOS_GOARCH so #include "textflag.h" works in .s files.
|
// Add -I pkg/GOOS_GOARCH so #include "textflag.h" works in .s files.
|
||||||
inc := filepath.Join(cfg.GOROOT, "pkg", "include")
|
inc := filepath.Join(cfg.GOROOT, "pkg", "include")
|
||||||
args := []interface{}{cfg.BuildToolexec, base.Tool("asm"), "-trimpath", b.WorkDir, "-I", a.Objdir, "-I", inc, "-D", "GOOS_" + cfg.Goos, "-D", "GOARCH_" + cfg.Goarch, buildAsmflags}
|
args := []interface{}{cfg.BuildToolexec, base.Tool("asm"), "-trimpath", trimDir(a.Objdir), "-I", a.Objdir, "-I", inc, "-D", "GOOS_" + cfg.Goos, "-D", "GOARCH_" + cfg.Goarch, buildAsmflags}
|
||||||
if p.ImportPath == "runtime" && cfg.Goarch == "386" {
|
if p.ImportPath == "runtime" && cfg.Goarch == "386" {
|
||||||
for _, arg := range buildAsmflags {
|
for _, arg := range buildAsmflags {
|
||||||
if arg == "-dynlink" {
|
if arg == "-dynlink" {
|
||||||
|
@ -263,7 +263,7 @@ Previous write at 0x[0-9,a-f]+ by goroutine [0-9]:
|
|||||||
main\.goCallback\(\)
|
main\.goCallback\(\)
|
||||||
.*/main\.go:27 \+0x[0-9,a-f]+
|
.*/main\.go:27 \+0x[0-9,a-f]+
|
||||||
main._cgoexpwrap_[0-9a-z]+_goCallback\(\)
|
main._cgoexpwrap_[0-9a-z]+_goCallback\(\)
|
||||||
.*/_cgo_gotypes\.go:[0-9]+ \+0x[0-9,a-f]+
|
.*_cgo_gotypes\.go:[0-9]+ \+0x[0-9,a-f]+
|
||||||
|
|
||||||
Goroutine [0-9] \(running\) created at:
|
Goroutine [0-9] \(running\) created at:
|
||||||
runtime\.newextram\(\)
|
runtime\.newextram\(\)
|
||||||
|
Loading…
Reference in New Issue
Block a user