cmd/go, cmd/cgo: update gofrontend mangling checks
This is a port of two patches in the master repository.
https://golang.org/cl/259298
cmd/cgo: split gofrontend mangling checks into cmd/internal/pkgpath
This is a step toward porting https://golang.org/cl/219817 from the
gofrontend repo to the main repo.
Note that this also corrects the implementation of the v2 mangling
scheme to use ..u and ..U where appropriate.
https://golang.org/cl/259299
cmd/go: use cmd/internal/pkgpath for gccgo pkgpath symbol
For golang/go#37272
For golang/go#41862
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/270637