]> Cypherpunks repositories - gostls13.git/commitdiff
[dev.regabi] cmd/go: workaround -race issue on ppc64le
authorMatthew Dempsky <mdempsky@google.com>
Sun, 24 Jan 2021 20:26:47 +0000 (12:26 -0800)
committerMatthew Dempsky <mdempsky@google.com>
Mon, 25 Jan 2021 17:07:19 +0000 (17:07 +0000)
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 <mdempsky@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Jay Conrod <jayconrod@google.com>
TryBot-Result: Go Bot <gobot@golang.org>

src/cmd/go/internal/work/gc.go

index cc4e2b2b2b96553f0d899ca2f92e8f367bd4dea5..3205fcbffc8d2513b24354174daca7e2a6c9d2fc 100644 (file)
@@ -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