3 files changed +47
-0
lines changed Original file line number Diff line number Diff line change @@ -923,6 +923,28 @@ impl Target {
923
923
_ => unreachable ! ( ) ,
924
924
}
925
925
}
926
+ "loongarch64" => {
927
+ // LoongArch handles ABI in a very sane way, being fully explicit via `llvm_abiname`
928
+ // about what the intended ABI is.
929
+ match & * self . llvm_abiname {
930
+ "ilp32d" | "lp64d" => {
931
+ // Requires d (which implies f), incompatible with nothing.
932
+ FeatureConstraints { required : & [ "d" ] , incompatible : & [ ] }
933
+ }
934
+ "ilp32f" | "lp64f" => {
935
+ // Requires f, incompatible with nothing.
936
+ FeatureConstraints { required : & [ "f" ] , incompatible : & [ ] }
937
+ }
938
+ "ilp32s" | "lp64s" => {
939
+ // The soft-float ABI does not require any features and is also not
940
+ // incompatible with any features. Rust targets explicitly specify the
941
+ // LLVM ABI names, which allows for enabling hard-float support even on
942
+ // soft-float targets, and ensures that the ABI behavior is as expected.
943
+ NOTHING
944
+ }
945
+ _ => unreachable ! ( ) ,
946
+ }
947
+ }
926
948
_ => NOTHING ,
927
949
}
928
950
}
Original file line number Diff line number Diff line change
1
+ //@ compile-flags: --target=loongarch64-unknown-linux-gnu --crate-type=lib
2
+ //@ needs-llvm-components: loongarch
3
+ //@ compile-flags: -Ctarget-feature=-d
4
+ //@ min-llvm-version: 20
5
+ // For now this is just a warning.
6
+ //@ build-pass
7
+ //@error-pattern: must be enabled to ensure that the ABI
8
+ #![ feature( no_core, lang_items) ]
9
+ #![ no_core]
10
+
11
+ #[ lang = "sized" ]
12
+ pub trait Sized { }
Original file line number Diff line number Diff line change
1
+ warning: target feature `d` must be enabled to ensure that the ABI of the current target can be implemented correctly
2
+ |
3
+ = note: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
4
+ = note: for more information, see issue #116344 <https://github.com/rust-lang/rust/issues/116344>
5
+
6
+ warning: unstable feature specified for `-Ctarget-feature`: `d`
7
+ |
8
+ = note: this feature is not stably supported; its behavior can change in the future
9
+
10
+ warning: both target-abi and the triple-implied ABI are invalid, ignoring and using feature-implied ABI
11
+ warning: 'lp64f' has not been standardized
12
+ warning: 2 warnings emitted
13
+
0 commit comments