forked from llvm/llvm-project
-
Notifications
You must be signed in to change notification settings - Fork 332
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
[🍒 stable/20240723] [Coverage][WebAssembly] Add initial support for WebAssembly/WASI #9418
Merged
kateinoigakukun
merged 6 commits into
swiftlang:stable/20240723
from
kateinoigakukun:yt/cherry-pick-wasm-coverage-support
Oct 31, 2024
Merged
[🍒 stable/20240723] [Coverage][WebAssembly] Add initial support for WebAssembly/WASI #9418
kateinoigakukun
merged 6 commits into
swiftlang:stable/20240723
from
kateinoigakukun:yt/cherry-pick-wasm-coverage-support
Oct 31, 2024
Conversation
This file contains 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
@swift-ci test |
This was referenced Oct 15, 2024
…m#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.
WASI doesn't support signal, so we should exclude signal.h on WASI. This patch is only for the swiftlang fork of compiler-rt because those signal usages don't exist in the upstream.
…ments" (llvm#112520) This reverts commit efc9dd4 in order to fix Windows test failure: llvm#111332 (comment)
…ments (llvm#112569) On WebAssembly, most coverage metadata contents read by llvm-cov (like `__llvm_covmap` and `__llvm_covfun`) are stored in custom sections because they are not referenced at runtime. However, `__llvm_prf_names` is referenced at runtime by the profile runtime library and is read by llvm-cov post-processing tools, so it needs to be stored in a data segment, which is allocatable at runtime and accessible by tools as long as "name" section is present in the binary. This patch changes the way llvm-cov reads `__llvm_prf_names` on WebAssembly. Instead of looking for a section, it looks for a data segment with the same name. This reverts commit 157f10d and fixes PE/COFF `.lprfn$A` section handling.
kateinoigakukun
force-pushed
the
yt/cherry-pick-wasm-coverage-support
branch
from
October 24, 2024 17:07
c181e46
to
6efc1b4
Compare
@swift-ci test |
@swift-ci test |
@swift-ci test Windows |
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.
Cherry-pick llvm#111332, llvm#112275, llvm#112520, llvm#112569, and llvm#112695 to add coverage support for Wasm targets. Those changes need to be applied together to avoid breaking Windows build.
Original PR description
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:
compiler-rt/lib/profile
to WebAssembly/WASI.__llvm_covmap
and__llvm_covfun
as custom sections instead of data segments.__llvm_prf_names
from data segments