Skip to content

Enable real dynamic linking with -shared by default#25930

Open
sbc100 wants to merge 1 commit into
emscripten-core:mainfrom
sbc100:shared_flag_part2
Open

Enable real dynamic linking with -shared by default#25930
sbc100 wants to merge 1 commit into
emscripten-core:mainfrom
sbc100:shared_flag_part2

Conversation

@sbc100
Copy link
Copy Markdown
Collaborator

@sbc100 sbc100 commented Dec 11, 2025

This change essentially disables FAKE_DYLIBS by default, which in
turn means -shared will now produce dynamic libraries by default.

If you want the old behaviour you now need -sFAKE_DYLIBS.

For cmake builds we still don't set TARGET_SUPPORTS_SHARED_LIBS.
That will likely be a followup once we deal with https://gitlab.kitware.com/cmake/cmake/-/work_items/27240

Comment thread cmake/Modules/Platform/Emscripten.cmake Outdated
@sbc100 sbc100 force-pushed the shared_flag_part2 branch 2 times, most recently from 6e4f78f to 3b0addc Compare December 11, 2025 00:49
@sbc100 sbc100 requested review from dschuff and kripken December 11, 2025 00:50
Comment thread site/source/docs/tools_reference/settings_reference.rst Outdated
Comment thread tools/building.py
Copy link
Copy Markdown
Member

@dschuff dschuff left a comment

Choose a reason for hiding this comment

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

I wonder what would happen if we tested this with Binaryen. it doesn't seem prepared to force the Emscripten build to be static (assuming that's the behavior we actually want).

Comment thread test/test_core.py Outdated
@sbc100 sbc100 force-pushed the shared_flag_part2 branch from 3b0addc to 2a98976 Compare May 12, 2026 01:15
@sbc100 sbc100 changed the title Disable FAKE_DYLIBS by default Enable real dynamic linking by default May 12, 2026
@sbc100 sbc100 force-pushed the shared_flag_part2 branch 3 times, most recently from 3b9f050 to d2bc4e4 Compare May 12, 2026 04:13
Comment thread cmake/Modules/Platform/Emscripten.cmake
@sbc100 sbc100 force-pushed the shared_flag_part2 branch 2 times, most recently from dbf81cc to 2a061bd Compare May 14, 2026 01:07
sbc100 added a commit that referenced this pull request May 14, 2026
This test was first added in c735bb6. Hopefully these changes make it
more obvious what is being tested, and also test more commonly used
flags (`-shared` vs `-r`).

Split out from #25930.
@sbc100 sbc100 force-pushed the shared_flag_part2 branch 4 times, most recently from d43b884 to 19b4b57 Compare May 15, 2026 19:07
@sbc100
Copy link
Copy Markdown
Collaborator Author

sbc100 commented May 15, 2026

I wonder what would happen if we tested this with Binaryen. it doesn't seem prepared to force the Emscripten build to be static (assuming that's the behavior we actually want).

I actually ended up leaving the cmake TARGET_SUPPORTS_SHARED_LIBS setting as False until we resolve https://gitlab.kitware.com/cmake/cmake/-/work_items/27240

@sbc100
Copy link
Copy Markdown
Collaborator Author

sbc100 commented May 15, 2026

OK, I think this change is in pretty good shape now

@sbc100 sbc100 force-pushed the shared_flag_part2 branch from 19b4b57 to 28ec96d Compare May 15, 2026 19:31
@sbc100 sbc100 changed the title Enable real dynamic linking by default Enable real dynamic linking with -shared by default May 15, 2026
This change essentially disables `FAKE_DYLIBS` by default, which in
turn means `-shared` will now produce dynamic libraries by default.

If you want the old behaviour you now need `-sFAKE_DYLIBS`.
@sbc100 sbc100 force-pushed the shared_flag_part2 branch from 28ec96d to 6b35408 Compare May 15, 2026 21:40
@sbc100
Copy link
Copy Markdown
Collaborator Author

sbc100 commented May 16, 2026

@kripken @dschuff this change is pretty small now. No codesize changes anymore.

@sbc100 sbc100 requested a review from kripken May 16, 2026 00:48
@sbc100 sbc100 requested a review from dschuff May 16, 2026 00:48
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.

4 participants