Skip to content

Commit 4b58c50

Browse files
committed
Make -Zfixed-x18 into a target modifier
1 parent db074a0 commit 4b58c50

File tree

4 files changed

+38
-1
lines changed

4 files changed

+38
-1
lines changed

compiler/rustc_session/src/options.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2208,7 +2208,7 @@ options! {
22082208
fewer_names: Option<bool> = (None, parse_opt_bool, [TRACKED],
22092209
"reduce memory use by retaining fewer names within compilation artifacts (LLVM-IR) \
22102210
(default: no)"),
2211-
fixed_x18: bool = (false, parse_bool, [TRACKED],
2211+
fixed_x18: bool = (false, parse_bool, [TRACKED TARGET_MODIFIER],
22122212
"make the x18 register reserved on AArch64 (default: no)"),
22132213
flatten_format_args: bool = (true, parse_bool, [TRACKED],
22142214
"flatten nested format_args!() and literals into a simplified format_args!() call \
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
//@ no-prefer-dynamic
2+
//@ compile-flags: --target aarch64-unknown-none -Zfixed-x18
3+
//@ needs-llvm-components: aarch64
4+
5+
#![feature(no_core)]
6+
#![crate_type = "rlib"]
7+
#![no_core]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
error: mixing `-Zfixed-x18` will cause an ABI mismatch in crate `incompatible_fixedx18`
2+
--> $DIR/incompatible_fixedx18.rs:12:1
3+
|
4+
LL | #![feature(no_core)]
5+
| ^
6+
|
7+
= help: the `-Zfixed-x18` flag modifies the ABI so Rust crates compiled with different values of this flag cannot be used together safely
8+
= note: unset `-Zfixed-x18` in this crate is incompatible with `-Zfixed-x18=` in dependency `fixed_x18`
9+
= help: set `-Zfixed-x18=` in this crate or unset `-Zfixed-x18` in `fixed_x18`
10+
= help: if you are sure this will not cause problems, you may use `-Cunsafe-allow-abi-mismatch=fixed-x18` to silence this error
11+
12+
error: aborting due to 1 previous error
13+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
//@ aux-build:fixed_x18.rs
2+
//@ compile-flags: --target aarch64-unknown-none
3+
//@ needs-llvm-components: aarch64
4+
5+
//@ revisions:allow_match allow_mismatch error_generated
6+
//@[allow_match] compile-flags: -Zfixed-x18
7+
//@[allow_mismatch] compile-flags: -Cunsafe-allow-abi-mismatch=fixed-x18
8+
//@[error_generated] compile-flags:
9+
//@[allow_mismatch] check-pass
10+
//@[allow_match] check-pass
11+
12+
#![feature(no_core)]
13+
//[error_generated]~^ ERROR mixing `-Zfixed-x18` will cause an ABI mismatch in crate `incompatible_fixedx18`
14+
#![crate_type = "rlib"]
15+
#![no_core]
16+
17+
extern crate fixed_x18;

0 commit comments

Comments
 (0)