Conversation
Add a new `emld` linker entry point and delegate linking from `emcc` to `clang` with `-fuse-ld=emld`. Previously, `emcc` acted as both compiler driver and linker driver, manually compiling multiple source inputs to temporary object files in Python before running `tools/link.py`. With this change: 1. `emld` acts as a drop-in linker replacement that wraps `link.run` and invokes `wasm-ld` followed by Emscripten's post-link steps. 2. `emcc` in link mode delegates to `clang -fuse-ld=<path-to-emld>`, allowing `clang` to handle source compilation, temporary files, and calling the linker. 3. Emscripten-specific linker arguments and `-s` settings are forwarded through `clang` to `emld` via `-Wl,` or `-Xlinker`. 4. `tools/link.py` extracts `linker_setup_minimal` so minimal linker settings can be determined before system libraries are calculated in `emcc`. See: emscripten-core#15703
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add a new
emldlinker entry point and delegate linking fromemcctoclangwith-fuse-ld=emld.Previously,
emccacted as both compiler driver and linker driver, manually compiling multiple source inputs to temporary object files in Python before runningtools/link.py. With this change:emldacts as a drop-in linker replacement that wrapslink.runand invokeswasm-ldfollowed by Emscripten's post-link steps.emccin link mode delegates toclang -fuse-ld=<path-to-emld>, allowingclangto handle source compilation, temporary files, and calling the linker.-ssettings are forwarded throughclangtoemldvia-Wl,or-Xlinker.tools/link.pyextractslinker_setup_minimalso minimal linker settings can be determined before system libraries are calculated inemcc.See: #15703