diff options
| author | Shenghou Ma <minux@golang.org> | 2015-09-10 02:32:12 -0400 |
|---|---|---|
| committer | Minux Ma <minux@golang.org> | 2015-09-12 08:34:52 +0000 |
| commit | 0b5bcf53ee4af0e244ba1991069741774bf4f164 (patch) | |
| tree | ad8e8d5097b18c63c88efba5107ca86f52bd167b /src | |
| parent | ea4e321d4daef32f4cd8df8ec799122ff3c6b9f0 (diff) | |
| download | go-0b5bcf53ee4af0e244ba1991069741774bf4f164.tar.xz | |
runtime/cgo: explicitly link msvcrt on windows
It's because runtime links to ntdll, and ntdll exports a couple
incompatible libc functions. We must link to msvcrt first and
then try ntdll.
Fixes #12030.
Change-Id: I0105417bada108da55f5ae4482c2423ac7a92957
Reviewed-on: https://go-review.googlesource.com/14472
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Run-TryBot: Minux Ma <minux@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Diffstat (limited to 'src')
| -rw-r--r-- | src/runtime/cgo/cgo.go | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/runtime/cgo/cgo.go b/src/runtime/cgo/cgo.go index cb24678bf0..8f3e66fa4d 100644 --- a/src/runtime/cgo/cgo.go +++ b/src/runtime/cgo/cgo.go @@ -20,7 +20,9 @@ package cgo #cgo !android,linux LDFLAGS: -lpthread #cgo netbsd LDFLAGS: -lpthread #cgo openbsd LDFLAGS: -lpthread -#cgo windows LDFLAGS: -lm -mthreads +// we must explicitly link msvcrt, because runtime needs ntdll, and ntdll +// exports some incompatible libc functions. See golang.org/issue/12030. +#cgo windows LDFLAGS: -lmsvcrt -lm -mthreads #cgo CFLAGS: -Wall -Werror |
