]> Cypherpunks repositories - gostls13.git/commitdiff
runtime/race: add build tag to internal amd64vN packages
authorCherry Mui <cherryyz@google.com>
Tue, 20 Dec 2022 22:19:09 +0000 (17:19 -0500)
committerCherry Mui <cherryyz@google.com>
Thu, 22 Dec 2022 04:34:09 +0000 (04:34 +0000)
Only one of the runtime/race/internal/amd64vN packages should be
included in a build. Generally this is true because the
runtime/race package would import only one of them depending on
the build configuration. But for "go install -buildmode=shared std"
it includes all Go packages in std, which includes both, which
then causes link-time failure due to duplicated symbols. To avoid
this, we add build tags to the internal packages, so, depending on
the build configuation, only one package would contain buildable
go files therefore be included in the build.

For #57334.

Change-Id: I52ddc3a40e16c7d04b4dd861e9689918d27e8509
Reviewed-on: https://go-review.googlesource.com/c/go/+/458695
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Cherry Mui <cherryyz@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
src/runtime/race/internal/amd64v1/doc.go
src/runtime/race/internal/amd64v3/doc.go
src/runtime/race/race_v1_amd64.go
src/runtime/race/race_v3_amd64.go

index 130b290bdb8eb3907fbcd13a0691a53f2c7cb336..ccb088cc46cca66e41886f31af4edb5c1de3e955 100644 (file)
@@ -5,4 +5,6 @@
 // This package holds the race detector .syso for
 // amd64 architectures with GOAMD64<v3.
 
+//go:build amd64 && ((linux && !amd64.v3) || darwin || freebsd || netbsd || openbsd || windows)
+
 package amd64v1
index 69833352815d3568e1a910822ead6862f93061cb..215998a90c3448fafba929936ac60ed4f252d719 100644 (file)
@@ -5,4 +5,6 @@
 // This package holds the race detector .syso for
 // amd64 architectures with GOAMD64>=v3.
 
+//go:build amd64 && linux && amd64.v3
+
 package amd64v3
index b8a20315fdc9f54df857d6f399285f2646538887..7c40db1dcf7713e9eac67d37037355a4f1f512b6 100644 (file)
@@ -3,7 +3,6 @@
 // license that can be found in the LICENSE file.
 
 //go:build (linux && !amd64.v3) || darwin || freebsd || netbsd || openbsd || windows
-// +build linux,!amd64.v3 darwin freebsd netbsd openbsd windows
 
 package race
 
index 913bb77f484909eb24d8113d43ab8abd01adb6fe..80728d834a67e7825a297af3bf17e9f1054ae232 100644 (file)
@@ -3,7 +3,6 @@
 // license that can be found in the LICENSE file.
 
 //go:build linux && amd64.v3
-// +build linux,amd64.v3
 
 package race