From: Cherry Mui Date: Thu, 3 Nov 2022 16:21:58 +0000 (-0400) Subject: cmd/objdump: skip PIE test when cgo is disabled and PIE needs external linking X-Git-Tag: go1.20rc1~441 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=1f65c399befa37e6727bb1a1a40aca65c4b6bcc4;p=gostls13.git cmd/objdump: skip PIE test when cgo is disabled and PIE needs external linking On some platforms, building PIE needs external linking, which cannot run if cgo is not available. Change-Id: I6d504aed0f0442cda0355d0beac606ad365e2046 Reviewed-on: https://go-review.googlesource.com/c/go/+/447616 Reviewed-by: Than McIntosh Run-TryBot: Cherry Mui TryBot-Result: Gopher Robot --- diff --git a/src/cmd/objdump/objdump_test.go b/src/cmd/objdump/objdump_test.go index fa6a1b9a68..b747d0d542 100644 --- a/src/cmd/objdump/objdump_test.go +++ b/src/cmd/objdump/objdump_test.go @@ -290,6 +290,10 @@ func TestDisasmPIE(t *testing.T) { if !platform.BuildModeSupported("gc", "pie", runtime.GOOS, runtime.GOARCH) { t.Skipf("skipping on %s/%s, PIE buildmode not supported", runtime.GOOS, runtime.GOARCH) } + if !platform.InternalLinkPIESupported(runtime.GOOS, runtime.GOARCH) { + // require cgo on platforms that PIE needs external linking + testenv.MustHaveCGO(t) + } t.Parallel() testDisasm(t, "fmthello.go", false, false, "-buildmode=pie") }