]> Cypherpunks repositories - gostls13.git/commitdiff
internal/cpu: make architectures without initialization work explicit
authorMartin Möhrmann <moehrmann@google.com>
Tue, 20 Oct 2020 09:06:02 +0000 (11:06 +0200)
committerMartin Möhrmann <moehrmann@google.com>
Tue, 20 Oct 2020 12:10:43 +0000 (12:10 +0000)
When cpu_no_init.go was created most architectures did not have
code in the doinit function. Currently only mips(le), riscv64 and
wasm do not have empty doinit functions.

Keeping cpu_no_init.go around does not reduce the work to satisfy
the build process when adding support for new architectures.

To support a new architecture a new file or build directive has to
be added to an existing file at any rate to define the constant
CacheLinePadSize. A new empty doinit can then be created in the
new file or the existing doinit can be reused when adding the
additional build directive.

Change-Id: I58a97f8cdf1cf1be85c37f4550c40750358aa031
Reviewed-on: https://go-review.googlesource.com/c/go/+/263801
Trust: Martin Möhrmann <moehrmann@google.com>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
src/internal/cpu/cpu_mips.go
src/internal/cpu/cpu_mipsle.go
src/internal/cpu/cpu_no_init.go [deleted file]
src/internal/cpu/cpu_riscv64.go
src/internal/cpu/cpu_wasm.go

index 0f821e44e7798637c89de872f23ea81f27006834..14a9c975eae68ad10eb3cf4ad4545753dac08e58 100644 (file)
@@ -5,3 +5,6 @@
 package cpu
 
 const CacheLinePadSize = 32
+
+func doinit() {
+}
index 0f821e44e7798637c89de872f23ea81f27006834..14a9c975eae68ad10eb3cf4ad4545753dac08e58 100644 (file)
@@ -5,3 +5,6 @@
 package cpu
 
 const CacheLinePadSize = 32
+
+func doinit() {
+}
diff --git a/src/internal/cpu/cpu_no_init.go b/src/internal/cpu/cpu_no_init.go
deleted file mode 100644 (file)
index fb381e1..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-// Copyright 2018 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build !386
-// +build !amd64
-// +build !arm
-// +build !arm64
-// +build !ppc64
-// +build !ppc64le
-// +build !s390x
-// +build !mips64
-// +build !mips64le
-
-package cpu
-
-func doinit() {
-}
index c49cab79fdc62d90d0a06e3633a94a6fd2065e74..54b8c3378b4ad46703154c82f1640b8870984afa 100644 (file)
@@ -5,3 +5,6 @@
 package cpu
 
 const CacheLinePadSize = 32
+
+func doinit() {
+}
index b45973877051094511bba027cb6a92ff79fedac0..2310ad6a4818b9979bfc6ccb6993afb8493a8577 100644 (file)
@@ -5,3 +5,6 @@
 package cpu
 
 const CacheLinePadSize = 64
+
+func doinit() {
+}