diff options
author | Shenghou Ma <minux.ma@gmail.com> | 2014-02-23 16:20:40 -0500 |
---|---|---|
committer | Shenghou Ma <minux.ma@gmail.com> | 2014-02-23 16:20:40 -0500 |
commit | feb64cf95e8baf73f8a36c7e009c1a3fa925608a (patch) | |
tree | 4ef653aee42e386f9d4f85aee8e8103937993547 /misc/cgo | |
parent | c5e144bdbfdcecef4e6f125b2cef41da84779cdf (diff) | |
download | go-feb64cf95e8baf73f8a36c7e009c1a3fa925608a.tar.gz |
cmd/ld: don't emit unreachable dynimport symbols in ELF symtab.
Fix build for Dragonfly BSD.
Fixes issue 7318.
Fixes issue 7367.
LGTM=jsing, iant
R=jsing, iant, mikioh.mikioh
CC=golang-codereviews
https://codereview.appspot.com/64340043
Diffstat (limited to 'misc/cgo')
-rw-r--r-- | misc/cgo/testso/cgoso_c.c | 1 | ||||
-rw-r--r-- | misc/cgo/testso/cgoso_unix.go | 20 |
2 files changed, 21 insertions, 0 deletions
diff --git a/misc/cgo/testso/cgoso_c.c b/misc/cgo/testso/cgoso_c.c index 27155c27f..9b77a76fc 100644 --- a/misc/cgo/testso/cgoso_c.c +++ b/misc/cgo/testso/cgoso_c.c @@ -17,6 +17,7 @@ __declspec(dllexport) void sofunc(void); #else extern void goCallback(void); void setCallback(void *f) { (void)f; } +__thread int tlsvar = 12345; #endif void sofunc(void) diff --git a/misc/cgo/testso/cgoso_unix.go b/misc/cgo/testso/cgoso_unix.go new file mode 100644 index 000000000..e86f99264 --- /dev/null +++ b/misc/cgo/testso/cgoso_unix.go @@ -0,0 +1,20 @@ +// Copyright 2014 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 darwin dragonfly freebsd linux netbsd + +package cgosotest + +/* +extern int __thread tlsvar; +int *getTLS() { return &tlsvar; } +*/ +import "C" + +func init() { + if v := *C.getTLS(); v != 12345 { + println("got", v) + panic("BAD TLS value") + } +} |