mirror of https://github.com/golang/go.git
cmd/go, cmd/ld: fix libgcc order and add __image_base__ symbol for windows
Fixes #4063. R=alex.brainman, rsc CC=golang-dev https://golang.org/cl/6543066
This commit is contained in:
parent
e80fccb441
commit
5490814c30
|
|
@ -1597,9 +1597,12 @@ func (b *builder) cgo(p *Package, cgoExe, obj string, gccfiles []string) (outGo,
|
|||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
staticLibs := []string{libgcc}
|
||||
var staticLibs []string
|
||||
if goos == "windows" {
|
||||
staticLibs = append(staticLibs, "-lmingwex", "-lmingw32")
|
||||
// libmingw32 and libmingwex might also use libgcc, so libgcc must come last
|
||||
staticLibs = []string{"-lmingwex", "-lmingw32", libgcc}
|
||||
} else {
|
||||
staticLibs = []string{libgcc}
|
||||
}
|
||||
|
||||
for _, cfile := range cfiles {
|
||||
|
|
|
|||
|
|
@ -148,6 +148,9 @@ peinit(void)
|
|||
PESECTHEADR = rnd(PEFILEHEADR, PESECTALIGN);
|
||||
nextsectoff = PESECTHEADR;
|
||||
nextfileoff = PEFILEHEADR;
|
||||
|
||||
// some mingw libs depend on this symbol, for example, FindPESectionByName
|
||||
xdefine("__image_base__", SDATA, PEBASE);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
|||
|
|
@ -64,11 +64,10 @@ echo.
|
|||
|
||||
:: cgo tests
|
||||
if x%CGO_ENABLED% == x0 goto nocgo
|
||||
:: TODO(brainman) disabled, because it is broken on go builder - http://golang.org/issue/4063
|
||||
::echo # ..\misc\cgo\life
|
||||
::go run %GOROOT%\test\run.go - ..\misc\cgo\life
|
||||
::if errorlevel 1 goto fail
|
||||
::echo.
|
||||
echo # ..\misc\cgo\life
|
||||
go run %GOROOT%\test\run.go - ..\misc\cgo\life
|
||||
if errorlevel 1 goto fail
|
||||
echo.
|
||||
|
||||
echo # ..\misc\cgo\stdio
|
||||
go run %GOROOT%\test\run.go - ..\misc\cgo\stdio
|
||||
|
|
|
|||
Loading…
Reference in New Issue