From 3bf645a6338d0699116f58f5ae5b0f2a0f0dca65 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Mon, 12 Apr 2021 17:30:36 -0700 Subject: [PATCH] cmd/link: force external linking for DragonFly cgo programs Change-Id: Idce4eec2a4698a94aa7b40590dffb6bf9bd45342 Reviewed-on: https://go-review.googlesource.com/c/go/+/309571 Trust: Ian Lance Taylor Run-TryBot: Ian Lance Taylor TryBot-Result: Go Bot Reviewed-by: Tobias Klauser --- src/cmd/link/internal/ld/config.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/cmd/link/internal/ld/config.go b/src/cmd/link/internal/ld/config.go index 291b28e11c2..9228962fb33 100644 --- a/src/cmd/link/internal/ld/config.go +++ b/src/cmd/link/internal/ld/config.go @@ -199,7 +199,10 @@ func mustLinkExternal(ctxt *Link) (res bool, reason string) { if iscgo && ctxt.Arch.InFamily(sys.MIPS64, sys.MIPS, sys.PPC64, sys.RISCV64) { return true, objabi.GOARCH + " does not support internal cgo" } - if iscgo && objabi.GOOS == "android" { + if iscgo && (objabi.GOOS == "android" || objabi.GOOS == "dragonfly") { + // It seems that on Dragonfly thread local storage is + // set up by the dynamic linker, so internal cgo linking + // doesn't work. Test case is "go test runtime/cgo". return true, objabi.GOOS + " does not support internal cgo" }