From: Matthew Dempsky Date: Thu, 8 Jul 2021 06:32:49 +0000 (-0700) Subject: [dev.typeparams] cmd/compile: report functions declared in Go and assembly X-Git-Tag: go1.18beta1~1818^2^2~202 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=a12ad271195d88ffa8f68ad01547560fb4d2ab49;p=gostls13.git [dev.typeparams] cmd/compile: report functions declared in Go and assembly This CL reuses the symabi wrapper information to warn when a function is defined both in Go (i.e., has a function declaration with a body) and in assembly (i.e., has a TEXT instruction). This will eventually produce a linker error anyway, but we can provide a slightly nicer error message earlier. Change-Id: Ia107f813343c0b10f4cd1013e7c72e67149ee52e Reviewed-on: https://go-review.googlesource.com/c/go/+/333454 Trust: Matthew Dempsky Run-TryBot: Matthew Dempsky TryBot-Result: Go Bot Reviewed-by: Than McIntosh --- diff --git a/src/cmd/compile/internal/ssagen/abi.go b/src/cmd/compile/internal/ssagen/abi.go index e460adaf95..6d8c53e722 100644 --- a/src/cmd/compile/internal/ssagen/abi.go +++ b/src/cmd/compile/internal/ssagen/abi.go @@ -152,6 +152,9 @@ func (s *SymABIs) GenABIWrappers() { // Apply definitions. defABI, hasDefABI := s.defs[symName] if hasDefABI { + if len(fn.Body) != 0 { + base.ErrorfAt(fn.Pos(), "%v defined in both Go and assembly", fn) + } fn.ABI = defABI }