]> Cypherpunks repositories - gostls13.git/commit
[dev.cmdgo] cmd/link: fix TestBuildForTvOS
authorJay Conrod <jayconrod@google.com>
Thu, 12 Aug 2021 21:33:58 +0000 (14:33 -0700)
committerJay Conrod <jayconrod@google.com>
Thu, 12 Aug 2021 22:21:00 +0000 (22:21 +0000)
commite2e1987b31a587bdb67856954ae9279721b3bba7
treeeb6dcf5d8946ddf08b5d655fd72c44c672a22311
parentd397fc1169aa2491bc807812105371819366deb8
[dev.cmdgo] cmd/link: fix TestBuildForTvOS

This test was broken in CL 334732 on darwin.

The test invokes 'go build' with a CC containing the arguments
-framework CoreFoundation. Previously, the go command split CC on
whitespace, and inserted the arguments after the command line when
running CC directly. Those arguments weren't passed to cgo though,
so cgo ran CC without -framework CoreFoundation (or any of the other
flags).

In CL 334732, we pass CC through to cgo, and cgo splits arguments
using str.SplitQuotedFields. So -framework CoreFoundation actually
gets passed to the C compiler. It appears that -framework flags are
only meant to be used in linking operations, so when cgo invokes clang
with -E (run preprocessor only), clang emits an error that -framework
is unused.

This change fixes the test by moving -framework CoreFoundation out of
CC and into CGO_LDFLAGS.

Change-Id: Ie884c3c0d8bea21fad57f325d19989ad39de7204
Reviewed-on: https://go-review.googlesource.com/c/go/+/341929
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Trust: Jay Conrod <jayconrod@google.com>
src/cmd/link/link_test.go