Skip to content

enable exception support for shared libraries - #660

Merged
alexcrichton merged 1 commit into
WebAssembly:mainfrom
dicej:shared-library-exceptions-v2
Oct 1, 2026
Merged

alexcrichton merged 1 commit into
WebAssembly:mainfrom
dicej:shared-library-exceptions-v2

Conversation

@dicej

@dicej dicej commented Sep 30, 2026

Copy link
Copy Markdown
Collaborator

I've updated tests/CMakeLists.txt to run all p2 and p3 tests as shared libraries as well as normal executables. As usual my CMake skills are underwhelming; very open to feedback.

This includes patches for the required LLVM PR backports:

@dicej
dicej requested a review from alexcrichton September 30, 2026 17:29
@alexcrichton

Copy link
Copy Markdown
Collaborator

lgtm, but CI is probably going to be a bit of a beast to get passing here

@dicej
dicej force-pushed the shared-library-exceptions-v2 branch 3 times, most recently from 03735ec to 0e27277 Compare September 30, 2026 21:55
I've updated `tests/CMakeLists.txt` to run all p2 and p3 tests as shared
libraries as well as normal executables.  As usual my CMake skills are
underwhelming; very open to feedback.

This includes patches for the required LLVM PR backports:

- llvm/llvm-project#209282
- llvm/llvm-project#222747
@dicej
dicej force-pushed the shared-library-exceptions-v2 branch from 0e27277 to 719fe63 Compare September 30, 2026 22:28
@dicej

dicej commented Oct 1, 2026 •

Copy link
Copy Markdown
Collaborator Author

CI is green now, although I'm having trouble understanding "Build only sysroot - exceptions: Expected — Waiting for status to be reported" given I've completely commented out that part of the job matrix, so I don't understand why it's appearing at all.

@alexcrichton alexcrichton left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

For CI that's a repo configuration thing (a "required check") -- I'll go disable that

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Would it be possible to avoid manually splitting/merging *.patch files? I've historically attempted to keep the patch files as literal output of curl https://github.com/llvm/llvm-project/pull/208597.diff -L -o ./src/llvm-pr-208597.patch for example which makes it a bit easier to maintain over time. I couldn't do that for some versions in the past when things conflicted, however.

Another way to put this: if literal *.patch files-from-prs don't work, could you expand on why? (also the rationale for the sysroot/toolchain split)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

A few reasons:

  • The actual upstream git diff for each PR doesn't apply to LLVM 23 due to other changes which have happened on LLVM main, so I had to edit them it as part of the backport
  • Both PRs involve both toolchain and sysroot changes which depend on each other. And if I apply either patch only in wasi-sdk-toolchain.cmake or only in wasi-sdk-sysroot.cmake, but only the other one is built, then it won't have the required changes, hence the split.
  • Since 222747 depends on 209282 having been applied first, the git diff ... -R --check was erroring when they were two separate files. I later saw your reverse-the-list trick in the wasi-sdk-toolchain.cmake history which might address that, though.
  • I figured the test .ll files weren't relevant, so I stripped them out

Happy to revisit any of that if there's a better way.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Ok I kind of figure it was something like that but wanted to double check, yeah, and it's ok to land as-is just wanted to have some written-down rationale as well

Comment thread tests/CMakeLists.txt

# Apply test-specific compile options and link flags.
if(${arg_EMULATED_CLOCKS})
set(so_files ${so_files} "${wasi_sysroot}/lib/${target}/libwasi-emulated-process-clocks.so")

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

For these set calls would a list(APPEND so_files ...) work?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

FWIW, I was just starting to test this when I saw you merged the PR, but I can make a small follow up PR if it works out.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Ah yeah it's fine either way, I figure no need to block this for another ~6 hours for a small nit

@alexcrichton
alexcrichton merged commit 8503cc9 into WebAssembly:main Oct 1, 2026
21 of 22 checks passed
alexcrichton pushed a commit that referenced this pull request Oct 2, 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