Skip to content

fix(lto): reject malformed interface metadata without aborting - #2562

Merged
cpunion merged 1 commit into
xgo-dev:mainfrom
cpunion:codex/fix-lto-invalid-metadata-exit-20260911
Sep 14, 2026
Merged

cpunion merged 1 commit into
xgo-dev:mainfrom
cpunion:codex/fix-lto-invalid-metadata-exit-20260911

Conversation

@cpunion

@cpunion cpunion commented Sep 11, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Reject malformed interface metadata with LLVM 22's reportFatalUsageError, retaining the fatal diagnostic and exit status 1 without invoking abort-time crash reporting or symbolization. Valid IR and method reachability are unchanged.

The existing negative test now requires normal exit 1, not just any failure containing the expected message. Bound each opt invocation to 30 seconds and pipe cleanup to one second, so a stuck subprocess fails locally instead of consuming the entire package's 30-minute timeout. No test is skipped and no existing timeout is increased.

Rebased onto current main 5c5874359. Main now contains the Linux descendant-probe corrections, so Git dropped both obsolete prerequisite commits and this PR again contains only the core malformed-LTO-metadata fix. The focused TestLTOPluginRejectsMalformedInterfaceAttributes test passes locally against the rebased head; fresh CI is running.

Evidence and validation

  • The #2541 Linux LTO job spent 28m52s waiting in the first malformed-metadata case before the package timed out. This path is identical on main and unrelated to the WASI heap change. The job log does not expose the exact OS/symbolizer state of the stuck opt; this PR does not claim that missing detail is proven.
  • With LLVM 22.1.8, the strengthened test fails all three malformed cases before the implementation change: the subprocess terminates by SIGABRT and emits a crash backtrace. Afterward, the same cases exit 1 with the original diagnostic. Twenty repetitions of both positive type-ID transformation and negative metadata cases pass locally with the dev tag and a freshly built plugin.
  • LLVM's implementation explicitly distinguishes fatal usage errors (exit(1)) from fatal internal errors (abort()). Use the former for rejected input instead of depending on crash handling for an expected test outcome.
  • The existing Linux dev-LTO and macOS LTO jobs execute these tests; no extra workflow or SDK is added. At head d4791e94e, all six jobs in the fork Go workflow and Format Check pass, including Linux/macOS LTO and Linux/macOS/Windows MSVC/MinGW coverage suites. Unrelated fork workflows were cancelled to conserve runner capacity. The production Wasm/runtime code is untouched.

@fennoai fennoai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review: fix LTO invalid-metadata exit behavior

The change is clean, well-scoped, and correct. Swapping report_fatal_error for reportFatalUsageError in the malformed-input rejection path is the right hardening: it takes the exit(1) path (GenCrashDiag=false) instead of abort(), so invalid IR metadata is rejected as a usage error without invoking crash reporters/symbolizers. The API is valid on the required LLVM 22 toolchain, and the inline comment accurately describes the new behavior.

The test rewrite is a solid improvement — exec.CommandContext with a 30s timeout + cmd.WaitDelay guards against a hang, and the assertions now verify three distinct things (process terminated, exit code exactly 1, expected diagnostic present) rather than merely "not accepted".

Verified:

  • Imports (context, time) are added; [[noreturn]] on invalidMetadata is preserved, so callers relying on non-return control flow stay sound.
  • The two remaining report_fatal_error calls in LLGOReflectMethodByNamePass.cpp were correctly left unchanged — they fire on internal invariant violations (eraseGenericCheckedLoad failing), not external input, where a crash report is appropriate.
  • No security or documentation concerns; there is no doc referencing the prior crash behavior.

Only one minor, optional note inline. No blocking issues.

Comment thread cl/compile_test.go
@codecov

codecov Bot commented Sep 11, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@github-actions

github-actions Bot commented Sep 11, 2026 •

Copy link
Copy Markdown

LLGo baseline benchmarks

7312875a25c2 | workflow run | long-term charts

Program measurements

