]> Cypherpunks repositories - gostls13.git/commit
cmd/link: support MSVC clang
authorCherry Mui <cherryyz@google.com>
Thu, 11 Sep 2025 21:42:30 +0000 (17:42 -0400)
committerCherry Mui <cherryyz@google.com>
Fri, 12 Sep 2025 14:30:16 +0000 (07:30 -0700)
commitc70713da823ab83451ef52176fb250419a9688c7
treea51c4d930f478e81aaf1a46167f35ca211a2e707
parent9271bbbb802f0d5863b78cbac38292321a5b0833
cmd/link: support MSVC clang

Currently on Windows, for cgo, we support MinGW-based C toolchain,
that is, with a -windows-gnu target. This CL makes it work with
clang with a -windows-msvc target. The LLVM toolchain bundled in
MSVC (https://learn.microsoft.com/en-us/cpp/build/clang-support-msbuild)
is such an example.

Currently it is expecting lld-link as the C linker, which is also
bundled in MSVC, can be requested with -fuse-ld=lld, but is not
the default.

This is the first step, which makes it generate a working cgo
binary. There are still more work to do, e.g. there are some
linker warnings, and the binary doesn't have symbol table.
all.bat doesn't pass with this setting.

Change-Id: I54d33f7dd5f5eeeafa0735cd52f4127fe4865636
Reviewed-on: https://go-review.googlesource.com/c/go/+/703055
Reviewed-by: Than McIntosh <thanm@golang.org>
Reviewed-by: Florian Zenker <floriank@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
src/cmd/link/internal/ld/lib.go