Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 33 additions & 24 deletions .github/actions/setup-deps/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,10 @@ runs:
if: runner.os == 'Windows' && inputs.install-llvm == 'true' && inputs.windows-abi == 'msvc'
uses: actions/cache@v6
with:
# All MSVC profiles use the same x64 host LLVM. Cache its compressed
# immutable input once instead of three 1.2 GiB extracted trees; the
# target-specific builtins and LLDB remain in the caches below.
path: ${{ runner.tool_cache }}\llgo-llvm-archives\clang+llvm-22.1.8-x86_64-pc-windows-msvc.tar.xz
key: llgo-llvm-archive-22.1.8-x86_64-pc-windows-msvc-d96c2cc1736f4eb7fa43cb9bbdf56d93551a9ae0a9aadb9c99c3c3b2b712a234
# Cache the host architecture's full LLVM archive: x64 on windows-2022
# and native ARM64 on windows-11-arm.
path: ${{ runner.tool_cache }}\llgo-llvm-archives\${{ runner.arch == 'ARM64' && 'clang+llvm-22.1.8-aarch64-pc-windows-msvc.tar.xz' || 'clang+llvm-22.1.8-x86_64-pc-windows-msvc.tar.xz' }}
key: ${{ runner.arch == 'ARM64' && 'llgo-llvm-archive-22.1.8-aarch64-pc-windows-msvc-de718c58ebbc5f61d58c17b90457fcf42983bc2c4a4aba3e010d108713bfd7f1' || 'llgo-llvm-archive-22.1.8-x86_64-pc-windows-msvc-d96c2cc1736f4eb7fa43cb9bbdf56d93551a9ae0a9aadb9c99c3c3b2b712a234' }}

- name: Install full-target Windows LLVM
if: runner.os == 'Windows' && inputs.install-llvm == 'true' && inputs.windows-abi == 'msvc'
Expand All @@ -52,14 +51,20 @@ runs:
# Clang, LLD, and the WebAssembly backend required by LLGo's Windows
# host and WASI cross-compilation paths.
LLVM_VERSION: "22.1.8"
LLVM_ARCHIVE_SHA256: d96c2cc1736f4eb7fa43cb9bbdf56d93551a9ae0a9aadb9c99c3c3b2b712a234
run: |
$ErrorActionPreference = "Stop"
if ("${{ inputs.llvm-version }}" -ne "22") {
throw "Unsupported Windows LLVM version: ${{ inputs.llvm-version }}"
}

$archiveName = "clang+llvm-$env:LLVM_VERSION-x86_64-pc-windows-msvc.tar.xz"
$hostArch = if ($env:RUNNER_ARCH -eq "ARM64") { "aarch64" } else { "x86_64" }
$expectedSha256 = if ($env:RUNNER_ARCH -eq "ARM64") {
"de718c58ebbc5f61d58c17b90457fcf42983bc2c4a4aba3e010d108713bfd7f1"
} else {
"d96c2cc1736f4eb7fa43cb9bbdf56d93551a9ae0a9aadb9c99c3c3b2b712a234"
}

