1
0
mirror of https://github.com/golang/go synced 2024-11-23 06:10:05 -07:00
go/src/cmd
Matthew Dempsky f58c6cccc4 cmd/compile: fix reproducible build of aliased generic types
Due to a missing "&& !alias" check, the unified linker was treating
type aliases the same as defined types for the purpose of exporting
method bodies. The methods will get exported anyway alongside the
aliased type, so this mistake is normally harmless.

However, if multiple type aliases instantiated the same generic type
but with different type arguments, this could result in the
same (generic) method body being exported multiple times under
different symbol names. Further, because bodies aren't expected to be
exported multiple times, we were sorting them simply based on index.
And consequently, the sort wasn't total and is sensitive to the map
iteration order used while ranging over linker.bodies.

The fix is simply to add the missing "&& !alias" check, so that we
don't end up with duplicate bodies in the first place.

Thanks rsc@ for providing a minimal repro case.

Fixes #59571.

Change-Id: Iaa55968cc7110b601e2f0f9b620901c2d55f7014
Reviewed-on: https://go-review.googlesource.com/c/go/+/484155
Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
2023-04-12 20:54:38 +00:00
..
addr2line
api
asm cmd/asm,cmd/internal/obj/x86: add RDPID instruction to x86 assembler 2023-04-11 18:32:50 +00:00
buildid
cgo
compile cmd/compile: fix reproducible build of aliased generic types 2023-04-12 20:54:38 +00:00
covdata all: replace fmt.Sprintf("%d") with strconv.Itoa 2023-03-31 18:41:24 +00:00
cover
dist cmd/internal/sys, cmd/dist, misc/cgo/testcshared: enable c-shared feature and test on loong64 2023-04-12 20:06:37 +00:00
distpack cmd/dist: add -distpack flag to build distribution archives 2023-04-11 21:29:13 +00:00
doc cmd/doc: format field doc comments when printing entire struct 2023-04-10 22:35:17 +00:00
fix
go cmd/compile: fix reproducible build of aliased generic types 2023-04-12 20:54:38 +00:00
gofmt cmd/gofmt: set backup file permissions on Windows 2023-03-31 22:38:04 +00:00
internal all: re-run stringer 2023-04-11 20:24:07 +00:00
link cmd/internal/obj/loong64, cmd/internal/objabi, cmd/link: add support for --buildmode=c-shared on loong64 2023-04-11 16:54:53 +00:00
nm internal/platform: pass race mode to DefaultPIE 2023-03-20 23:32:34 +00:00
objdump cmd/objdump: unskip TestDisasmExtld on Windows 2023-03-31 21:48:16 +00:00
pack all: skip tests that fail on android/arm64 2023-03-10 20:38:29 +00:00
pprof internal/platform: add a function to report whether default builds are PIE 2023-03-15 13:31:05 +00:00
test2json cmd: add wasip1 support 2023-04-06 22:37:50 +00:00
trace
vendor all: update vendored golang.org/x/net 2023-04-11 22:42:18 +00:00
vet
go.mod all: update vendored golang.org/x/net 2023-04-11 22:42:18 +00:00
go.sum all: update vendored golang.org/x/net 2023-04-11 22:42:18 +00:00
README.vendor

See src/README.vendor for information on loading vendored packages
and updating the vendor directory.