Skip to content

Fix data address exports under -sMAIN_MODULE=1 #23020

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 26, 2024

Conversation

sbc100
Copy link
Collaborator

@sbc100 sbc100 commented Nov 26, 2024

In -sMAIN_MODULE=1 mode we actually link twice, once to get the names the user exported symbols then again with everything exported.

We when use the this base_metadata to limit the things that we export to on the JS module. However for data symbols we cannot use the addresses/values present in base_metadata.

Fixes: #22980

@sbc100 sbc100 requested a review from kripken November 26, 2024 20:23
In `-sMAIN_MODULE=1` mode we actually link twice, once to get the
names the user exported symbols then again with everything exported.

We when use the this `base_metadata` to limit the things that we
export to on the JS module.  However for data symbols we cannot use the
addresses/values present in `base_metadata`.

Fixes: emscripten-core#22980
@sbc100 sbc100 force-pushed the fix_global_exports branch from b4d5ebe to 172ae79 Compare November 26, 2024 21:52
@sbc100 sbc100 enabled auto-merge (squash) November 26, 2024 21:52
@sbc100 sbc100 disabled auto-merge November 26, 2024 23:57
@sbc100 sbc100 merged commit ca8fd33 into emscripten-core:main Nov 26, 2024
25 of 28 checks passed
@sbc100 sbc100 deleted the fix_global_exports branch November 26, 2024 23:57
hoodmane added a commit to hoodmane/pyodide that referenced this pull request Feb 3, 2025
This requires this upstream fix which came out in Emscripten 3.1.73:
emscripten-core/emscripten#23020

Applied upstream in the cpython repo here:
https://github.com/python/cpython/pull/127113/files#diff-31f61a127a59386957acba86e9acedf0a96bc6ebe1ac159a48e39b1a291111b5R73-R75

This fixes an error that occurs when building with assertions -- we
called `_py_version_major` before the runtime was set up so it triggered
an assertion failure.
hoodmane added a commit to pyodide/pyodide that referenced this pull request Feb 3, 2025
This requires this upstream fix which came out in Emscripten 3.1.73:
emscripten-core/emscripten#23020

Applied upstream in the cpython repo here:
https://github.com/python/cpython/pull/127113/files#diff-31f61a127a59386957acba86e9acedf0a96bc6ebe1ac159a48e39b1a291111b5R73-R75

This fixes an error that occurs when building with assertions -- we called
_py_version_major before the runtime was set up so it triggered an assertion
failure.

Co-authored-by: Agriya Khetarpal <[email protected]>
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.

Exported int sometimes corrupted with -sMAIN_MODULE
2 participants