1
0
mirror of https://github.com/golang/go synced 2024-11-15 03:00:36 -07:00

cmd/go: pass -Wl,-z,nodelete for c-shared mode with gccgo

This is the gccgo version of CL 15605.

For https://gcc.gnu.org/PR114699

For #11100
For #12582
For #12873

Change-Id: I30e23130737022d772971f0bd629b57269174886
Reviewed-on: https://go-review.googlesource.com/c/go/+/582975
Reviewed-by: Than McIntosh <thanm@google.com>
Commit-Queue: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
This commit is contained in:
Ian Lance Taylor 2024-05-02 13:38:55 -07:00 committed by Gopher Robot
parent b64e5e38ab
commit e602625c5e

View File

@ -484,6 +484,9 @@ func (tools gccgoToolchain) link(b *Builder, root *Action, out, importcfg string
case "c-shared":
ldflags = append(ldflags, "-shared", "-nostdlib")
if cfg.Goos != "windows" {
ldflags = append(ldflags, "-Wl,-z,nodelete")
}
ldflags = append(ldflags, goLibBegin...)
ldflags = append(ldflags, "-lgo", "-lgcc_s", "-lgcc", "-lc", "-lgcc")