summaryrefslogtreecommitdiff
path: root/debian/patches/cmd-go-combine-gccgo-s-ld-and-ldShared-methods.diff
diff options
context:
space:
mode:
Diffstat (limited to 'debian/patches/cmd-go-combine-gccgo-s-ld-and-ldShared-methods.diff')
-rw-r--r--debian/patches/cmd-go-combine-gccgo-s-ld-and-ldShared-methods.diff148
1 files changed, 0 insertions, 148 deletions
diff --git a/debian/patches/cmd-go-combine-gccgo-s-ld-and-ldShared-methods.diff b/debian/patches/cmd-go-combine-gccgo-s-ld-and-ldShared-methods.diff
deleted file mode 100644
index cb9a1bb..0000000
--- a/debian/patches/cmd-go-combine-gccgo-s-ld-and-ldShared-methods.diff
+++ /dev/null
@@ -1,148 +0,0 @@
-# DP: cmd/go: combine gccgo's ld() and ldShared() methods
-
-From 7fc382a2a201960826ed72413983685ac942c64c Mon Sep 17 00:00:00 2001
-From: Michael Hudson-Doyle <michael.hudson@canonical.com>
-Date: Tue, 31 May 2016 20:48:42 +1200
-Subject: [PATCH] cmd/go: combine gccgo's ld() and ldShared() methods
-
-This fixes handling of cgo flags and makes sure packages that are only
-implicitly included in the shared library are passed to the link.
-
-Fixes #15885
-
-Change-Id: I1e8a72b5314261973ca903c78834700fb113dde9
----
- src/cmd/go/build.go | 63 ++++++++++++++++++++++++-----------------------------
- 1 file changed, 29 insertions(+), 34 deletions(-)
-
-Index: b/src/libgo/go/cmd/go/build.go
-===================================================================
---- a/src/libgo/go/cmd/go/build.go
-+++ b/src/libgo/go/cmd/go/build.go
-@@ -2629,7 +2629,7 @@ func (gccgoToolchain) pack(b *builder, p
- return b.run(p.Dir, p.ImportPath, nil, "ar", "rc", mkAbs(objDir, afile), absOfiles)
- }
-
--func (tools gccgoToolchain) ld(b *builder, root *action, out string, allactions []*action, mainpkg string, ofiles []string) error {
-+func (tools gccgoToolchain) link(b *builder, root *action, out string, allactions []*action, mainpkg string, ofiles []string, buildmode, desc string) error {
- // gccgo needs explicit linking with all package dependencies,
- // and all LDFLAGS from cgo dependencies.
- apackagePathsSeen := make(map[string]bool)
-@@ -2638,8 +2638,12 @@ func (tools gccgoToolchain) ld(b *builde
- ldflags := b.gccArchArgs()
- cgoldflags := []string{}
- usesCgo := false
-- cxx := len(root.p.CXXFiles) > 0 || len(root.p.SwigCXXFiles) > 0
-- objc := len(root.p.MFiles) > 0
-+ cxx := false
-+ objc := false
-+ if root.p != nil {
-+ cxx = len(root.p.CXXFiles) > 0 || len(root.p.SwigCXXFiles) > 0
-+ objc = len(root.p.MFiles) > 0
-+ }
-
- readCgoFlags := func(flagsFile string) error {
- flags, err := ioutil.ReadFile(flagsFile)
-@@ -2686,11 +2690,11 @@ func (tools gccgoToolchain) ld(b *builde
- }
-
- newarchive := newa.Name()
-- err = b.run(b.work, root.p.ImportPath, nil, "ar", "x", newarchive, "_cgo_flags")
-+ err = b.run(b.work, desc, nil, "ar", "x", newarchive, "_cgo_flags")
- if err != nil {
- return "", err
- }
-- err = b.run(".", root.p.ImportPath, nil, "ar", "d", newarchive, "_cgo_flags")
-+ err = b.run(".", desc, nil, "ar", "d", newarchive, "_cgo_flags")
- if err != nil {
- return "", err
- }
-@@ -2793,7 +2797,9 @@ func (tools gccgoToolchain) ld(b *builde
-
- ldflags = append(ldflags, cgoldflags...)
- ldflags = append(ldflags, envList("CGO_LDFLAGS", "")...)
-- ldflags = append(ldflags, root.p.CgoLDFLAGS...)
-+ if root.p != nil {
-+ ldflags = append(ldflags, root.p.CgoLDFLAGS...)
-+ }
-
- ldflags = stringList("-Wl,-(", ldflags, "-Wl,-)")
-
-@@ -2808,7 +2814,7 @@ func (tools gccgoToolchain) ld(b *builde
- }
-
- var realOut string
-- switch ldBuildmode {
-+ switch buildmode {
- case "exe":
- if usesCgo && goos == "linux" {
- ldflags = append(ldflags, "-Wl,-E")
-@@ -2843,12 +2849,14 @@ func (tools gccgoToolchain) ld(b *builde
-
- case "c-shared":
- ldflags = append(ldflags, "-shared", "-nostdlib", "-Wl,--whole-archive", "-lgolibbegin", "-Wl,--no-whole-archive", "-lgo", "-lgcc_s", "-lgcc", "-lc", "-lgcc")
-+ case "shared":
-+ ldflags = append(ldflags, "-zdefs", "-shared", "-nostdlib", "-lgo", "-lgcc_s", "-lgcc", "-lc")
-
- default:
-- fatalf("-buildmode=%s not supported for gccgo", ldBuildmode)
-+ fatalf("-buildmode=%s not supported for gccgo", buildmode)
- }
-
-- switch ldBuildmode {
-+ switch buildmode {
- case "exe", "c-shared":
- if cxx {
- ldflags = append(ldflags, "-lstdc++")
-@@ -2858,41 +2866,27 @@ func (tools gccgoToolchain) ld(b *builde
- }
- }
-
-- if err := b.run(".", root.p.ImportPath, nil, tools.linker(), "-o", out, ofiles, ldflags, buildGccgoflags); err != nil {
-+ if err := b.run(".", desc, nil, tools.linker(), "-o", out, ofiles, ldflags, buildGccgoflags); err != nil {
- return err
- }
-
-- switch ldBuildmode {
-+ switch buildmode {
- case "c-archive":
-- if err := b.run(".", root.p.ImportPath, nil, "ar", "rc", realOut, out); err != nil {
-+ if err := b.run(".", desc, nil, "ar", "rc", realOut, out); err != nil {
- return err
- }
- }
- return nil
- }
-
-+func (tools gccgoToolchain) ld(b *builder, root *action, out string, allactions []*action, mainpkg string, ofiles []string) error {
-+ return tools.link(b, root, out, allactions, mainpkg, ofiles, ldBuildmode, root.p.ImportPath)
-+}
-+
- func (tools gccgoToolchain) ldShared(b *builder, toplevelactions []*action, out string, allactions []*action) error {
-- args := []string{"-o", out, "-shared", "-nostdlib", "-zdefs", "-Wl,--whole-archive"}
-- for _, a := range toplevelactions {
-- args = append(args, a.target)
-- }
-- args = append(args, "-Wl,--no-whole-archive", "-shared", "-nostdlib", "-lgo", "-lgcc_s", "-lgcc", "-lc")
-- shlibs := []string{}
-- for _, a := range allactions {
-- if strings.HasSuffix(a.target, ".so") {
-- shlibs = append(shlibs, a.target)
-- }
-- }
-- for _, shlib := range shlibs {
-- args = append(
-- args,
-- "-L"+filepath.Dir(shlib),
-- "-Wl,-rpath="+filepath.Dir(shlib),
-- "-l"+strings.TrimSuffix(
-- strings.TrimPrefix(filepath.Base(shlib), "lib"),
-- ".so"))
-- }
-- return b.run(".", out, nil, tools.linker(), args, buildGccgoflags)
-+ fakeRoot := &action{}
-+ fakeRoot.deps = toplevelactions
-+ return tools.link(b, fakeRoot, out, allactions, "", []string{}, "shared", out)
- }
-
- func (tools gccgoToolchain) cc(b *builder, p *Package, objdir, ofile, cfile string) error {