diff options
author | Shenghou Ma <minux.ma@gmail.com> | 2013-09-18 22:27:25 -0400 |
---|---|---|
committer | Shenghou Ma <minux.ma@gmail.com> | 2013-09-18 22:27:25 -0400 |
commit | a06116d08d29c6d5f65caf30d243b79781cf93de (patch) | |
tree | bdcc57d374cc71f9e1fc81d82c5b29cf10dd1345 /misc/cgo | |
parent | 6e83a17c80d84a991c083f1ff90d32f101689935 (diff) | |
download | go-a06116d08d29c6d5f65caf30d243b79781cf93de.tar.gz |
cmd/ld: handle duplicate static symbols in COFF and Mach-O files.
Fixes issue 5740.
R=iant, rsc, luisbebop
CC=gobot, golang-dev
https://codereview.appspot.com/10345046
Diffstat (limited to 'misc/cgo')
-rw-r--r-- | misc/cgo/test/issue5740.go | 15 | ||||
-rw-r--r-- | misc/cgo/test/issue5740a.c | 9 | ||||
-rw-r--r-- | misc/cgo/test/issue5740b.c | 9 |
3 files changed, 33 insertions, 0 deletions
diff --git a/misc/cgo/test/issue5740.go b/misc/cgo/test/issue5740.go new file mode 100644 index 000000000..25c86153f --- /dev/null +++ b/misc/cgo/test/issue5740.go @@ -0,0 +1,15 @@ +// Copyright 2013 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 cgotest + +// int test5740a(void), test5740b(void); +import "C" +import "testing" + +func test5740(t *testing.T) { + if v := C.test5740a() + C.test5740b(); v != 5 { + t.Errorf("expected 5, got %v", v) + } +} diff --git a/misc/cgo/test/issue5740a.c b/misc/cgo/test/issue5740a.c new file mode 100644 index 000000000..25f18e2a4 --- /dev/null +++ b/misc/cgo/test/issue5740a.c @@ -0,0 +1,9 @@ +// Copyright 2013 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. + +static int volatile val = 2; + +int test5740a() { + return val; +} diff --git a/misc/cgo/test/issue5740b.c b/misc/cgo/test/issue5740b.c new file mode 100644 index 000000000..22893f35b --- /dev/null +++ b/misc/cgo/test/issue5740b.c @@ -0,0 +1,9 @@ +// Copyright 2013 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. + +static int volatile val = 3; + +int test5740b() { + return val; +} |