Skip to content

test,build: replace lowRISC/crt with llvm-mingw and test Win32 ATE DLL - #328

Merged
willyzha merged 1 commit into
lowRISC:mainfrom
willyzha:win32-llvm-mingw
Sep 19, 2026
Merged

willyzha merged 1 commit into
lowRISC:mainfrom
willyzha:win32-llvm-mingw

Conversation

@willyzha

Copy link
Copy Markdown
Collaborator

Replace the 2022 lowRISC/crt MXE GCC 11.3.0 toolchain and its vendored Starlark framework in third_party/crt/ with a standalone llvm-mingw (Clang/LLD) toolchain in third_party/llvm_mingw/, and add automated containerized Wine tests that execute the shipped Windows ATE DLL.

Why replace lowRISC/crt:

  • GCC 11.3.0 (32-bit SJLJ exceptions) miscompiled gRPC's ServiceConfigParser::Builder::RegisterParser() at -O1 and above, causing CreateClient() to fault with 0xC0000005 before any connection attempt. Moving to llvm-mingw (Clang/LLD) eliminates this compiler bug at the root cause without requiring per-file compiler flag workarounds.
  • lowRISC/crt never defined -DNDEBUG in fastbuild or opt modes, shipping Abseil's mutex deadlock detector in Windows release binaries.
  • Linking libc++, libunwind, and winpthread statically (-static) into Windows artifacts produces a single self-contained ate.dll (shrinking from 22 MB to 15 MB) that depends only on standard Windows OS DLLs. This allows replacing pkg_win.py (~220 lines of PE header parsing via objdump) with a standard pkg_zip rule and deleting all 1,675 lines of third_party/crt/.

New test coverage:

  • src/ate/test_programs/ate_dll_smoke.cc: Win32 harness that loads ate.dll via LoadLibrary/GetProcAddress, exercises CreateClient() in both insecure and mTLS modes, and optionally runs InitSession() / CloseSession() against a live Provisioning Appliance.
  • src/ate/test_programs/run_ate_dll_smoke_test.sh: Hermetic Bazel sh_test (//src/ate/test_programs:ate_dll_smoke_test) running the Win32 harness inside a Debian + Wine container.
  • tests/run_ate_dll_test.sh: End-to-end integration test driving a full session from the containerized Win32 ATE DLL against a live PA over an isolated container network namespace.
  • .github/workflows/main.yml: Run the Win32 ATE DLL smoke test in build_and_test and integration tests in integration_tests.

Comment thread src/ate/test_programs/BUILD.bazel Outdated
Replace the legacy lowRISC/crt MXE GCC 11.3.0 toolchain and its vendored
Starlark rules in third_party/crt/ with llvm-mingw (Clang/LLD targeting
i686-w64-mingw32-msvcrt), and add containerized Wine tests for ate.dll.

Key changes:
- Fix Win32 gRPC crash: GCC 11.3.0 (SJLJ exceptions) miscompiled
  gRPC's ServiceConfigParser::Builder::RegisterParser() at -O1/-O2,
  causing CreateClient() to fault with 0xC0000005. Building with
  llvm-mingw (DWARF unwinding) resolves this compiler bug cleanly.
- Self-contained DLL: Statically link libc++, libunwind, and winpthread
  into ate.dll so it depends only on standard Windows OS DLLs
  (msvcrt.dll, KERNEL32.dll, WS2_32.dll, CRYPT32.dll). This eliminates
  companion MinGW runtime DLLs and allows deleting pkg_win.py and all
  1,675 lines of third_party/crt/.
- ABI & release hardening: Enable -mstackrealign for 32-bit MSVC/LabVIEW
  caller stack compatibility (4-byte vs 16-byte stack alignment) and
  define -DNDEBUG in non-debug builds.
- Automated Wine test suite: Add a Win32 test harness (ate_dll_smoke.cc)
  that loads ate.dll via LoadLibrary/GetProcAddress and exercises
  CreateClient(), InitSession(), and CloseSession() under Wine in both
  unit tests (//src/ate/test_programs:ate_dll_smoke_test) and live PA
  integration tests (tests/run_ate_dll_test.sh).
@willyzha
willyzha merged commit a53f3bc into lowRISC:main Sep 19, 2026
3 checks passed
@willyzha
willyzha deleted the win32-llvm-mingw branch September 20, 2026 02:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants