-
-
Notifications
You must be signed in to change notification settings - Fork 231
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
Improve dub interop with webassembly #3004
base: master
Are you sure you want to change the base?
Conversation
✅ PR OK, no changes in deprecations or warnings Total deprecations: 0 Total warnings: 0 Build statistics: statistics (-before, +after)
executable size=5334536 bin/dub
-rough build time=60s
+rough build time=61s Full build output
|
Wouldn't it be enough to use ldc2 triple target for now? With this new target being added, would it affect I even commented on the need to run commands through dub for the wasm32/64 or emscripten target. |
It'll only affect platform specifications, making them actually work. Since before you couldn't make a configuration exclusive to eg. wasm32 or wasm64, or exclusive to emscripten. |
Okay, this PR is growing a bit in size, wasm32 and wasm64 only works with relocatable objects, so added a case to ensure this when compiling with the |
So despite the extra updates; this does not add any new arch types, all it does is handle the result from the triple better by conforming to wasm requirements (such as objects being relocatable, wasm32 and wasm64 having slightly different linker flags, etc.) |
// as wasm-ld only works on relocatable objects. | ||
if (p.canFind("wasm")) { | ||
settings.addDFlags("--disable-linker-strip-dead"); | ||
settings.addLFlags("-r"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this doesn't quite seem like the right place to add the dflags per platform, since there is also no other such check here, but I haven't been able to check the code in other compiler wrappers here yet, perhaps consider just disregarding this comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This requirement only applies to the object target type. Couldn't find anywhere better to put it given that .o files have to be reloctable and can't be section gc'd. If these flags aren't there for the object type then you will be unable to use wasm-ld and/or emscripten to link your module with eg. Emscripten ports or other external libraries.
I think we should probably add some tests for webassembly as well since it's quite easy to test, would you like to add that in this PR? Perhaps @Geod24 also has things to say here otherwise LGTM |
Adds missing wasm platform and arch specifiers for wasm32, wasm64 and emscripten.