Description: link external tests first External tests contain a superset of the internal test symbols so must be presented first to avoid ld(1) aborting on duplicate symbol errors. . gccgo-go (1.2.1-0ubuntu1) trusty; urgency=medium . * New upstream point release. * Fix error running unit tests due to duplicated symbols (LP: #1289067): - d/p/issue61970044_40001.diff: Replace with issue61970044_80001.diff, update to existing proposed fix upstream. - d/p/issue80300043_60001.diff: Cherry pick upstream trunk fix for cmd/go: go test -compiler gccgo produces duplicate symbol errors. Author: James Page Bug-Ubuntu: https://bugs.launchpad.net/bugs/1289067 --- The information above should follow the Patch Tagging Guidelines, please checkout http://dep.debian.net/deps/dep3/ to learn about the format. Here are templates for supplementary fields that you might want to add: Origin: , Bug: Bug-Debian: http://bugs.debian.org/ Bug-Ubuntu: https://launchpad.net/bugs/ Forwarded: Reviewed-By: Last-Update: --- gccgo-go-1.2.1.orig/src/cmd/go/build.go +++ gccgo-go-1.2.1/src/cmd/go/build.go @@ -1705,6 +1705,7 @@ func (tools gccgoToolchain) ld(b *builde // and all LDFLAGS from cgo dependencies. apackagesSeen := make(map[*Package]bool) afiles := []string{} + xfiles := []string{} sfiles := []string{} ldflags := b.gccArchArgs() cgoldflags := []string{} @@ -1720,7 +1721,12 @@ func (tools gccgoToolchain) ld(b *builde if !a.p.Standard { if a.p != nil && !apackagesSeen[a.p] { apackagesSeen[a.p] = true - if a.p.fake { + if a.p.fake && a.p.external { + // external _tests, if present must come before + // internal _tests. Store these on a seperate list + // and place them at the head after this loop. + xfiles = append([]string{a.target}, xfiles...) + } else if a.p.fake { // move _test files to the top of the link order afiles = append([]string{a.target}, afiles...) } else { @@ -1729,6 +1735,7 @@ func (tools gccgoToolchain) ld(b *builde } } } + afiles = append(xfiles, afiles...) for _, a := range allactions { if a.p != nil { --- gccgo-go-1.2.1.orig/src/cmd/go/pkg.go +++ gccgo-go-1.2.1/src/cmd/go/pkg.go @@ -80,6 +80,7 @@ type Package struct { allgofiles []string // gofiles + IgnoredGoFiles, absolute paths target string // installed file for this package (may be executable) fake bool // synthesized package + external bool // synthesized external test package forceBuild bool // this package must be rebuilt forceLibrary bool // this package is a library (even if named "main") cmdline bool // defined by files listed on command line --- gccgo-go-1.2.1.orig/src/cmd/go/test.go +++ gccgo-go-1.2.1/src/cmd/go/test.go @@ -649,6 +649,7 @@ func (b *builder) test(p *Package) (buil imports: append(ximports, ptest), pkgdir: testDir, fake: true, + external: true, Stale: true, } }