cmd/go: don't collect package CGOLDFLAGS when using gccgo
commit4e9ed68ee7ef2c80dcfd038c54e937646cc0ece2
authorIan Lance Taylor <iant@golang.org>
Thu, 20 Jul 2023 18:21:13 +0000 (20 11:21 -0700)
committerIan Lance Taylor <iant@golang.org>
Thu, 20 Jul 2023 19:29:11 +0000 (20 12:29 -0700)
tree13f70efcee22822bd2e62e4594f088a833421917
parentb50a851eef4b70aabf28fa875d9b2a302d17b66a
cmd/go: don't collect package CGOLDFLAGS when using gccgo

They are already collected via cmd/cgo.

The gccgo_link_c test is tweaked to do real linking as with this
change the cgo ldflags are not fully reflected in go build -n output,
since they now only come from the built archive.

This is a backport of https://go.dev/cl/497117 from the main repo.

For golang/go#60287

Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/511675
gcc/go/gofrontend/MERGE
libgo/go/cmd/go/internal/work/gccgo.go
libgo/go/cmd/go/testdata/script/gccgo_link_c.txt