]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/go: pass -Wl,-z,nodelete for c-shared mode with gccgo
authorIan Lance Taylor <iant@golang.org>
Thu, 2 May 2024 20:38:55 +0000 (13:38 -0700)
committerGopher Robot <gobot@golang.org>
Thu, 2 May 2024 22:18:34 +0000 (22:18 +0000)
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>

src/cmd/go/internal/work/gccgo.go

index 91d744e658e1f4123b6dec5290877e8cf64ac35f..71f37e8d47bc2307d161e3afab3e925dbf26bb26 100644 (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")