Stage2 LLVM verifier: “Global is external, but doesn’t have external or weak linkage!” when running zig test

Environment

  • Zig 0.16.0-dev.1265+bdbfc7de3 and 0.16.0-dev.1272+f3309a96a (macOS arm64)
  • Our project builds and runs fine on older toolchains (e.g. dev.238), but after switching to the new std.Io networking API stage2 now aborts during zig test.

Repro

The failure happens in multiple test modules; here’s the first one:

$ tools/zig-aarch64-macos-0.16.0-dev.1272+f3309a96a/zig test
-ODebug
-I tests
–dep zig_quic
–dep test_support
-Mroot=tests/h3_session_test.zig
-cflags -I…/cglue/include …
/Users/…/cglue/src/quic_h3_connection.c … -lc …

error: Global is external, but doesn’t have external or weak linkage!
ptr @“h3_session_test.test.http/3 session initializes for client transport”
LLVM ERROR: Broken module found, compilation aborted!

If we skip that file, the next test compilation fails similarly:

error: Global is external, but doesn’t have external or weak linkage!
ptr @transport.http3_writer.collectDatagrams__anon_22955
ptr @“transport_session_test.test.session tracks stream updates across polls”

So the entire zig build -Dskip-huge-tests=true test step dies before any of our code runs. The same project succeeds on 0.16.0-dev.238.

Questions

  • Is this a known stage2 regression? Any guidance on what triggers the verifier (e.g. a new constraint on extern decls)?
  • Is there a workaround we can apply in our code until stage2 is fixed, or should we keep testing with an older compiler for now?