$archiveName = "clang+llvm-$env:LLVM_VERSION-$hostArch-pc-windows-msvc.tar.xz"
$archiveParent = Join-Path $env:RUNNER_TOOL_CACHE "llgo-llvm-archives"
$archive = Join-Path $archiveParent $archiveName
New-Item -ItemType Directory -Force $archiveParent | Out-Null
Expand All @@ -72,13 +77,13 @@ runs:
}
}
$actual = (Get-FileHash -Algorithm SHA256 $archive).Hash
if (-not $actual.Equals($env:LLVM_ARCHIVE_SHA256, [StringComparison]::OrdinalIgnoreCase)) {
throw "LLVM archive SHA-256 is $actual, want $env:LLVM_ARCHIVE_SHA256"
if (-not $actual.Equals($expectedSha256, [StringComparison]::OrdinalIgnoreCase)) {
throw "LLVM archive SHA-256 is $actual, want $expectedSha256"
}

$extractParent = Join-Path $env:RUNNER_TEMP "llgo-llvm-extract"
$installParent = Join-Path $env:RUNNER_TOOL_CACHE "llgo-llvm"
$installRoot = Join-Path $installParent "clang+llvm-$env:LLVM_VERSION-x86_64-pc-windows-msvc"
$installRoot = Join-Path $installParent "clang+llvm-$env:LLVM_VERSION-$hostArch-pc-windows-msvc"
$sevenZip = Join-Path $env:ProgramFiles "7-Zip\7z.exe"
if (-not (Test-Path $sevenZip)) {
throw "7-Zip was not found at $sevenZip"
Expand Down Expand Up @@ -278,7 +283,11 @@ runs:
run: |
$ErrorActionPreference = "Stop"

$llvmRoot = Join-Path $env:RUNNER_TOOL_CACHE "llgo-llvm\clang+llvm-$env:LLVM_VERSION-x86_64-pc-windows-msvc"
$hostArch = if ($env:RUNNER_ARCH -eq "ARM64") { "aarch64" } else { "x86_64" }
$hostTriple = if ($env:RUNNER_ARCH -eq "ARM64") { "aarch64-pc-windows-msvc" } else { "x86_64-pc-windows-msvc" }
$hostGoArch = if ($env:RUNNER_ARCH -eq "ARM64") { "arm64" } else { "amd64" }

$llvmRoot = Join-Path $env:RUNNER_TOOL_CACHE "llgo-llvm\clang+llvm-$env:LLVM_VERSION-$hostArch-pc-windows-msvc"
if (-not (Test-Path (Join-Path $llvmRoot "bin\llvm-config.exe"))) {
throw "The full-target LLVM installation is incomplete: $llvmRoot"
}
Expand All @@ -297,13 +306,13 @@ runs:
throw "The native pkgconf executable was not installed at $pkgconf"
}

# LLGo itself and the LLVM Go bindings are x64 host programs even when
# LLGo itself and the LLVM Go bindings are host programs even when
# this job will later execute ARM64 or 386 output. Target SDK variables
# are activated only after the host compiler has been installed.
$null = Enter-LLGoVisualStudio2022 -GoArch "amd64"
$null = Enter-LLGoVisualStudio2022 -GoArch $hostGoArch

# Clang emits the MSVC ABI but uses the SDK/UCRT selected by the
# Visual Studio developer environment. Persist the x64 host search
# Visual Studio developer environment. Persist the host search
# variables and tools used to build the LLGo compiler itself.
Export-LLGoVisualStudioEnvironment
# Enter-VsDevShell only updates this action process. Export the native
Expand Down Expand Up @@ -386,7 +395,7 @@ runs:
}
$llvmIncludeDir = Join-Path $llvmRoot "include"
& (Join-Path $llvmBin "clang++.exe") `
--target=x86_64-pc-windows-msvc `
--target=$hostTriple `
-fuse-ld=lld `
-fms-runtime-lib=static `
-std=c++17 `
Expand Down Expand Up @@ -449,10 +458,10 @@ runs:
# The upstream LLVM 22 development archive builds its static libraries
# against the static MSVC runtime. Match it in FileCheck and all host
# cgo objects so lld-link sees one RuntimeLibrary directive.
Add-Content -Encoding utf8 $env:GITHUB_ENV "CC=clang --target=x86_64-pc-windows-msvc -fuse-ld=lld -fms-runtime-lib=static"
Add-Content -Encoding utf8 $env:GITHUB_ENV "CXX=clang++ --target=x86_64-pc-windows-msvc -fuse-ld=lld -fms-runtime-lib=static -std=c++17"
Add-Content -Encoding utf8 $env:GITHUB_ENV "LLGO_WINDOWS_HOST_CC=clang --target=x86_64-pc-windows-msvc -fuse-ld=lld -fms-runtime-lib=static"
Add-Content -Encoding utf8 $env:GITHUB_ENV "LLGO_WINDOWS_HOST_CXX=clang++ --target=x86_64-pc-windows-msvc -fuse-ld=lld -fms-runtime-lib=static -std=c++17"
Add-Content -Encoding utf8 $env:GITHUB_ENV "CC=clang --target=$hostTriple -fuse-ld=lld -fms-runtime-lib=static"
Add-Content -Encoding utf8 $env:GITHUB_ENV "CXX=clang++ --target=$hostTriple -fuse-ld=lld -fms-runtime-lib=static -std=c++17"
Add-Content -Encoding utf8 $env:GITHUB_ENV "LLGO_WINDOWS_HOST_CC=clang --target=$hostTriple -fuse-ld=lld -fms-runtime-lib=static"
Add-Content -Encoding utf8 $env:GITHUB_ENV "LLGO_WINDOWS_HOST_CXX=clang++ --target=$hostTriple -fuse-ld=lld -fms-runtime-lib=static -std=c++17"
Add-Content -Encoding utf8 $env:GITHUB_ENV "CGO_ENABLED=1"
Add-Content -Encoding utf8 $env:GITHUB_ENV "LLGO_WINDOWS_TARGET_TRIPLE=$($target.Triple)"
Add-Content -Encoding utf8 $env:GITHUB_ENV "LLGO_WINDOWS_VCPKG_TRIPLET=$($target.VcpkgTriplet)"
Expand Down Expand Up @@ -483,21 +492,21 @@ runs:
throw "LLVM lacks the WebAssembly backend required by Windows-host cross-compilation: $targetsBuilt"
}
$defaultTarget = (& (Join-Path $llvmBin "clang.exe") -dumpmachine).Trim()
if ($defaultTarget -ne "x86_64-pc-windows-msvc") {
throw "Standalone Clang defaults to $defaultTarget, want x86_64-pc-windows-msvc"
if ($defaultTarget -ne $hostTriple) {
throw "Standalone Clang defaults to $defaultTarget, want $hostTriple"
}
$builtins = (& (Join-Path $llvmBin "clang.exe") --target=x86_64-pc-windows-msvc --rtlib=compiler-rt -print-libgcc-file-name).Trim()
$builtins = (& (Join-Path $llvmBin "clang.exe") --target=$hostTriple --rtlib=compiler-rt -print-libgcc-file-name).Trim()
if (-not (Test-Path $builtins)) {
throw "Clang's MSVC compiler-rt builtins were not found at $builtins"
}
$targetBuiltins = (& (Join-Path $llvmBin "clang.exe") "--target=$($target.Triple)" --rtlib=compiler-rt -print-libgcc-file-name).Trim()
if ($target.GoArch -ne "amd64" -and -not (Test-Path $targetBuiltins)) {
if ($target.Triple -ne $hostTriple -and -not (Test-Path $targetBuiltins)) {
$builtinsArch = if ($target.GoArch -eq "arm64") { "aarch64" } else { "i386" }
$cachedBuiltins = Join-Path $env:RUNNER_TOOL_CACHE "llgo-windows-support\$env:LLVM_TARGET_VERSION\$($target.GoArch)\clang_rt.builtins-$builtinsArch.lib"
if (-not (Test-Path $cachedBuiltins)) {
throw "The cached Windows $($target.GoArch) compiler-rt builtins were not found at $cachedBuiltins"
}
# Let the x64 host Clang driver discover the target library through
# Let the host Clang driver discover the target library through
# its normal resource-dir lookup, exactly as it does for x86/x64.
New-Item -ItemType Directory -Force (Split-Path $targetBuiltins) | Out-Null
Copy-Item -LiteralPath $cachedBuiltins -Destination $targetBuiltins
Expand Down
3 changes: 2 additions & 1 deletion .github/windows/msvc-target.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,10 @@ function Enter-LLGoVisualStudio2022 {
$target = Get-LLGoWindowsMSVCTarget -GoArch $GoArch
$installPath = Find-LLGoVisualStudio2022 -GoArch $GoArch
Import-Module "$installPath\Common7\Tools\Microsoft.VisualStudio.DevShell.dll"
$hostArch = if ($env:RUNNER_ARCH -eq "ARM64") { "arm64" } else { "x64" }
Enter-VsDevShell -VsInstallPath $installPath `
-SkipAutomaticLocation `
-DevCmdArguments "-arch=$($target.VisualStudio) -host_arch=x64"
-DevCmdArguments "-arch=$($target.VisualStudio) -host_arch=$hostArch"
return $target
}

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:
display: Windows MSVC ARM64
windows_abi: msvc
windows_arch: arm64
host_go_arch: x64
host_go_arch: arm64
timeout: 120
- os: windows-11-arm
id: windows-mingw-arm64
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/goroot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ jobs:
- name: Set up Go for building LLGo and the runner
uses: ./.github/actions/setup-go
with:
architecture: ${{ matrix.os == 'windows-11-arm' && matrix.windows_abi == 'mingw' && 'arm64' || startsWith(matrix.os, 'windows') && 'x64' || '' }}
architecture: ${{ matrix.os == 'windows-11-arm' && 'arm64' || startsWith(matrix.os, 'windows') && 'x64' || '' }}

- name: Build LLGo and the GOROOT runner
id: build-tools
Expand Down Expand Up @@ -116,7 +116,7 @@ jobs:
uses: ./.github/actions/setup-go
with:
go-version: ${{ steps.target-go.outputs.version }}
architecture: ${{ matrix.os == 'windows-11-arm' && matrix.windows_abi == 'mingw' && 'arm64' || startsWith(matrix.os, 'windows') && 'x64' || '' }}
architecture: ${{ matrix.os == 'windows-11-arm' && 'arm64' || startsWith(matrix.os, 'windows') && 'x64' || '' }}

- name: Select target GOROOT
shell: bash
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/llgo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ jobs:
llvm: 22
windows_abi: msvc
windows_arch: arm64
host_go_arch: x64
host_go_arch: arm64
shard_total: "2"
- os: windows-11-arm
llvm: 22
Expand Down Expand Up @@ -480,7 +480,7 @@ jobs:
shard_total: "2"
windows_abi: msvc
windows_arch: arm64
host_go_arch: x64
host_go_arch: arm64
runs-on: ${{ github.repository_owner == 'xgo-dev' && matrix.runner || matrix.os }}
steps:
- uses: actions/checkout@v7
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/release-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -171,9 +171,8 @@ jobs:
- name: Set up Go
uses: ./.github/actions/setup-go
with:
# MSVC uses the x64 bootstrap Clang, with architecture-matched LLVM
# libraries and SDK for the resulting llgo.exe. MinGW builds natively.
architecture: ${{ matrix.abi == 'mingw' && matrix.goarch == 'arm64' && 'arm64' || 'x64' }}
# On windows-11-arm, both MinGW and MSVC build natively.
architecture: ${{ matrix.os == 'windows-11-arm' && 'arm64' || 'x64' }}
- name: Cache ARM64 MSVC release SDK archive
if: matrix.abi == 'msvc' && matrix.goarch == 'arm64'
uses: actions/cache@v6
Expand Down
47 changes: 31 additions & 16 deletions test/goroot/xfail.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ timeouts:
case: fixedbugs/issue79186.go
timeout: 90s
reason: the 51.2 million-operation RWMutex stress loop needs load-dependent runtime slack
- platform: windows/386
directive: run
case: fixedbugs/issue79186.go
timeout: 90s
reason: the 51.2 million-operation RWMutex stress loop needs load-dependent runtime slack
- version: go1.26
platform: darwin/arm64
directive: run
Expand All @@ -53,14 +58,12 @@ timeouts:
case: abi/uglyfib.go
timeout: 1m
reason: uglyfib runs close to the default timeout on loaded linux/amd64 runners
- version: go1.27
platform: windows/386
- platform: windows/386
directive: run
case: abi/uglyfib.go
timeout: 90s
reason: uglyfib can exceed the default timeout on loaded Windows 386 runners
- version: go1.27
platform: windows/386
- platform: windows/386
Comment thread
cpunion marked this conversation as resolved.
directive: runoutput
case: index0.go
timeout: 90s
Expand All @@ -75,6 +78,16 @@ timeouts:
case: fixedbugs/issue25897a.go
timeout: 90s
reason: the single-P continuous-GC loop needs load-dependent runtime slack on Windows 386
- platform: windows/386
directive: run
case: fixedbugs/issue30041.go
timeout: 90s
reason: the continuous-GC and reflect.MakeFunc stress loop needs load-dependent runtime slack on Windows 386
- platform: windows/386
directive: run
case: fixedbugs/issue39541.go
timeout: 90s
reason: the one-million reflect.MakeFunc concurrent call loop needs load-dependent runtime slack on Windows 386
- version: go1.26
platform: darwin/arm64
directive: runoutput
Expand All @@ -96,6 +109,10 @@ flakes:
directive: run
case: fixedbugs/issue79186.go
reason: the RWMutex stress test passes when the host is idle but can exceed its timeout under sustained CPU contention
- platform: windows/386
directive: run
case: fixedbugs/issue79186.go
reason: the RWMutex stress test passes when the host is idle but can exceed its timeout under sustained CPU contention
- version: go1.26
platform: linux/amd64
directive: run
Expand Down Expand Up @@ -152,16 +169,22 @@ flakes:
directive: run
case: fixedbugs/issue25897a.go
reason: reflect-generated goroutines under a single-P continuous-GC loop can complete or exceed the run timeout on Windows 386
- version: go1.27
platform: windows/386
- platform: windows/386
directive: run
case: abi/uglyfib.go
reason: uglyfib can complete or exceed its run timeout on a loaded Windows 386 runner
- version: go1.27
platform: windows/386
- platform: windows/386
directive: runoutput
case: index0.go
reason: the generated index stress program can pass, time out, or fail during LLVM target object emission on Windows 386
- platform: windows/386
directive: run
case: fixedbugs/issue30041.go
reason: the continuous-GC and reflect.MakeFunc stress loop can complete or exceed its run timeout on loaded Windows 386 runners
- platform: windows/386
directive: run
case: fixedbugs/issue39541.go
reason: the one-million reflect.MakeFunc concurrent call loop can complete or exceed its run timeout on loaded Windows 386 runners
xfails:
- platform: darwin/arm64
directive: runoutput
Expand All @@ -179,9 +202,6 @@ xfails:
directive: runoutput
case: rangegen.go
reason: the current golang.org/x/tools/go/ssa dependency mishandles labeled branches in generated range-over-function code; update x/tools after https://github.com/golang/tools/pull/666 lands
- directive: run
case: fixedbugs/issue80196.go
reason: LLGo overflows its native stack while repeatedly assigning the escaped named result in this test
- directive: run
case: genmeth1.go
reason: the current go/types and x/tools SSA path panics while instantiating the new generic-method test
Expand All @@ -201,11 +221,6 @@ xfails:
directive: run
case: fixedbugs/issue58300.go
reason: LLGo emits unexpected runtime output for the unsafe string conversion test on Windows amd64
- version: go1.27
platform: windows/amd64
directive: run
case: fixedbugs/issue75764.go
reason: LLGo does not eliminate the deep interface tail-call chain and crashes on Windows amd64
- platform: windows/386
directive: run
case: fixedbugs/bug114.go
Expand Down
Loading