Pass large ldflags to cgo via response file instead of env variable. (#4386)
**What type of PR is this?**
Bug fix
**What does this PR do? Why is it needed?**
Pass ldflags to cgo tool via a response file instead of `CGO_LDFLAGS`
env variable for go 1.23+. This avoids the "argument list too long"
error, which can happen if `CGO_LDFLAGS` is so large that it exceeds the
system limits.
Support to accept ldflags via file was added to `go` more than a year
ago. References:
- https://go-review.googlesource.com/c/go/+/584655
- Discussion: https://github.com/golang/go/issues/66456
**Which issues(s) does this PR fix?**
Fixes #2654
---------
Co-authored-by: Dhiraj Goel <dhirajgoel@intrinsic.ai>
Co-authored-by: Jay Conrod <jay@engflow.com>
2 files changed