* libgo patch committed: always use --whole-archive in go tool
@ 2015-11-10 20:31 Ian Lance Taylor
0 siblings, 0 replies; only message in thread
From: Ian Lance Taylor @ 2015-11-10 20:31 UTC (permalink / raw)
To: gcc-patches, gofrontend-dev
[-- Attachment #1: Type: text/plain, Size: 401 bytes --]
This patch changes the Go tool to always use --whole-archive when
linking gccgo packages. This fixes cases where a Go package uses cgo
to call C code in which the only referenced symbol is a C global
variable. This is a backport of https://golang.org/cl/16775 in the
master Go sources. This fixes GC PR 68255. Bootstrapped and ran Go
testsuite on x86_64-pc-linux-gnu. Committed to mainline.
Ian
[-- Attachment #2: patch.txt --]
[-- Type: text/plain, Size: 1148 bytes --]
Index: gcc/go/gofrontend/MERGE
===================================================================
--- gcc/go/gofrontend/MERGE (revision 230064)
+++ gcc/go/gofrontend/MERGE (working copy)
@@ -1,4 +1,4 @@
-012ab5cb2ef1c26e8023ce90d3a2bba174da7b30
+0c07751d139ef90a43ef7f299f925622a8792a9f
The first line of this file holds the git revision number of the last
merge done from the gofrontend repository.
Index: libgo/go/cmd/go/build.go
===================================================================
--- libgo/go/cmd/go/build.go (revision 230064)
+++ libgo/go/cmd/go/build.go (working copy)
@@ -2555,17 +2555,9 @@ func (tools gccgoToolchain) ld(b *builde
}
}
- switch ldBuildmode {
- case "c-archive", "c-shared":
- ldflags = append(ldflags, "-Wl,--whole-archive")
- }
-
+ ldflags = append(ldflags, "-Wl,--whole-archive")
ldflags = append(ldflags, afiles...)
-
- switch ldBuildmode {
- case "c-archive", "c-shared":
- ldflags = append(ldflags, "-Wl,--no-whole-archive")
- }
+ ldflags = append(ldflags, "-Wl,--no-whole-archive")
ldflags = append(ldflags, cgoldflags...)
ldflags = append(ldflags, envList("CGO_LDFLAGS", "")...)
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2015-11-10 20:31 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-10 20:31 libgo patch committed: always use --whole-archive in go tool Ian Lance Taylor
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).