forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#74103 - ajpaverd:cfguard-msvc-only, r=nikom…
…atsakis Only add CFGuard on `windows-msvc` targets As @ollie27 pointed out in rust-lang#73893, the `cfguard` module flag causes incorrect behavior on `windows-gnu` targets. This patch restricts rustc to only add this flag for `windows-msvc` targets (this may need to be changed if other linkers gain support for CFGuard).
- Loading branch information
Showing
7 changed files
with
36 additions
and
19 deletions.
There are no files selected for viewing
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
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
1 change: 1 addition & 0 deletions
1
src/test/codegen/cfguard_checks.rs → src/test/codegen/cfguard-checks.rs
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
// compile-flags: -Z control-flow-guard=checks | ||
// only-msvc | ||
|
||
#![crate_type = "lib"] | ||
|
||
|
1 change: 1 addition & 0 deletions
1
src/test/codegen/cfguard_disabled.rs → src/test/codegen/cfguard-disabled.rs
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
// compile-flags: -Z control-flow-guard=no | ||
// only-msvc | ||
|
||
#![crate_type = "lib"] | ||
|
||
|
1 change: 1 addition & 0 deletions
1
src/test/codegen/cfguard_nochecks.rs → src/test/codegen/cfguard-nochecks.rs
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
// compile-flags: -Z control-flow-guard=nochecks | ||
// only-msvc | ||
|
||
#![crate_type = "lib"] | ||
|
||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// compile-flags: -Z control-flow-guard | ||
// ignore-msvc | ||
|
||
#![crate_type = "lib"] | ||
|
||
// A basic test function. | ||
pub fn test() { | ||
} | ||
|
||
// Ensure the cfguard module flag is not added for non-MSVC targets. | ||
// CHECK-NOT: !"cfguard" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
// run-pass | ||
// compile-flags: -Z control-flow-guard | ||
|
||
pub fn main() { | ||
println!("hello, world"); | ||
} |