]> Cypherpunks.ru repositories - gostls13.git/commit
cmd/link/internal/loadpe: handle _main reference properly
authorThan McIntosh <thanm@google.com>
Fri, 3 Jun 2022 11:50:58 +0000 (07:50 -0400)
committerGopher Robot <gobot@golang.org>
Mon, 6 Jun 2022 18:49:49 +0000 (18:49 +0000)
commit2fa45a4fcd57070967f081f3a5c33014c3f29fea
treedfb3c80c819abefd9f251e4af8ff416289fdde75
parentfc9707594910452cce3fba794fa9ffe541e8cefa
cmd/link/internal/loadpe: handle _main reference properly

When building CGO internal linking on windows 386, make sure to avoid
rewriting references to "_main" to "main" when reading symbols during
host object loading; the main routine defined by the Go runtime is
still named "_main" (not "main"). If we don't do this, we wind up with
an SXREF symbol named "main", which can then cause the loader to pull
an actual "main" symbol out of a host archive, which is undesirable.

Updates #35006.

Change-Id: I3768e3617b560552f4522e9e72af879c6adf7705
Reviewed-on: https://go-review.googlesource.com/c/go/+/410124
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Auto-Submit: Than McIntosh <thanm@google.com>
Run-TryBot: Than McIntosh <thanm@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
src/cmd/link/internal/loadpe/ldpe.go