aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAustin Clements <austin@google.com>2017-10-18 20:14:29 -0400
committerAustin Clements <austin@google.com>2017-10-19 02:56:09 +0000
commit717d37591d9d446007b830c70ff74d8f8dca13d9 (patch)
tree64960f34d32a5ee953770038de1d42220178c8da /src
parent8ce8143f104a72718bdd8a53b4f8d3deba0df47e (diff)
downloadgo-717d37591d9d446007b830c70ff74d8f8dca13d9.tar.xz
cmd/compile: allow duplicate DWARF producer symbols
When building test binaries, we build one archive with all of the test sources and a second archive with the generated test package main and link them together. If the test sources are themselves in package main and the test was compiled with non-default compiler flags, then both archives will contain a go.cuinfo.producer.main symbol, leading to a duplicate symbol failure. This has been causing test build failures on darwin-arm-a1428ios, darwin-arm64-a1549ios, linux-amd64-noopt, android-arm-wiko-fever, and android-arm64-wiko-fever since CL 71430 added this symbol. This CL should fix the build. Change-Id: I69051c846e7c0d97395a865a361cae07f411f9ad Reviewed-on: https://go-review.googlesource.com/71771 Run-TryBot: Austin Clements <austin@google.com> Reviewed-by: Than McIntosh <thanm@google.com> Reviewed-by: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
Diffstat (limited to 'src')
-rw-r--r--src/cmd/compile/internal/gc/main.go3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/cmd/compile/internal/gc/main.go b/src/cmd/compile/internal/gc/main.go
index 8a02e98e0e..288c1d8420 100644
--- a/src/cmd/compile/internal/gc/main.go
+++ b/src/cmd/compile/internal/gc/main.go
@@ -1250,6 +1250,9 @@ func recordFlags(flags ...string) {
}
s := Ctxt.Lookup(dwarf.CUInfoPrefix + "producer." + myimportpath)
s.Type = objabi.SDWARFINFO
+ // Sometimes (for example when building tests) we can link
+ // together two package main archives. So allow dups.
+ s.Set(obj.AttrDuplicateOK, true)
Ctxt.Data = append(Ctxt.Data, s)
s.P = cmd.Bytes()[1:]
}