aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlex Brainman <alex.brainman@gmail.com>2017-02-08 11:42:24 +1100
committerAlex Brainman <alex.brainman@gmail.com>2017-02-21 06:10:51 +0000
commit6db4d92e4c01c854e15391d18100c8d99cbbd7bc (patch)
treeb599fa68ed94e88935eb10f64de274d64e08b301 /src
parentb660a4b04d0a88e86d15c1235a4d3bdf1efcd12c (diff)
downloadgo-6db4d92e4c01c854e15391d18100c8d99cbbd7bc.tar.xz
cmd/link: do not add __image_base__ and _image_base__ if external linker
The symbols get in a way when using external linker. They are not associated with a section. And linker fails when generating relocations for them. __image_base__ and _image_base__ have been added long time ago. I do not think they are needed anymore. If I delete them, all tests still PASS. I tried going back to the commit that added them to see if I can reproduce original error, but I cannot build it. I don't have hg version of go repo, and my gcc is complaining about cc source code. I wasted too much time with this, so I decided to leave them only for internal linker. That is what they were originally added for. For #10776. Change-Id: Ibb72b04f3864947c782f964a7badc69f4b074e25 Reviewed-on: https://go-review.googlesource.com/36979 Reviewed-by: Ian Lance Taylor <iant@golang.org>
Diffstat (limited to 'src')
-rw-r--r--src/cmd/link/internal/ld/pe.go9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/cmd/link/internal/ld/pe.go b/src/cmd/link/internal/ld/pe.go
index 876bc70939..3a99388381 100644
--- a/src/cmd/link/internal/ld/pe.go
+++ b/src/cmd/link/internal/ld/pe.go
@@ -458,10 +458,11 @@ func Peinit(ctxt *Link) {
nextsectoff = int(PESECTHEADR)
nextfileoff = int(PEFILEHEADR)
- // some mingw libs depend on this symbol, for example, FindPESectionByName
- ctxt.xdefine("__image_base__", obj.SDATA, PEBASE)
-
- ctxt.xdefine("_image_base__", obj.SDATA, PEBASE)
+ if Linkmode == LinkInternal {
+ // some mingw libs depend on this symbol, for example, FindPESectionByName
+ ctxt.xdefine("__image_base__", obj.SDATA, PEBASE)
+ ctxt.xdefine("_image_base__", obj.SDATA, PEBASE)
+ }
HEADR = PEFILEHEADR
if *FlagTextAddr == -1 {