-
-
Notifications
You must be signed in to change notification settings - Fork 14.1k
Add x86_64-asan-windows-msvc tier 3 target #149892
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
Open
eholk
wants to merge
5
commits into
rust-lang:main
Choose a base branch
from
eholk:windows-asan-target
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+83
−0
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
3b5806f
Add x86_64-asan-windows-msvc target
eholk 5935819
Add x86_64-asan-windows-msvc LLVM assembly test
eholk 02e232f
Add documentation for x86_64-asan-windows-msvc
eholk c62e6d0
Add a mention about the VS Developer Command Prompt
eholk bc86986
Update src/doc/rustc/src/platform-support/x86_64-asan-windows-msvc.md
eholk File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
16 changes: 16 additions & 0 deletions
16
compiler/rustc_target/src/spec/targets/x86_64_asan_windows_msvc.rs
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| use crate::spec::{SanitizerSet, Target, TargetMetadata}; | ||
|
|
||
| pub(crate) fn target() -> Target { | ||
| let mut base = super::x86_64_pc_windows_msvc::target(); | ||
| base.metadata = TargetMetadata { | ||
| description: Some("64-bit Windows with ASAN enabled by default".into()), | ||
| tier: Some(3), | ||
| host_tools: Some(false), | ||
| std: Some(true), | ||
| }; | ||
| base.options.default_sanitizers = SanitizerSet::ADDRESS; | ||
|
|
||
| assert!(base.options.default_sanitizers.contains(SanitizerSet::ADDRESS)); | ||
|
|
||
| base | ||
| } |
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
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
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
59 changes: 59 additions & 0 deletions
59
src/doc/rustc/src/platform-support/x86_64-asan-windows-msvc.md
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| # `x86_64-asan-windows-msvc` | ||
|
|
||
| **Tier: 3** | ||
|
|
||
| Target mirrors `x86_64-pc-windows-msvc` with AddressSanitizer enabled by default. | ||
|
|
||
| ## Target maintainers | ||
|
|
||
| [@ChrisDenton](https://github.com/ChrisDenton) | ||
| [@dpaoliello](https://github.com/dpaoliello) | ||
| [@eholk](https://github.com/eholk) | ||
| [@Fulgen301](https://github.com/Fulgen301) | ||
| [@lambdageek](https://github.com/lambdageek) | ||
| [@sivadeilra](https://github.com/sivadeilra) | ||
| [@wesleywiser](https://github.com/wesleywiser) | ||
|
|
||
| ## Requirements | ||
|
|
||
| This target is for cross-compilation only. Host tools are not supported because | ||
| this target's primary use cases do not require the host tools to be instrumented | ||
| with AddressSanitizer. The standard library is fully supported. | ||
|
|
||
| In all other aspects, this target is identical to `x86_64-pc-windows-msvc`. | ||
|
|
||
| ## Building the target | ||
|
|
||
| This target can be built by adding it to the `target` list in `bootstrap.toml`. | ||
|
|
||
| ```toml | ||
| [build] | ||
| target = ["x86_64-asan-windows-msvc"] | ||
| ``` | ||
|
|
||
| ## Building Rust programs | ||
|
|
||
| Rust does not yet ship pre-compiled artifacts for this target. To compile for | ||
| this target, you will either need to build Rust with the target enabled (see | ||
| "Building the target" above), or build your own copy of `core` by using | ||
| `build-std` or similar. | ||
|
|
||
| Compilation can be done with: | ||
|
|
||
| ```sh | ||
| rustc --target x86_64-asan-windows-msvc my_program.rs | ||
| ``` | ||
|
|
||
| ## Testing | ||
|
|
||
| Programs compiled for this target require `clang_rt.asan_dynamic-x86_64.dll` to | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was initially going to suggest we just fold this file into the existing |
||
| be available. This can be installed by using the Visual Studio Installer to | ||
| install the C++ AddressSanitizer component. Once installed, add the directory | ||
eholk marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| containing the DLL to your `PATH` or run your program from a Visual Studio | ||
| Developer Command Prompt. | ||
|
|
||
| ## Cross-compilation toolchains and C code | ||
|
|
||
| Architectural cross-compilation from one Windows host to a different Windows | ||
| platform is natively supported by the MSVC toolchain provided the appropriate | ||
| components are selected when using the VS Installer. | ||
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
Oops, something went wrong.
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.
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.
nit: let's make sure this ends up grouped with
x86_64-asan-unknown-gnuonce #149644 lands.