-
Notifications
You must be signed in to change notification settings - Fork 13.5k
make -Zmin-function-alignment
a target modifier
#143323
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
folkertdev
wants to merge
1
commit into
rust-lang:master
Choose a base branch
from
folkertdev:min-function-alignment-target-modifier
base: master
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.
+72
−7
Open
Changes from all commits
Commits
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
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
7 changes: 7 additions & 0 deletions
7
tests/ui/target_modifiers/auxiliary/min_function_alignment.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,7 @@ | ||
//@ no-prefer-dynamic | ||
//@ compile-flags: --target aarch64-unknown-none -Zmin-function-alignment=32 | ||
//@ needs-llvm-components: aarch64 | ||
|
||
#![feature(no_core)] | ||
#![crate_type = "rlib"] | ||
#![no_core] |
13 changes: 13 additions & 0 deletions
13
tests/ui/target_modifiers/incompatible_min_function_alignment.error_mismatch.stderr
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,13 @@ | ||
error: mixing `-Zmin-function-alignment` will cause an ABI mismatch in crate `incompatible_min_function_alignment` | ||
--> $DIR/incompatible_min_function_alignment.rs:13:1 | ||
| | ||
LL | #![feature(no_core)] | ||
| ^ | ||
| | ||
= help: the `-Zmin-function-alignment` flag modifies the ABI so Rust crates compiled with different values of this flag cannot be used together safely | ||
= note: `-Zmin-function-alignment=4` in this crate is incompatible with `-Zmin-function-alignment=32` in dependency `min_function_alignment` | ||
= help: set `-Zmin-function-alignment=32` in this crate or `-Zmin-function-alignment=4` in `min_function_alignment` | ||
= help: if you are sure this will not cause problems, you may use `-Cunsafe-allow-abi-mismatch=min-function-alignment` to silence this error | ||
|
||
error: aborting due to 1 previous error | ||
|
13 changes: 13 additions & 0 deletions
13
tests/ui/target_modifiers/incompatible_min_function_alignment.error_omitted.stderr
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,13 @@ | ||
error: mixing `-Zmin-function-alignment` will cause an ABI mismatch in crate `incompatible_min_function_alignment` | ||
--> $DIR/incompatible_min_function_alignment.rs:13:1 | ||
| | ||
LL | #![feature(no_core)] | ||
| ^ | ||
| | ||
= help: the `-Zmin-function-alignment` flag modifies the ABI so Rust crates compiled with different values of this flag cannot be used together safely | ||
= note: unset `-Zmin-function-alignment` in this crate is incompatible with `-Zmin-function-alignment=32` in dependency `min_function_alignment` | ||
= help: set `-Zmin-function-alignment=32` in this crate or unset `-Zmin-function-alignment` in `min_function_alignment` | ||
= help: if you are sure this will not cause problems, you may use `-Cunsafe-allow-abi-mismatch=min-function-alignment` to silence this error | ||
|
||
error: aborting due to 1 previous error | ||
|
18 changes: 18 additions & 0 deletions
18
tests/ui/target_modifiers/incompatible_min_function_alignment.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,18 @@ | ||
//@ aux-build:min_function_alignment.rs | ||
//@ compile-flags: --target aarch64-unknown-none | ||
//@ needs-llvm-components: aarch64 | ||
|
||
//@ revisions:allow_match allow_mismatch error_mismatch error_omitted | ||
//@[allow_match] compile-flags: -Zmin-function-alignment=32 | ||
//@[allow_mismatch] compile-flags: -Cunsafe-allow-abi-mismatch=min-function-alignment | ||
//@[error_mismatch] compile-flags: -Zmin-function-alignment=4 | ||
//@[error_omitted] compile-flags: | ||
//@[allow_mismatch] check-pass | ||
//@[allow_match] check-pass | ||
|
||
#![feature(no_core)] | ||
//[error_mismatch,error_omitted]~^ ERROR mixing `-Zmin-function-alignment` will cause an ABI mismatch in crate `incompatible_min_function_alignment` | ||
#![crate_type = "rlib"] | ||
#![no_core] | ||
|
||
extern crate min_function_alignment; |
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.
Uh oh!
There was an error while loading. Please reload this page.
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.
Discussion: when this isn't a language guarantee, it's almost like this should be a warning/warn-by-default lint and not an error, right?
When this is a hint, then the current target modifier infra/error message might be a bit confusing