Skip to content

Commit

Permalink
[clang][WebAssembly] Link with profile runtime libraries if requested
Browse files Browse the repository at this point in the history
This patch teaches the WebAssembly toolchain to link with the profile
runtime libraries if profile instrumentation is requested. With this
change, the following command will work with profile rt installed:

```
$ clang -target wasm32-unknown-wasi -fprofile-instr-generate \
  -lwasi-emulated-getpid -lwasi-emulated-mman -o foo.wasm foo.c
```
  • Loading branch information
kateinoigakukun committed Oct 7, 2024
1 parent 0529ec7 commit 779d88c
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions clang/lib/Driver/ToolChains/WebAssembly.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,8 @@ void wasm::Linker::ConstructJob(Compilation &C, const JobAction &JA,
AddRunTimeLibs(ToolChain, ToolChain.getDriver(), CmdArgs, Args);
}

ToolChain.addProfileRTLibs(Args, CmdArgs);

CmdArgs.push_back("-o");
CmdArgs.push_back(Output.getFilename());

Expand Down

0 comments on commit 779d88c

Please sign in to comment.