cmd/link,compile: Provide size for func types

They are currently not given a size, which makes the DWARF reader
very confused. Particularly things like [4]func() get a size of -4, not 32.

Fixes #21097

Change-Id: I01e754134d82fbbe6567e3c7847a4843792a3776
Reviewed-on: https://go-review.googlesource.com/55551
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
Keith Randall 2017-08-14 15:07:57 -07:00
parent 77a9cb9b4c
commit f4abbc0e61
3 changed files with 45 additions and 0 deletions

View file

@ -430,6 +430,7 @@ func newtype(ctxt *Link, gotype *Symbol) *dwarf.DWDie {
case objabi.KindFunc:
die = newdie(ctxt, &dwtypes, dwarf.DW_ABRV_FUNCTYPE, name, 0)
newattr(die, dwarf.DW_AT_byte_size, dwarf.DW_CLS_CONSTANT, bytesize, 0)
dotypedef(ctxt, &dwtypes, name, die)
newrefattr(die, dwarf.DW_AT_type, mustFind(ctxt, "void"))
nfields := decodetypeFuncInCount(ctxt.Arch, gotype)