FAQ
Reviewers: brainman,

Message:
Hello alex.brainman@gmail.com (cc: golang-dev@googlegroups.com),

I'd like you to review this change to
https://code.google.com/p/go


Description:
cmd/go, cmd/ld: fix libgcc order and add __image_base__ symbol for
windows
Fixes issue 4063.

Please review this at http://codereview.appspot.com/6543066/

Affected files:
M src/cmd/go/build.go
M src/cmd/ld/pe.c
M src/run.bat


Index: src/cmd/go/build.go
===================================================================
--- a/src/cmd/go/build.go
+++ b/src/cmd/go/build.go
@@ -1597,9 +1597,12 @@
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 {
Index: src/cmd/ld/pe.c
===================================================================
--- a/src/cmd/ld/pe.c
+++ b/src/cmd/ld/pe.c
@@ -148,6 +148,9 @@
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
Index: src/run.bat
===================================================================
--- a/src/run.bat
+++ b/src/run.bat
@@ -64,11 +64,10 @@

:: 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

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-dev @
categoriesgo
postedSep 24, '12 at 11:58a
activeSep 26, '12 at 2:34p
posts5
users3
websitegolang.org

People

Translate

site design / logo © 2022 Grokbase