Skip to content

Apply optimization flags to test builds - #673

Draft
ricochet wants to merge 1 commit into
WebAssembly:mainfrom
ricochet:codex/fix-sdk-test-optimization-flags
Draft

ricochet wants to merge 1 commit into
WebAssembly:mainfrom
ricochet:codex/fix-sdk-test-optimization-flags

Conversation

@ricochet

@ricochet ricochet commented Dec 4, 2026

Copy link
Copy Markdown
Contributor

The -O0, -O2, and -O2 -flto variants currently only affect test target names. Split each flag string into arguments and apply it to both compilation and linking.

Verified with the Linux ARM64 SDK artifact from main at 2a1936af0457 (LLVM 23.1.6), using an isolated CMake harness around the existing tests:

  • Checked all 768 compile and 768 link commands across the five target triples and static/shared variants. The check fails before this change and passes after it. The LTO objects contain LLVM bitcode.
  • Unchanged main builds all 768 targets and passes all 522 registered runtime tests.
  • With the flags applied, 87 shared-LTO links fail with undefined __heap_base / __heap_end symbols. Four static LTO exception tests also fail with uncaught exceptions. Of 522 runtime tests, 460 pass, four fail in execution, and 58 cannot run because linking failed. WebP2 tests are compiled but are not registered for execution by the existing suite.

Keeping this draft until the exposed LTO failures are resolved. This PR only applies the test flags.

@alexcrichton

Copy link
Copy Markdown
Collaborator

Oh dear :(

I suspect most of the fixes here are going to be within wasi-libc itself if not in the build system here, and in that situation it should also be possible to copy tests where possible into wasi-libc. I thought wasi-libc already exercised most of this but apparently not...

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