diff options
author | Yuta Saito <kateinoigakukun@gmail.com> | 2024-10-15 02:41:43 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-10-15 02:41:43 +0900 |
commit | d4efc3e097f40afbe8ae275150f49bb08fc04572 (patch) | |
tree | 599903f888ec91db97a983547bc4fe4b1aa63d3b /llvm/lib/MC/MCContext.cpp | |
parent | 2f077ece2fa59681627963cf9325aeddcf476af6 (diff) | |
download | llvm-d4efc3e097f40afbe8ae275150f49bb08fc04572.zip llvm-d4efc3e097f40afbe8ae275150f49bb08fc04572.tar.gz llvm-d4efc3e097f40afbe8ae275150f49bb08fc04572.tar.bz2 |
[Coverage][WebAssembly] Add initial support for WebAssembly/WASI (#111332)
Currently, WebAssembly/WASI target does not provide direct support for
code coverage.
This patch set fixes several issues to unlock the feature. The main
changes are:
1. Port `compiler-rt/lib/profile` to WebAssembly/WASI.
2. Adjust profile metadata sections for Wasm object file format.
- [CodeGen] Emit `__llvm_covmap` and `__llvm_covfun` as custom sections
instead of data segments.
- [lld] Align the interval space of custom sections at link time.
- [llvm-cov] Copy misaligned custom section data if the start address is
not aligned.
- [llvm-cov] Read `__llvm_prf_names` from data segments
3. [clang] Link with profile runtime libraries if requested
See each commit message for more details and rationale.
This is part of the effort to add code coverage support in Wasm target
of Swift toolchain.
Diffstat (limited to 'llvm/lib/MC/MCContext.cpp')
-rw-r--r-- | llvm/lib/MC/MCContext.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/llvm/lib/MC/MCContext.cpp b/llvm/lib/MC/MCContext.cpp index ac3946b..b97f9d9 100644 --- a/llvm/lib/MC/MCContext.cpp +++ b/llvm/lib/MC/MCContext.cpp @@ -757,6 +757,11 @@ MCSectionWasm *MCContext::getWasmSection(const Twine &Section, SectionKind K, if (!Group.isTriviallyEmpty() && !Group.str().empty()) { GroupSym = cast<MCSymbolWasm>(getOrCreateSymbol(Group)); GroupSym->setComdat(true); + if (K.isMetadata() && !GroupSym->getType().has_value()) { + // Comdat group symbol associated with a custom section is a section + // symbol (not a data symbol). + GroupSym->setType(wasm::WASM_SYMBOL_TYPE_SECTION); + } } return getWasmSection(Section, K, Flags, GroupSym, UniqueID); |