Platform Workload File size vs base Text size vs base Build vs base Run vs base
Linux cprintf 19832 B 0 B / +0.0% 387 B 0 B / +0.0% 533.616 ms -8.967 ms / -1.7% (better) 1.396 ms +20.36 us / +1.5% (worse)
Linux cprintf-lto 19584 B 0 B / +0.0% 368 B 0 B / +0.0% 540.057 ms -19.02 ms / -3.4% (better) 1.301 ms -726.8 us / -35.8% (better)
Linux fmtprintf 1625880 B -8 B / -0.000492% (better) 497962 B 0 B / +0.0% 4.092 s -94.74 ms / -2.3% (better) 3.255 ms +215.2 us / +7.1% (worse)
Linux fmtprintf-lto 1480176 B 0 B / +0.0% 437821 B 0 B / +0.0% 11.495 s -393.6 ms / -3.3% (better) 4.444 ms +1.412 ms / +46.6% (worse)
Linux println 62224 B 0 B / +0.0% 14901 B 0 B / +0.0% 547.467 ms -4.569 ms / -0.8% (better) 1.655 ms -134.5 us / -7.5% (better)
Linux println-lto 54280 B 0 B / +0.0% 12335 B 0 B / +0.0% 802.201 ms -32.38 ms / -3.9% (better) 1.759 ms -22.82 us / -1.3% (better)
macOS cprintf 84480 B 0 B / +0.0% 17101 B 0 B / +0.0% 556.631 ms -5.288 ms / -0.9% (better) 2.892 ms -73.83 us / -2.5% (better)
macOS cprintf-lto 84288 B 0 B / +0.0% 12865 B 0 B / +0.0% 614.014 ms +9.205 ms / +1.5% (worse) 3.367 ms +353.4 us / +11.7% (worse)
macOS fmtprintf 1473168 B 0 B / +0.0% 872012 B 0 B / +0.0% 2.882 s -822.5 ms / -22.2% (better) 5.884 ms -145.7 us / -2.4% (better)
macOS fmtprintf-lto 1159424 B 0 B / +0.0% 847752 B 0 B / +0.0% 8.966 s +4.032 ms / +0.04499% (worse) 4.966 ms -805.5 us / -14.0% (better)
macOS println 114672 B 0 B / +0.0% 34812 B 0 B / +0.0% 548.704 ms -93.1 ms / -14.5% (better) 3.726 ms -156.1 us / -4.0% (better)
macOS println-lto 118720 B 0 B / +0.0% 32248 B 0 B / +0.0% 747.967 ms -468.6 ms / -38.5% (better) 3.642 ms -383.4 us / -9.5% (better)
Windows MinGW cprintf 19456 B 0 B / +0.0% 4550 B 0 B / +0.0% 1.110 s +3.102 ms / +0.3% (worse) 3.447 ms -48.3 us / -1.4% (better)
Windows MinGW cprintf-lto 17920 B 0 B / +0.0% 4486 B 0 B / +0.0% 1.250 s +30.78 ms / +2.5% (worse) 4.087 ms +402.3 us / +10.9% (worse)
Windows MinGW fmtprintf 1895424 B 0 B / +0.0% 601110 B 0 B / +0.0% 4.009 s -35.05 ms / -0.9% (better) 9.357 ms +264.3 us / +2.9% (worse)
Windows MinGW fmtprintf-lto 1936896 B 0 B / +0.0% 550566 B 0 B / +0.0% 10.033 s -113.7 ms / -1.1% (better) 8.426 ms -168.3 us / -2.0% (better)
Windows MinGW println 71168 B 0 B / +0.0% 24054 B 0 B / +0.0% 1.264 s +151.2 ms / +13.6% (worse) 6.986 ms +82.2 us / +1.2% (worse)
Windows MinGW println-lto 65536 B 0 B / +0.0% 20678 B 0 B / +0.0% 1.421 s +101.8 ms / +7.7% (worse) 7.198 ms +454.7 us / +6.7% (worse)
Windows MinGW 386 cprintf 42496 B 0 B / +0.0% 5326 B 0 B / +0.0% 1.103 s +15.8 ms / +1.5% (worse) 4.924 ms -150.6 us / -3.0% (better)
Windows MinGW 386 cprintf-lto 20992 B 0 B / +0.0% 5094 B 0 B / +0.0% 1.115 s +52.85 ms / +5.0% (worse) 4.959 ms -41.5 us / -0.8% (better)
Windows MinGW 386 fmtprintf 1858560 B 0 B / +0.0% 472430 B 0 B / +0.0% 3.865 s +16.77 ms / +0.4% (worse) 10.709 ms -112.5 us / -1.0% (better)
Windows MinGW 386 fmtprintf-lto 2165760 B 0 B / +0.0% 452522 B 0 B / +0.0% 9.544 s +38.2 ms / +0.4% (worse) 10.076 ms -186.2 us / -1.8% (better)
Windows MinGW 386 println 91136 B 0 B / +0.0% 20038 B 0 B / +0.0% 1.075 s +36.11 ms / +3.5% (worse) 8.617 ms -108.5 us / -1.2% (better)
Windows MinGW 386 println-lto 69632 B 0 B / +0.0% 17954 B 0 B / +0.0% 1.272 s +25.01 ms / +2.0% (worse) 8.420 ms -28.3 us / -0.3% (better)
Windows MinGW ARM64 cprintf 18944 B 0 B / +0.0% 4408 B 0 B / +0.0% 1.446 s +14.81 ms / +1.0% (worse) 6.340 ms -88.6 us / -1.4% (better)
Windows MinGW ARM64 cprintf-lto 17920 B 0 B / +0.0% 4340 B 0 B / +0.0% 1.433 s +16.69 ms / +1.2% (worse) 6.014 ms -413.8 us / -6.4% (better)
Windows MinGW ARM64 fmtprintf 1780736 B 0 B / +0.0% 510696 B 0 B / +0.0% 4.205 s +78.12 ms / +1.9% (worse) 13.486 ms +1.07 ms / +8.6% (worse)
Windows MinGW ARM64 fmtprintf-lto 1860096 B 0 B / +0.0% 478912 B 0 B / +0.0% 9.831 s +46.25 ms / +0.5% (worse) 12.456 ms -790.6 us / -6.0% (better)
Windows MinGW ARM64 println 68608 B 0 B / +0.0% 22544 B 0 B / +0.0% 1.418 s +22.77 ms / +1.6% (worse) 10.643 ms +126.5 us / +1.2% (worse)
Windows MinGW ARM64 println-lto 64000 B 0 B / +0.0% 19604 B 0 B / +0.0% 1.592 s +27.64 ms / +1.8% (worse) 10.858 ms +78.5 us / +0.7% (worse)
Windows MSVC cprintf 120320 B 0 B / +0.0% 65782 B 0 B / +0.0% 980.938 ms -58.53 ms / -5.6% (better) 3.382 ms +16.3 us / +0.5% (worse)
Windows MSVC cprintf-lto 119808 B 0 B / +0.0% 65718 B 0 B / +0.0% 1.009 s +108.4 ms / +12.0% (worse) 4.012 ms +673.2 us / +20.2% (worse)
Windows MSVC fmtprintf 1626112 B 0 B / +0.0% 696630 B 0 B / +0.0% 3.769 s +147.1 ms / +4.1% (worse) 9.915 ms +1.14 ms / +13.0% (worse)
Windows MSVC fmtprintf-lto 1625088 B 0 B / +0.0% 652886 B 0 B / +0.0% 9.155 s +149.6 ms / +1.7% (worse) 9.405 ms +283.7 us / +3.1% (worse)
Windows MSVC println 193024 B 0 B / +0.0% 119478 B 0 B / +0.0% 974.380 ms +89.39 ms / +10.1% (worse) 8.138 ms +1.23 ms / +17.8% (worse)
Windows MSVC println-lto 189952 B 0 B / +0.0% 116614 B 0 B / +0.0% 1.146 s +76.04 ms / +7.1% (worse) 7.564 ms +440.7 us / +6.2% (worse)
Windows MSVC 386 cprintf 9728 B 0 B / +0.0% 3931 B 0 B / +0.0% 1.144 s -15.75 ms / -1.4% (better) 7.141 ms +1.645 ms / +29.9% (worse)
Windows MSVC 386 cprintf-lto 9216 B 0 B / +0.0% 3853 B 0 B / +0.0% 976.911 ms -3.808 ms / -0.4% (better) 5.772 ms -652.5 us / -10.2% (better)
Windows MSVC 386 fmtprintf 1190912 B 0 B / +0.0% 455797 B 0 B / +0.0% 3.932 s +17.24 ms / +0.4% (worse) 12.910 ms -463.4 us / -3.5% (better)
Windows MSVC 386 fmtprintf-lto 1231872 B 0 B / +0.0% 431417 B 0 B / +0.0% 8.954 s -33.83 ms / -0.4% (better) 12.173 ms +772.4 us / +6.8% (worse)
Windows MSVC 386 println 34304 B 0 B / +0.0% 18865 B 0 B / +0.0% 967.187 ms -552.8 us / -0.1% (better) 9.216 ms -573.8 us / -5.9% (better)
Windows MSVC 386 println-lto 32768 B 0 B / +0.0% 17015 B 0 B / +0.0% 1.153 s +12.77 ms / +1.1% (worse) 9.222 ms -892.3 us / -8.8% (better)
Windows MSVC ARM64 cprintf 11264 B 0 B / +0.0% 3976 B 0 B / +0.0% 1.997 s -13.04 ms / -0.6% (better) 6.887 ms +381.2 us / +5.9% (worse)
Windows MSVC ARM64 cprintf-lto 10752 B 0 B / +0.0% 3868 B 0 B / +0.0% 2.017 s -748.8 us / -0.03712% (better) 7.010 ms +44.8 us / +0.6% (worse)
Windows MSVC ARM64 fmtprintf 1371648 B 0 B / +0.0% 511524 B 0 B / +0.0% 6.499 s -6.061 ms / -0.1% (better) 14.546 ms +564.3 us / +4.0% (worse)
Windows MSVC ARM64 fmtprintf-lto 1395712 B 0 B / +0.0% 481716 B 0 B / +0.0% 15.660 s +40.06 ms / +0.3% (worse) 13.945 ms -1.222 ms / -8.1% (better)
Windows MSVC ARM64 println 41472 B 0 B / +0.0% 21784 B 0 B / +0.0% 1.984 s -17.65 ms / -0.9% (better) 11.981 ms -369.9 us / -3.0% (better)
Windows MSVC ARM64 println-lto 39936 B 0 B / +0.0% 19532 B 0 B / +0.0% 2.290 s -5.367 ms / -0.2% (better) 11.932 ms -587.6 us / -4.7% (better)
Core language and compiler benchmarks
Platform Benchmark ns/op vs base
Linux BenchmarkLookupPCRandom 14.520 ns/op -1.16 ns/op / -7.4% (better)
Linux BenchmarkMergeCompilerFlags 200.900 ns/op -7.2 ns/op / -3.5% (better)
Linux BenchmarkMergeLinkerFlags 126.800 ns/op -15.5 ns/op / -10.9% (better)
Linux BenchmarkChannelBuffered 56.550 ns/op +0.67 ns/op / +1.2% (worse)
Linux BenchmarkChannelHandoff 14561 ns/op +385 ns/op / +2.7% (worse)
Linux BenchmarkDefer 55.040 ns/op +5.93 ns/op / +12.1% (worse)
Linux BenchmarkDirectCall 1.581 ns/op +0.023 ns/op / +1.5% (worse)
Linux BenchmarkGlobalRead 1.194 ns/op +0.029 ns/op / +2.5% (worse)
Linux BenchmarkGlobalWrite 7.792 ns/op -0.054 ns/op / -0.7% (better)
Linux BenchmarkGoroutine 21977 ns/op +675 ns/op / +3.2% (worse)
Linux BenchmarkInterfaceCall 6.447 ns/op +0.124 ns/op / +2.0% (worse)
Linux BenchmarkRuntimeGetG 2.445 ns/op +0.011 ns/op / +0.5% (worse)
macOS BenchmarkLookupPCRandom 13.130 ns/op +0.66 ns/op / +5.3% (worse)
macOS BenchmarkMergeCompilerFlags 148.700 ns/op +39.9 ns/op / +36.7% (worse)
macOS BenchmarkMergeLinkerFlags 73.630 ns/op +1.32 ns/op / +1.8% (worse)
macOS BenchmarkChannelBuffered 28.020 ns/op +2.55 ns/op / +10.0% (worse)
macOS BenchmarkChannelHandoff 10229 ns/op -654 ns/op / -6.0% (better)
macOS BenchmarkDefer 36.410 ns/op +2.11 ns/op / +6.2% (worse)
macOS BenchmarkDirectCall 1.157 ns/op +0.059 ns/op / +5.4% (worse)
macOS BenchmarkGlobalRead 1.234 ns/op +0.133 ns/op / +12.1% (worse)
macOS BenchmarkGlobalWrite 1.858 ns/op +0.371 ns/op / +24.9% (worse)
macOS BenchmarkGoroutine 65509 ns/op +34227 ns/op / +109.4% (worse)
macOS BenchmarkInterfaceCall 4.288 ns/op +0.249 ns/op / +6.2% (worse)
macOS BenchmarkRuntimeGetG 2.369 ns/op +0.018 ns/op / +0.8% (worse)
Windows MinGW BenchmarkLookupPCRandom 12.970 ns/op -0.19 ns/op / -1.4% (better)
Windows MinGW BenchmarkMergeCompilerFlags 601.900 ns/op -10.1 ns/op / -1.7% (better)
Windows MinGW BenchmarkMergeLinkerFlags 525.900 ns/op -30.3 ns/op / -5.4% (better)
Windows MinGW BenchmarkChannelBuffered 34.590 ns/op +0.37 ns/op / +1.1% (worse)
Windows MinGW BenchmarkChannelHandoff 887.900 ns/op +2.8 ns/op / +0.3% (worse)
Windows MinGW BenchmarkDefer 58.010 ns/op +1.16 ns/op / +2.0% (worse)
Windows MinGW BenchmarkDirectCall 1.549 ns/op +0.001 ns/op / +0.1% (worse)
Windows MinGW BenchmarkGlobalRead 1.546 ns/op -0.003 ns/op / -0.2% (better)
Windows MinGW BenchmarkGlobalWrite 2.469 ns/op -0.004 ns/op / -0.2% (better)
Windows MinGW BenchmarkGoroutine 90142 ns/op +9474 ns/op / +11.7% (worse)
Windows MinGW BenchmarkInterfaceCall 8.376 ns/op +0.005 ns/op / +0.1% (worse)
Windows MinGW BenchmarkRuntimeGetG 2.175 ns/op +0.004 ns/op / +0.2% (worse)
Windows MinGW 386 BenchmarkLookupPCRandom 27.800 ns/op -0.02 ns/op / -0.1% (better)
Windows MinGW 386 BenchmarkMergeCompilerFlags 796.300 ns/op +64.4 ns/op / +8.8% (worse)
Windows MinGW 386 BenchmarkMergeLinkerFlags 678.400 ns/op -2.8 ns/op / -0.4% (better)
Windows MinGW 386 BenchmarkChannelBuffered 46.170 ns/op -0.09 ns/op / -0.2% (better)
Windows MinGW 386 BenchmarkChannelHandoff 930.900 ns/op -9.5 ns/op / -1.0% (better)
Windows MinGW 386 BenchmarkDefer 45.710 ns/op +1.68 ns/op / +3.8% (worse)
Windows MinGW 386 BenchmarkDirectCall 1.745 ns/op -0.001 ns/op / -0.1% (better)
Windows MinGW 386 BenchmarkGlobalRead 2.097 ns/op 0 ns/op / +0.0%
Windows MinGW 386 BenchmarkGlobalWrite 8.991 ns/op +0.007 ns/op / +0.1% (worse)
Windows MinGW 386 BenchmarkGoroutine 71301 ns/op -1464 ns/op / -2.0% (better)
Windows MinGW 386 BenchmarkInterfaceCall 9.438 ns/op -0.006 ns/op / -0.1% (better)
Windows MinGW 386 BenchmarkRuntimeGetG 2.102 ns/op 0 ns/op / +0.0%
Windows MinGW ARM64 BenchmarkLookupPCRandom 12.210 ns/op +0.1 ns/op / +0.8% (worse)
Windows MinGW ARM64 BenchmarkMergeCompilerFlags 568.200 ns/op -0.8 ns/op / -0.1% (better)
Windows MinGW ARM64 BenchmarkMergeLinkerFlags 540.800 ns/op +18.4 ns/op / +3.5% (worse)
Windows MinGW ARM64 BenchmarkChannelBuffered 37.400 ns/op -2.33 ns/op / -5.9% (better)
Windows MinGW ARM64 BenchmarkChannelHandoff 2568 ns/op +628 ns/op / +32.4% (worse)
Windows MinGW ARM64 BenchmarkDefer 53.130 ns/op -1.8 ns/op / -3.3% (better)
Windows MinGW ARM64 BenchmarkDirectCall 0.590 ns/op +0.0002 ns/op / +0.03393% (worse)
Windows MinGW ARM64 BenchmarkGlobalRead 0.663 ns/op -0.0001 ns/op / -0.01507% (better)
Windows MinGW ARM64 BenchmarkGlobalWrite 0.884 ns/op -0.0001 ns/op / -0.01131% (better)
Windows MinGW ARM64 BenchmarkGoroutine 58335 ns/op -662 ns/op / -1.1% (better)
Windows MinGW ARM64 BenchmarkInterfaceCall 4.306 ns/op -0.001 ns/op / -0.02322% (better)
Windows MinGW ARM64 BenchmarkRuntimeGetG 1.803 ns/op +0.002 ns/op / +0.1% (worse)
Windows MSVC BenchmarkLookupPCRandom 12.290 ns/op -0.32 ns/op / -2.5% (better)
Windows MSVC BenchmarkMergeCompilerFlags 534.800 ns/op -7.5 ns/op / -1.4% (better)
Windows MSVC BenchmarkMergeLinkerFlags 465.500 ns/op +0.9 ns/op / +0.2% (worse)
Windows MSVC BenchmarkChannelBuffered 33.480 ns/op 0 ns/op / +0.0%
Windows MSVC BenchmarkChannelHandoff 1295 ns/op -70 ns/op / -5.1% (better)
Windows MSVC BenchmarkDefer 54.840 ns/op -1.86 ns/op / -3.3% (better)
Windows MSVC BenchmarkDirectCall 1.747 ns/op +0.001 ns/op / +0.1% (worse)
Windows MSVC BenchmarkGlobalRead 1.749 ns/op -0.043 ns/op / -2.4% (better)
Windows MSVC BenchmarkGlobalWrite 2.791 ns/op -0.001 ns/op / -0.03582% (better)
Windows MSVC BenchmarkGoroutine 64517 ns/op -687 ns/op / -1.1% (better)
Windows MSVC BenchmarkInterfaceCall 8.736 ns/op -0.005 ns/op / -0.1% (better)
Windows MSVC BenchmarkRuntimeGetG 2.100 ns/op +0.002 ns/op / +0.1% (worse)
Windows MSVC 386 BenchmarkLookupPCRandom 26.510 ns/op -0.06 ns/op / -0.2% (better)
Windows MSVC 386 BenchmarkMergeCompilerFlags 773.500 ns/op -51.8 ns/op / -6.3% (better)
Windows MSVC 386 BenchmarkMergeLinkerFlags 690.500 ns/op -5.7 ns/op / -0.8% (better)
Windows MSVC 386 BenchmarkChannelBuffered 45.770 ns/op +0.1 ns/op / +0.2% (worse)
Windows MSVC 386 BenchmarkChannelHandoff 947.300 ns/op -76.7 ns/op / -7.5% (better)
Windows MSVC 386 BenchmarkDefer 48.440 ns/op +3.01 ns/op / +6.6% (worse)
Windows MSVC 386 BenchmarkDirectCall 1.548 ns/op -0.001 ns/op / -0.1% (better)
Windows MSVC 386 BenchmarkGlobalRead 1.549 ns/op 0 ns/op / +0.0%
Windows MSVC 386 BenchmarkGlobalWrite 7.792 ns/op +0.007 ns/op / +0.1% (worse)
Windows MSVC 386 BenchmarkGoroutine 87996 ns/op -2143 ns/op / -2.4% (better)
Windows MSVC 386 BenchmarkInterfaceCall 8.364 ns/op 0 ns/op / +0.0%
Windows MSVC 386 BenchmarkRuntimeGetG 1.925 ns/op -0.004 ns/op / -0.2% (better)
Windows MSVC ARM64 BenchmarkLookupPCRandom 12.080 ns/op +0.01 ns/op / +0.1% (worse)
Windows MSVC ARM64 BenchmarkMergeCompilerFlags 565.600 ns/op -0.9 ns/op / -0.2% (better)
Windows MSVC ARM64 BenchmarkMergeLinkerFlags 534.600 ns/op -6.1 ns/op / -1.1% (better)
Windows MSVC ARM64 BenchmarkChannelBuffered 37.940 ns/op -1.21 ns/op / -3.1% (better)
Windows MSVC ARM64 BenchmarkChannelHandoff 2270 ns/op +304 ns/op / +15.5% (worse)
Windows MSVC ARM64 BenchmarkDefer 65.630 ns/op +2.9 ns/op / +4.6% (worse)
Windows MSVC ARM64 BenchmarkDirectCall 0.589 ns/op -0.0003 ns/op / -0.1% (better)
Windows MSVC ARM64 BenchmarkGlobalRead 0.665 ns/op -0.0003 ns/op / -0.04511% (better)
Windows MSVC ARM64 BenchmarkGlobalWrite 3.752 ns/op 0 ns/op / +0.0%
Windows MSVC ARM64 BenchmarkGoroutine 52909 ns/op -1102 ns/op / -2.0% (better)
Windows MSVC ARM64 BenchmarkInterfaceCall 4.183 ns/op +0.009 ns/op / +0.2% (worse)
Windows MSVC ARM64 BenchmarkRuntimeGetG 1.793 ns/op -0.266 ns/op / -12.9% (better)

Timer runtime benchmarks

Platform Operation and runtime ns/op vs base
Linux AfterFuncZeroDelivery/Go 907.700 ns/op -1.7 ns/op / -0.2% (better)
Linux AfterFuncZeroDelivery/LLGo 32140 ns/op -4380 ns/op / -12.0% (better)
Linux CreateStop/Go 289.500 ns/op -1.7 ns/op / -0.6% (better)
Linux CreateStop/LLGo 1756 ns/op +122 ns/op / +7.5% (worse)
Linux RearmStopped/Go 114.900 ns/op -1.5 ns/op / -1.3% (better)
Linux RearmStopped/LLGo 1200 ns/op -54 ns/op / -4.3% (better)
Linux ResetActive/Go 67.520 ns/op -1.13 ns/op / -1.6% (better)
Linux ResetActive/LLGo 751.400 ns/op -105.6 ns/op / -12.3% (better)
Linux ResetHeap1024/Go 67.250 ns/op -0.36 ns/op / -0.5% (better)
Linux ResetHeap1024/LLGo 185.800 ns/op -3.7 ns/op / -2.0% (better)
macOS AfterFuncZeroDelivery/Go 478.200 ns/op +4.1 ns/op / +0.9% (worse)
macOS AfterFuncZeroDelivery/LLGo 76289 ns/op +3898 ns/op / +5.4% (worse)
macOS CreateStop/Go 157.400 ns/op +9.3 ns/op / +6.3% (worse)
macOS CreateStop/LLGo 532.800 ns/op +55.4 ns/op / +11.6% (worse)
macOS RearmStopped/Go 64.950 ns/op +4.27 ns/op / +7.0% (worse)
macOS RearmStopped/LLGo 334.200 ns/op -140.7 ns/op / -29.6% (better)
macOS ResetActive/Go 49.160 ns/op +1.87 ns/op / +4.0% (worse)
macOS ResetActive/LLGo 163.900 ns/op -11 ns/op / -6.3% (better)
macOS ResetHeap1024/Go 54.890 ns/op +8.92 ns/op / +19.4% (worse)
macOS ResetHeap1024/LLGo 91.990 ns/op -0.06 ns/op / -0.1% (better)
Windows MinGW AfterFuncZeroDelivery/Go 553.800 ns/op -22.7 ns/op / -3.9% (better)
Windows MinGW AfterFuncZeroDelivery/LLGo 163427 ns/op -997 ns/op / -0.6% (better)
Windows MinGW CreateStop/Go 114.500 ns/op -1.9 ns/op / -1.6% (better)
Windows MinGW CreateStop/LLGo 453.400 ns/op -11.4 ns/op / -2.5% (better)
Windows MinGW RearmStopped/Go 31.530 ns/op +0.12 ns/op / +0.4% (worse)
Windows MinGW RearmStopped/LLGo 263.600 ns/op -4.1 ns/op / -1.5% (better)
Windows MinGW ResetActive/Go 20.050 ns/op -0.1 ns/op / -0.5% (better)
Windows MinGW ResetActive/LLGo 167.300 ns/op +3.1 ns/op / +1.9% (worse)
Windows MinGW ResetHeap1024/Go 20.580 ns/op +0.2 ns/op / +1.0% (worse)
Windows MinGW ResetHeap1024/LLGo 127.200 ns/op +2.1 ns/op / +1.7% (worse)
Windows MinGW 386 AfterFuncZeroDelivery/Go 982.800 ns/op -20.2 ns/op / -2.0% (better)
Windows MinGW 386 AfterFuncZeroDelivery/LLGo 157642 ns/op -13556 ns/op / -7.9% (better)
Windows MinGW 386 CreateStop/Go 218.200 ns/op +0.7 ns/op / +0.3% (worse)
Windows MinGW 386 CreateStop/LLGo 2187 ns/op +10 ns/op / +0.5% (worse)
Windows MinGW 386 RearmStopped/Go 72.900 ns/op -0.26 ns/op / -0.4% (better)
Windows MinGW 386 RearmStopped/LLGo 359 ns/op -114.9 ns/op / -24.2% (better)
Windows MinGW 386 ResetActive/Go 42.070 ns/op -0.02 ns/op / -0.04752% (better)
Windows MinGW 386 ResetActive/LLGo 1090 ns/op +623.1 ns/op / +133.5% (worse)
Windows MinGW 386 ResetHeap1024/Go 42.300 ns/op -0.06 ns/op / -0.1% (better)
Windows MinGW 386 ResetHeap1024/LLGo 193.300 ns/op +1.7 ns/op / +0.9% (worse)
Windows MinGW ARM64 AfterFuncZeroDelivery/Go 679.900 ns/op +7.8 ns/op / +1.2% (worse)
Windows MinGW ARM64 AfterFuncZeroDelivery/LLGo 122775 ns/op -352 ns/op / -0.3% (better)
Windows MinGW ARM64 CreateStop/Go 199 ns/op +1 ns/op / +0.5% (worse)
Windows MinGW ARM64 CreateStop/LLGo 358.700 ns/op -21.4 ns/op / -5.6% (better)
Windows MinGW ARM64 RearmStopped/Go 70.550 ns/op +0.04 ns/op / +0.1% (worse)
Windows MinGW ARM64 RearmStopped/LLGo 255.100 ns/op +2.4 ns/op / +0.9% (worse)
Windows MinGW ARM64 ResetActive/Go 31.250 ns/op +0.1 ns/op / +0.3% (worse)
Windows MinGW ARM64 ResetActive/LLGo 119.800 ns/op -2.6 ns/op / -2.1% (better)
Windows MinGW ARM64 ResetHeap1024/Go 31.220 ns/op +0.05 ns/op / +0.2% (worse)
Windows MinGW ARM64 ResetHeap1024/LLGo 127.300 ns/op +0.1 ns/op / +0.1% (worse)
Windows MSVC AfterFuncZeroDelivery/Go 480.100 ns/op -0.6 ns/op / -0.1% (better)
Windows MSVC AfterFuncZeroDelivery/LLGo 134500 ns/op +9795 ns/op / +7.9% (worse)
Windows MSVC CreateStop/Go 114.900 ns/op -1.7 ns/op / -1.5% (better)
Windows MSVC CreateStop/LLGo 457.400 ns/op -33.7 ns/op / -6.9% (better)
Windows MSVC RearmStopped/Go 31.560 ns/op 0 ns/op / +0.0%
Windows MSVC RearmStopped/LLGo 279 ns/op +4.7 ns/op / +1.7% (worse)
Windows MSVC ResetActive/Go 19.120 ns/op +0.11 ns/op / +0.6% (worse)
Windows MSVC ResetActive/LLGo 161 ns/op -0.1 ns/op / -0.1% (better)
Windows MSVC ResetHeap1024/Go 19.170 ns/op +0.04 ns/op / +0.2% (worse)
Windows MSVC ResetHeap1024/LLGo 137.200 ns/op +1.6 ns/op / +1.2% (worse)
Windows MSVC 386 AfterFuncZeroDelivery/Go 946.200 ns/op -29.9 ns/op / -3.1% (better)
Windows MSVC 386 AfterFuncZeroDelivery/LLGo 196848 ns/op +322 ns/op / +0.2% (worse)
Windows MSVC 386 CreateStop/Go 198.600 ns/op -6 ns/op / -2.9% (better)
Windows MSVC 386 CreateStop/LLGo 2071 ns/op -3 ns/op / -0.1% (better)
Windows MSVC 386 RearmStopped/Go 63.140 ns/op -2.13 ns/op / -3.3% (better)
Windows MSVC 386 RearmStopped/LLGo 322.300 ns/op -5.5 ns/op / -1.7% (better)
Windows MSVC 386 ResetActive/Go 39.060 ns/op -3.35 ns/op / -7.9% (better)
Windows MSVC 386 ResetActive/LLGo 984.800 ns/op +36.9 ns/op / +3.9% (worse)
Windows MSVC 386 ResetHeap1024/Go 39.420 ns/op -1.96 ns/op / -4.7% (better)
Windows MSVC 386 ResetHeap1024/LLGo 172.600 ns/op +2.1 ns/op / +1.2% (worse)
Windows MSVC ARM64 AfterFuncZeroDelivery/Go 670.700 ns/op +0.5 ns/op / +0.1% (worse)
Windows MSVC ARM64 AfterFuncZeroDelivery/LLGo 117814 ns/op -4589 ns/op / -3.7% (better)
Windows MSVC ARM64 CreateStop/Go 196.600 ns/op -14.3 ns/op / -6.8% (better)
Windows MSVC ARM64 CreateStop/LLGo 387.700 ns/op +7.9 ns/op / +2.1% (worse)
Windows MSVC ARM64 RearmStopped/Go 70.540 ns/op -0.24 ns/op / -0.3% (better)
Windows MSVC ARM64 RearmStopped/LLGo 270.200 ns/op -1.5 ns/op / -0.6% (better)
Windows MSVC ARM64 ResetActive/Go 31.100 ns/op -0.12 ns/op / -0.4% (better)
Windows MSVC ARM64 ResetActive/LLGo 130.600 ns/op -5.3 ns/op / -3.9% (better)
Windows MSVC ARM64 ResetHeap1024/Go 31.090 ns/op -0.11 ns/op / -0.4% (better)
Windows MSVC ARM64 ResetHeap1024/LLGo 138.600 ns/op +0.3 ns/op / +0.2% (worse)

Compared with 5c5874359c1e measured in the same runner job.

@github-actions

github-actions Bot commented Sep 11, 2026 •

Copy link
Copy Markdown

LLGo WebAssembly build benchmarks

7312875a25c2 | workflow run | long-term charts

WebAssembly output sizes

Profile and compiler Wasm module vs base Generated JS glue vs base
ec32/LLGo 113243 B 0 B / +0.0% 70736 B 0 B / +0.0%
ec64/LLGo 118688 B 0 B / +0.0% 74033 B 0 B / +0.0%
js/Go 1895533 B 0 B / +0.0% 0 B 0 B / 0.0%
js/LLGo 66660 B 0 B / +0.0% 68511 B 0 B / +0.0%
wasip1/Go 1909947 B 0 B / +0.0% 0 B 0 B / 0.0%
wasip1/LLGo 72917 B 0 B / +0.0% 0 B 0 B / 0.0%
wc32/LLGo 117359 B 0 B / +0.0% 0 B 0 B / 0.0%

LLGo WebAssembly build measurements

Profile Build vs base
ec32 5.703 s +237.2 ms / +4.3% (worse)
ec64 5.268 s +129.6 ms / +2.5% (worse)
js 4.578 s -313.1 ms / -6.4% (better)
wasip1 3.166 s +124.3 ms / +4.1% (worse)
wc32 4.040 s -44.5 ms / -1.1% (better)

