Commit 04cf881f authored by Shenghou Ma's avatar Shenghou Ma Committed by Minux Ma

misc/cgo/test: get rid of the backdoor package

For Go 1.5, we can use go:linkname rather than assembly thunk for gc.
Gccgo already has support for //extern.

Change-Id: I5505aa247dd5b555112f7261ed2f192c81cf0bdf
Signed-off-by: default avatarShenghou Ma <minux@golang.org>
Reviewed-on: https://go-review.googlesource.com/1888Reviewed-by: default avatarRuss Cox <rsc@golang.org>
Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
parent 958e0792
...@@ -2,16 +2,10 @@ ...@@ -2,16 +2,10 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
// Assembly to get into package runtime without using exported symbols. package cgotest
// +build amd64 amd64p32 arm 386 import _ "unsafe"
// +build gc
#include "textflag.h" //go:linkname lockedOSThread runtime.lockedOSThread
//extern runtime_lockedOSThread
#ifdef GOARCH_arm func lockedOSThread() bool
#define JMP B
#endif
TEXT ·LockedOSThread(SB),NOSPLIT,$0-0
JMP runtime·lockedOSThread(SB)
// Copyright 2012 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.
package backdoor
func LockedOSThread() bool // in thunk.s or runtime_gccgo.c
// Copyright 2012 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.
// Expose some runtime functions for testing.
// This is the gccgo version of thunk.s.
// +build gccgo
_Bool runtime_lockedOSThread(void);
_Bool LockedOSThread(void) asm(GOPKGPATH ".LockedOSThread");
_Bool
LockedOSThread(void)
{
return runtime_lockedOSThread();
}
...@@ -22,8 +22,6 @@ import ( ...@@ -22,8 +22,6 @@ import (
"strings" "strings"
"testing" "testing"
"unsafe" "unsafe"
"./backdoor"
) )
// nestedCall calls into C, back into Go, and finally to f. // nestedCall calls into C, back into Go, and finally to f.
...@@ -50,8 +48,6 @@ func testCallbackGC(t *testing.T) { ...@@ -50,8 +48,6 @@ func testCallbackGC(t *testing.T) {
nestedCall(runtime.GC) nestedCall(runtime.GC)
} }
var lockedOSThread = backdoor.LockedOSThread
func testCallbackPanic(t *testing.T) { func testCallbackPanic(t *testing.T) {
// Make sure panic during callback unwinds properly. // Make sure panic during callback unwinds properly.
if lockedOSThread() { if lockedOSThread() {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment