-
Notifications
You must be signed in to change notification settings - Fork 3.4k
When compiling, use a single clang command for all input sources. NFC #20713
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
Conversation
This change builds on #20712 |
shared.check_call(cmd) | ||
return [] | ||
|
||
if state.mode == Mode.COMPILE_ONLY: |
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.
Why is this limited to compile-only mode? Wouldn't it work for compile-and-link too?
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.
It compile-and-link mode it more complicated because we don't want to leave any object files in the current working directory. If we could find a way to extent this later to cover all cases that would be awesome but for now we want control over the output filenames in that case (just like the clang driver internally does).
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.
I thought we could just pass the args to Clang so e.g. emcc foo.c bar.c -o output.js
becomes clang foo.c bar.c -o output.wasm
but I guess it's not that simple?
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.
Yes, the problem is that we don't really on clang as out linker-driver, we do it outselves. We run wam-ld and then a bunch of post-link tools from emcc.py.
If we could convert to using clang as the linker driver (i.e. have clang run wasm-ld for us) that would a really good step in the right direction.
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.
In other words, when linking we currently manage the names and locations of the temporary object files, and not clang. Maybe we could improve on this in the future.
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.
Makes sense. Leaving as a future improvement sgtm.
81cd044
to
e71b36f
Compare
This change should be much more readable now that #20712 has landed. |
6727618
to
69743ef
Compare
4bcfad8
to
184908e
Compare
184908e
to
1cd7599
Compare
For folks that compiler a bunch of source files at once which should help by reducing the number of clang subprocesses that we spawn. This includes the new system library build process that we use internally. See emscripten-core#20577. Do the same for PCH compilation and pre-processing (-E).
1cd7599
to
7e4fc1a
Compare
When compiling, use a single clang command for all input sources. NFC
For folks that compiler a bunch of source files at once which should
help by reducing the number of clang subprocesses that we spawn. This
includes the new system library build process that we use internally.
See #20577.
Do the same for PCH compilation and pre-processing (-E).