Skip to content

Conversation

@sbc100
Copy link
Collaborator

@sbc100 sbc100 commented Dec 10, 2025

In this case we now generate a warning instead of an errors.

Such symbols are not directly accessible in the module scope (since we cannot declare them there). They are only accessible via wasmExports or Module dictionary objects.

See: llvm/llvm-project#169043
Fixes: #24825, #23560

@sbc100 sbc100 requested review from dschuff and kripken December 10, 2025 00:07
@dschuff
Copy link
Member

dschuff commented Dec 10, 2025

Thanks this looks good, at least for the 2 emscripten bugs mentioned above. I'm still wondering about the Objc use case though. In particular, when symbols that begin with the dot will be generated and exported, and which ones. If the runtime will always have such symbols, there will basically be a warning everytime anyone ever links an objc program. So we might want some way to suppress the warning. Either just never emit the warning when linking objc, or some more selective way that can distinguish real warnings from others (not sure if that would be useful).

@sbc100
Copy link
Collaborator Author

sbc100 commented Dec 10, 2025

Yes, we can consider removing the warning later, or finding a way to auto-suppress it. Obviously -Wno-js-compiler will suppress it but I think you are suggesting doing this automatically?

@dschuff
Copy link
Member

dschuff commented Dec 10, 2025

If it's the case that every objc program contains exports from the stdlib that will trigger this warning, we probably don't want to be emitting a warning for every valid program.

@sbc100
Copy link
Collaborator Author

sbc100 commented Dec 10, 2025

If it's the case that every objc program contains exports from the stdlib that will trigger this warning, we probably don't want to be emitting a warning for every valid program.

No, but you are right that we should fix llvm upstream so that these symbols are not exported by default.

I still think this change is worth landing interdependently of any ObjC.

@sbc100 sbc100 force-pushed the allow_invalid_names branch from c41417f to f14fbd8 Compare December 10, 2025 01:31
@sbc100 sbc100 enabled auto-merge (squash) December 10, 2025 01:56
In this case we now generate a warning instead of an errors.

Such symbols are not directly accessible in the module scope (since we
cannot declare them there).  They are only accessible via `wasmExports`
or `Module` dictionary objects.

See: llvm/llvm-project#169043
Fixes: emscripten-core#24825
@sbc100 sbc100 force-pushed the allow_invalid_names branch from f14fbd8 to caf6904 Compare December 10, 2025 20:34
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.

Rust/Emscripten generates invalid JS from Rust-mangled symbols

2 participants