Skip to content

Mangle C main on Wasm#23303

Merged
thewilsonator merged 1 commit into
dlang:masterfrom
QuantumSegfault:wasm-main-mangle
Jun 24, 2026
Merged

Mangle C main on Wasm#23303
thewilsonator merged 1 commit into
dlang:masterfrom
QuantumSegfault:wasm-main-mangle

Conversation

@QuantumSegfault

Copy link
Copy Markdown
Contributor

Mangles extern(C) main as __main_void or __main_argc_argv on Wasm targets, as done by Clang, and expected by the libcs for Emscripten and WASI.

Split from ldc-developers/ldc#5158
Dependent on remainder of said PR to introduce gen.llvmhelpers.isTargetWasm.

@QuantumSegfault

Copy link
Copy Markdown
Contributor Author

Requesting review

@thewilsonator

return;
}

version (IN_LLVM)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

cc @ibuclaw for whatever the GCC logic should be

@thewilsonator thewilsonator merged commit 51dc8a0 into dlang:master Jun 24, 2026
41 checks passed

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

DMD has no WASM target, so this changelog entry shouldn't be here

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

So even though the change was upstreamed, it shouldn't be logged?

What about #23293 and #23294?


Either way, this particular one has already been merged. Do you need me to open a PR to delete it?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It can be logged in LDC's release notes, but the changelog in this repo gets published with dmd releases so users are aware of what changed when upgrading dmd.

Newly reserved version WASI identifiers affect dmd because version = WASIp1 is something dmd now rejects. core.stdc updates for WASM could be relevant if anyone used dmd's bundled druntime sources with LDC, but that sounds very niche so I don't think it's worth mentioning. New mangling of WASM main is irrelevant/confusing for dmd users because it is incapable of generating any WASM code. I would delete it indeed.

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.

3 participants