]> Cypherpunks repositories - gostls13.git/commitdiff
runtime/secret: reorganize tests to fix -buildmode=shared
authorDaniel Morsing <daniel.morsing@gmail.com>
Thu, 27 Nov 2025 06:45:20 +0000 (06:45 +0000)
committerGopher Robot <gobot@golang.org>
Thu, 27 Nov 2025 13:54:25 +0000 (05:54 -0800)
The testing assembly methods had a linkname that was implicitly
satisfied during the regular build but not there during the shared
build. Fix by moving the testing routine into the package itself.

For good measure, section off the assembly files from the non-experiment
build. Should prevent further build failures as we work on this.

Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest,gotip-linux-arm64-longtest
Change-Id: I2b45668e44641ae7880ff14f6402d982c7eaedd7
Reviewed-on: https://go-review.googlesource.com/c/go/+/724001
Reviewed-by: David Chase <drchase@google.com>
Auto-Submit: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
src/runtime/secret/asm_amd64.s
src/runtime/secret/asm_arm64.s
src/runtime/secret/stubs.go
src/runtime/secret/testdata/crash.go

index 7011afc5eb72a3e8f8bd35e3b473ed8fa1242a71..0f2a4747b4611e0b35aa7c11d766110d0ce9da66 100644 (file)
@@ -2,6 +2,8 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+//go:build goexperiment.runtimesecret
+
 // Note: this assembly file is used for testing only.
 // We need to access registers directly to properly test
 // that secrets are erased and go test doesn't like to conditionally
@@ -208,6 +210,6 @@ noavx512:
        // registers contain secrets.
        // It also tests the path from G stack to M stack
        // to scheduler and back.
-       CALL    ·delay(SB)
+       CALL    runtime∕secret·delay(SB)
 
        RET
index 1d7f7c1c92458b238de20344770a05993b974211..6fa625adf6fba4d0c82821bc6237deebe954681c 100644 (file)
@@ -2,6 +2,8 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+//go:build goexperiment.runtimesecret
+
 // Note: this assembly file is used for testing only.
 // We need to access registers directly to properly test
 // that secrets are erased and go test doesn't like to conditionally
index ec66ef2729a83b2e8adf43c29b32dbe28facb30f..dd9ed04df3afd6987cd986c79c84936c2ee455d3 100644 (file)
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-//go:build arm64 || amd64
+//go:build goexperiment.runtimesecret && (arm64 || amd64)
 
 // testing stubs, these are implemented in assembly in
 // asm_$GOARCH.s
@@ -30,3 +30,14 @@ func spillRegisters(p unsafe.Pointer) uintptr
 //
 //go:noescape
 func useSecret(secret []byte)
+
+// callback from assembly
+func delay() {
+       sleep(1_000_000)
+}
+
+// linknamed to avoid package importing time
+// for just testing code
+//
+//go:linkname sleep time.Sleep
+func sleep(int64)
index cf48fb7d44c3f27aa54a7dbfcc9c03b7d6341c95..1ee1ea6b8e0fa14149d04c3d45b1cc80e4aa24e5 100644 (file)
@@ -18,13 +18,6 @@ import (
        "weak"
 )
 
-// callback from assembly
-//
-//go:linkname delay main.delay
-func delay() {
-       time.Sleep(1 * time.Millisecond)
-}
-
 // Same secret as in ../../crash_test.go
 var secretStore = [8]byte{
        0x00,