mirror of
https://github.com/golang/go
synced 2024-11-26 21:11:57 -07:00
cmd/go: fix missing __mingw_fprintf symbol for cgo on windows
Fixes #5986. R=golang-dev, rsc, alex.brainman CC=golang-dev https://golang.org/cl/13261055
This commit is contained in:
parent
9add729a1f
commit
db71e1557b
@ -47,5 +47,6 @@ func TestCallbackStack(t *testing.T) { testCallbackStack(t) }
|
||||
func TestFpVar(t *testing.T) { testFpVar(t) }
|
||||
func Test4339(t *testing.T) { test4339(t) }
|
||||
func Test6390(t *testing.T) { test6390(t) }
|
||||
func Test5986(t *testing.T) { test5986(t) }
|
||||
|
||||
func BenchmarkCgoCall(b *testing.B) { benchCgoCall(b) }
|
||||
|
32
misc/cgo/test/issue5986.go
Normal file
32
misc/cgo/test/issue5986.go
Normal file
@ -0,0 +1,32 @@
|
||||
// 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
|
||||
|
||||
/*
|
||||
#cgo LDFLAGS: -lm
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
|
||||
static void output5986()
|
||||
{
|
||||
int current_row = 0, row_count = 0;
|
||||
double sum_squares = 0;
|
||||
do {
|
||||
if (current_row == 10) {
|
||||
current_row = 0;
|
||||
}
|
||||
++row_count;
|
||||
}
|
||||
while (current_row++ != 1);
|
||||
double d = sqrt(sum_squares / row_count);
|
||||
printf("sqrt is: %g\n", d);
|
||||
}
|
||||
*/
|
||||
import "C"
|
||||
import "testing"
|
||||
|
||||
func test5986(t *testing.T) {
|
||||
C.output5986()
|
||||
}
|
@ -2034,8 +2034,9 @@ func (b *builder) cgo(p *Package, cgoExe, obj string, gccfiles []string, gxxfile
|
||||
|
||||
var staticLibs []string
|
||||
if goos == "windows" {
|
||||
// libmingw32 and libmingwex might also use libgcc, so libgcc must come last
|
||||
staticLibs = []string{"-lmingwex", "-lmingw32"}
|
||||
// libmingw32 and libmingwex might also use libgcc, so libgcc must come last,
|
||||
// and they also have some inter-dependencies, so must use linker groups.
|
||||
staticLibs = []string{"-Wl,--start-group", "-lmingwex", "-lmingw32", "-Wl,--end-group"}
|
||||
}
|
||||
if cgoLibGccFile != "" {
|
||||
staticLibs = append(staticLibs, cgoLibGccFile)
|
||||
|
Loading…
Reference in New Issue
Block a user