From 8ee3d398383170e21ba2a63b3a45e1577f97c329 Mon Sep 17 00:00:00 2001 From: Matthew Dempsky Date: Sun, 24 Jan 2021 12:26:47 -0800 Subject: [PATCH] [dev.regabi] cmd/go: workaround -race issue on ppc64le The race detector on ppc64le corrupts command-line arguments lists if they contain an empty string, and cmd/go often generates compiler argument lists containing `-D ""`. Since this is equivalent to not specifying the `-D` flag at all, just do that. This allows using a race-detector-enabled cmd/compile on ppc64le. Updates #43883. Change-Id: Ifac5cd9a44932129438b9b0b3ecc6101ad3716b2 Reviewed-on: https://go-review.googlesource.com/c/go/+/286173 Trust: Matthew Dempsky Run-TryBot: Matthew Dempsky Reviewed-by: Bryan C. Mills Reviewed-by: Jay Conrod TryBot-Result: Go Bot --- src/cmd/go/internal/work/gc.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/cmd/go/internal/work/gc.go b/src/cmd/go/internal/work/gc.go index cc4e2b2b2b..3205fcbffc 100644 --- a/src/cmd/go/internal/work/gc.go +++ b/src/cmd/go/internal/work/gc.go @@ -129,7 +129,11 @@ func (gcToolchain) gc(b *Builder, a *Action, archive string, importcfg, embedcfg } } - args := []interface{}{cfg.BuildToolexec, base.Tool("compile"), "-o", ofile, "-trimpath", a.trimpath(), gcflags, gcargs, "-D", p.Internal.LocalPrefix} + args := []interface{}{cfg.BuildToolexec, base.Tool("compile"), "-o", ofile, "-trimpath", a.trimpath(), gcflags, gcargs} + if p.Internal.LocalPrefix != "" { + // Workaround #43883. + args = append(args, "-D", p.Internal.LocalPrefix) + } if importcfg != nil { if err := b.writeFile(objdir+"importcfg", importcfg); err != nil { return "", nil, err -- 2.48.1