Skip to content

Commit

Permalink
cmd/go: skip gccgo_link_c when cross-compiling
Browse files Browse the repository at this point in the history
I don't understand the rationale given in
https://git.alpinelinux.org/aports/commit/community/go/tests-unset-GCCGO.patch?id=a10e9a5e48507198e26a8cf19709e4059da4c79f,
but I suspect that it may be working around test failures when
cross-compiling, since we have a lot of other gccgo tests that need to
skip in that circumstance.

Alternatively, that may just be a stale patch working around #53815.
I can't fine any issue filed against the Go project for this patch,
so it's hard to be sure.

Either way, adding this skip should make the test more robust.

For #62053.

Change-Id: I44dbe9a5a24c0e2d3f22fbe6ca995160a36b2606
Reviewed-on: https://go-review.googlesource.com/c/go/+/520056
TryBot-Result: Gopher Robot <[email protected]>
Reviewed-by: Michael Matloob <[email protected]>
Run-TryBot: Bryan Mills <[email protected]>
  • Loading branch information
Bryan C. Mills committed Aug 16, 2023
1 parent 390763a commit 9049d77
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/cmd/go/testdata/script/gccgo_link_c.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

[!cgo] skip
[!exec:gccgo] skip
[cross] skip # gccgo can't necessarily cross-compile, so don't assume it will reach the step where we expect it to fail

! go build -x -compiler gccgo
stderr 'gccgo.*\-L [^ ]*alibpath \-lalib' # make sure that Go-inline "#cgo LDFLAGS:" ("-L alibpath -lalib") passed to gccgo linking stage
Expand Down

2 comments on commit 9049d77

@nmeum
Copy link

@nmeum nmeum commented on 9049d77 Feb 7, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello, author of the Alpine patch here 👋 The rationale for the patch is described here: https://github.com/alpinelinux/aports/blob/v3.19.1/community/go/APKBUILD#L248-L256

tl;dr this is a work around for -buildmode-c-archive, -buildmode=c-shared etc being broken on musl.

@ianlancetaylor
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nmeum We use Gerrit for code review, and few people see comments on GitHub comments. Would you mind commenting instead on https://go-review.googlesource.com/c/go/+/520056? Thanks.

Please sign in to comment.