Compared with 5c5874359c1e measured in the same runner job.

@cpunion
cpunion force-pushed the codex/fix-lto-invalid-metadata-exit-20260911 branch from a87bb23 to 7312875 Compare September 14, 2026 05:32
@cpunion

cpunion commented Sep 14, 2026

Copy link
Copy Markdown
Collaborator Author

@fennoai Review again after rebasing onto the latest main.

@fennoai

fennoai Bot commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

FennoAI is processing your request, please wait a moment...

@fennoai fennoai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review — post-rebase

Re-reviewed against the rebased range 5c58743...7312875. The diff is now just the two intended files; the descendant-probe prerequisite commits from #2563 are no longer in the range, confirming the clean rebase onto latest main.

Conclusion: no blocking issues. The change is correct, minimal, and well-scoped.

  • ltoplugin/LLGOInterfaceMethodTypeIDPass.cpp — Switching invalidMetadata() from report_fatal_error to reportFatalUsageError is the right call. Malformed interface type-id metadata is invalid input, not an internal invariant violation, so a clean exit(1) diagnostic (no crash reporter / symbolizer / abort()) is the correct classification. The helper stays [[noreturn]], the const Twine& overload matches, and llvm/Support/ErrorHandling.h is already included — no include churn. The plugin is pinned to LLVM 22.x in CMakeLists.txt, and reportFatalUsageError exists there, so this is API-safe.
  • cl/compile_test.go — The strengthened negative test is a solid improvement over the previous "any failure" check. The assertion order is correct: ctx.Err() is inspected first (distinguishes a hang/timeout from a wrong exit), then *exec.ExitError with ExitCode() == 1 (rejects both success and signal-induced crashes), then the diagnostic substring. The 30s context timeout + 1s WaitDelay bound a stuck opt so it fails fast locally instead of consuming the package timeout.

Non-blocking (out of scope): ltoplugin/LLGOReflectMethodByNamePass.cpp:1951,2121 still use report_fatal_error for what also look like input-validation failures. Not part of this diff; a future follow-up could align them with the convention this PR establishes.

@cpunion

cpunion commented Sep 14, 2026

Copy link
Copy Markdown
Collaborator Author

Final validation on 7312875: all 64 checks passed, with no pending or failed checks. The latest fennoai review is on this head and all review threads are resolved. The rebase leaves only the intended two-file LTO fix. In addition to this PR CI, cherry-picking this fix into #2530 made its previously hanging malformed-metadata LTO job pass: https://github.com/xgo-dev/llgo/actions/runs/34812965081/job/103877868707 . Locally, all three rejection cases were executed with the built LLVM 22 plugin and -tags=dev (no skips), verifying exit status 1 and the expected diagnostic.

@cpunion
cpunion merged commit bc9d15b into xgo-dev:main Sep 14, 2026
65 checks passed
@fennoai fennoai Bot mentioned this pull request Sep 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants