Repository: go
Issue: cmd/link: missing go_kind attr for some dwarf pointer types
Labels: NeedsFix,compiler/runtime

<!--
Please answer these questions before submitting your issue. Thanks!
-->

### What version of Go are you using (`go version`)?

<pre>
$ go version
go version go1.17.8 linux/amd64
</pre>

### Does this issue reproduce with the latest release?
Yes.


### What operating system and processor architecture are you using (`go env`)?
<details><summary><code>go env</code> Output</summary><br><pre>
$ go env
GO111MODULE="off"
GOARCH="amd64"
GOBIN=""
GOCACHE="/root/.cache/go-build"
GOENV="/root/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/zgy/gopath/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/zgy/gopath"
GOPRIVATE=""
GOPROXY=""
GOROOT="/root/go"
GOSUMDB="off"
GOTMPDIR=""
GOTOOLDIR="/root/go/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="go1.17.8"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build585319194=/tmp/go-build -gno-record-gcc-switches"
</pre></details>

### What did you do?

<!--
If possible, provide a recipe for reproducing the error.
A complete runnable program is good.
A link on go.dev/play is best.
-->

```go
package main

// To make sure there are pointers defined by function defptrto,
// define a chan variable.

var c chan string

func main() {
	c <- "foo"
}
```

`go build` , then use `readelf -wi main | grep "Unknown AT value: 2900: 0"` to print the dwarf types info.
<details><summary>Output</summary>
<pre>
    <40146>   Unknown AT value: 2900: 0
    <40409>   Unknown AT value: 2900: 0
    <48414>   Unknown AT value: 2900: 0
    <49178>   Unknown AT value: 2900: 0
    <50a31>   Unknown AT value: 2900: 0
    <50a4e>   Unknown AT value: 2900: 0
    <50a6c>   Unknown AT value: 2900: 0
    <50a8d>   Unknown AT value: 2900: 0
    <50aad>   Unknown AT value: 2900: 0
    <50acc>   Unknown AT value: 2900: 0
    <50af1>   Unknown AT value: 2900: 0
    <50b14>   Unknown AT value: 2900: 0
    <50b43>   Unknown AT value: 2900: 0
    <50ba9>   Unknown AT value: 2900: 0
    <50bcf>   Unknown AT value: 2900: 0
    <50c7a>   Unknown AT value: 2900: 0
    <50c96>   Unknown AT value: 2900: 0
    <50cc2>   Unknown AT value: 2900: 0
    <50cf1>   Unknown AT value: 2900: 0
    <50d57>   Unknown AT value: 2900: 0
    <50d7d>   Unknown AT value: 2900: 0
    <50e28>   Unknown AT value: 2900: 0
    <50e46>   Unknown AT value: 2900: 0
    <50e6a>   Unknown AT value: 2900: 0
    <50e93>   Unknown AT value: 2900: 0
    <50ef4>   Unknown AT value: 2900: 0
    <50f13>   Unknown AT value: 2900: 0
    <50fb7>   Unknown AT value: 2900: 0
    <50fe0>   Unknown AT value: 2900: 0
    <51007>   Unknown AT value: 2900: 0
    <5103e>   Unknown AT value: 2900: 0
    <510ad>   Unknown AT value: 2900: 0
    <510da>   Unknown AT value: 2900: 0
    <5118c>   Unknown AT value: 2900: 0
    <511a9>   Unknown AT value: 2900: 0
    <511d8>   Unknown AT value: 2900: 0
    <5120b>   Unknown AT value: 2900: 0
    <51275>   Unknown AT value: 2900: 0
    <5129e>   Unknown AT value: 2900: 0
    <5134c>   Unknown AT value: 2900: 0
    <51372>   Unknown AT value: 2900: 0
    <5139e>   Unknown AT value: 2900: 0
    <513d7>   Unknown AT value: 2900: 0
    <51447>   Unknown AT value: 2900: 0
    <51477>   Unknown AT value: 2900: 0
    <5152c>   Unknown AT value: 2900: 0
    <51543>   Unknown AT value: 2900: 0
    <51612>   Unknown AT value: 2900: 0
    <51647>   Unknown AT value: 2900: 0
    <5165e>   Unknown AT value: 2900: 0
    <5171e>   Unknown AT value: 2900: 0
    <51734>   Unknown AT value: 2900: 0
    <51802>   Unknown AT value: 2900: 0
    <51836>   Unknown AT value: 2900: 0
    <5184c>   Unknown AT value: 2900: 0
    <5190b>   Unknown AT value: 2900: 0
    <51924>   Unknown AT value: 2900: 0
    <519f5>   Unknown AT value: 2900: 0
    <51a2c>   Unknown AT value: 2900: 0
    <51a45>   Unknown AT value: 2900: 0
    <51b07>   Unknown AT value: 2900: 0
    <51b23>   Unknown AT value: 2900: 0
    <51bf4>   Unknown AT value: 2900: 0
    <51c10>   Unknown AT value: 2900: 0
    <51c4a>   Unknown AT value: 2900: 0
    <51c66>   Unknown AT value: 2900: 0
    <51d2b>   Unknown AT value: 2900: 0
</pre>
</details>

### What did you expect to see?
The attr 2900 is `DW_AT_go_kind`, it should not be 0 in any types.


### What did you see instead?
the attr DW_AT_go_kind of some types is 0.


The dwarf syms defined by src/cmd/link/internal/ld/dwarf.go^(*dwctxt).defptrto missed attr DW_AT_go_kind.