Repository: go
Issue: debug/gosym: Sym.PackageName provides the wrong result
Labels: NeedsInvestigation,compiler/runtime

### Go version

go version go1.22.0 windows/amd64

### Output of `go env` in your module/workspace:

```shell
set GO111MODULE=on
set GOARCH=amd64
set GOBIN=
set GOCACHE=C:\Users\zxilly\AppData\Local\go-build
set GOENV=C:\Users\zxilly\AppData\Roaming\go\env
set GOEXE=
set GOEXPERIMENT=
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOINSECURE=
set GOMODCACHE=C:\Users\zxilly\go\pkg\mod
set GONOPROXY=1
set GONOSUMDB=
set GOOS=linux
set GOPATH=C:\Users\zxilly\go
set GOPRIVATE=
set GOPROXY=https://proxy.golang.org,direct
set GOROOT=C:/Program Files/Go
set GOSUMDB=sum.golang.org
set GOTMPDIR=
set GOTOOLCHAIN=auto
set GOTOOLDIR=C:\Program Files\Go\pkg\tool\windows_amd64
set GOVCS=
set GOVERSION=go1.22.0
set GCCGO=gccgo
set GOAMD64=v1
set AR=ar
set CC=gcc
set CXX=g++
set CGO_ENABLED=0
set GOMOD=E:\Temp\gotmp\go.mod
set GOWORK=
set CGO_CFLAGS=-O2 -g
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-O2 -g
set CGO_FFLAGS=-O2 -g
set CGO_LDFLAGS=-O2 -g
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-fPIC -m64 -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=C:\Users\zxilly\AppData\Local\Temp\go-build2223077610=/tmp/go-build -gno-record-gcc-switches
```


### What did you do?

In some edge cases, Sym.PackageName will provide incorrect results. 
I'm sorry I couldn't provide a minimally reproducible sample. But you can find a sample at https://github.com/ZNotify/server/releases/download/test/analysis-server-linux.

I use the follow code to identify the wrong output.
```golang
package main

import (
	"debug/elf"
	"debug/gosym"
	"fmt"
	"strings"
)

func main() {
	f, err := elf.Open("analysis-server-linux")
	if err != nil {
		panic(err)
	}
	// read pclntab
	pclntab, err := f.Section(".gopclntab").Data()
	if err != nil {
		panic(err)
	}

	var textStart uint64
	symbols, err := f.Symbols()
	if err != nil {
		panic(err)
	}
	for _, sym := range symbols {
		if sym.Name == "runtime.text" {
			textStart = sym.Value
			break
		}
	}
	if textStart == 0 {
		panic("runtime.text not found")
	}

	// create gosym.Table
	ltable := gosym.NewLineTable(pclntab, textStart)
	table,err := gosym.NewTable(nil, ltable)
	if err != nil {
		panic(err)
	}

	for _, fn := range table.Funcs {
		pkgName := fn.PackageName()
		if strings.Contains(pkgName, "*") {
			fmt.Printf("FnName: %s\nPackageGot:%s\n", fn.Name, fn.PackageName())
		}
	}
}
```

### What did you see happen?

With the script above, I get the follow output
```
FnName: ariga.io/atlas/sql/sqlclient.(*Tx).database/sql.grabConn
PackageGot:ariga.io/atlas/sql/sqlclient.(*Tx).database/sql
FnName: ariga.io/atlas/sql/sqlclient.(*Tx).database/sql.txCtx
PackageGot:ariga.io/atlas/sql/sqlclient.(*Tx).database/sql
FnName: github.com/ZNotify/server/app/api/common.(*Context).github.com/gin-gonic/gin.reset
PackageGot:github.com/ZNotify/server/app/api/common.(*Context).github.com/gin-gonic/gin
```

### What did you expect to see?

The correct package for these names should be
```
ariga.io/atlas/sql/sqlclient
ariga.io/atlas/sql/sqlclient
github.com/ZNotify/server/app/api/common
```