@@ -1085,6 +1085,35 @@ impl ToJson for CodeModel {
1085
1085
}
1086
1086
}
1087
1087
1088
+ /// The float ABI setting to be configured in the LLVM target machine.
1089
+ #[ derive( Clone , Copy , PartialEq , Hash , Debug ) ]
1090
+ pub enum FloatAbi {
1091
+ Soft ,
1092
+ Hard ,
1093
+ }
1094
+
1095
+ impl FromStr for FloatAbi {
1096
+ type Err = ( ) ;
1097
+
1098
+ fn from_str ( s : & str ) -> Result < FloatAbi , ( ) > {
1099
+ Ok ( match s {
1100
+ "soft" => FloatAbi :: Soft ,
1101
+ "hard" => FloatAbi :: Hard ,
1102
+ _ => return Err ( ( ) ) ,
1103
+ } )
1104
+ }
1105
+ }
1106
+
1107
+ impl ToJson for FloatAbi {
1108
+ fn to_json ( & self ) -> Json {
1109
+ match * self {
1110
+ FloatAbi :: Soft => "soft" ,
1111
+ FloatAbi :: Hard => "hard" ,
1112
+ }
1113
+ . to_json ( )
1114
+ }
1115
+ }
1116
+
1088
1117
#[ derive( Clone , Copy , PartialEq , Hash , Debug ) ]
1089
1118
pub enum TlsModel {
1090
1119
GeneralDynamic ,
@@ -2150,6 +2179,8 @@ pub struct TargetOptions {
2150
2179
pub env : StaticCow < str > ,
2151
2180
/// ABI name to distinguish multiple ABIs on the same OS and architecture. For instance, `"eabi"`
2152
2181
/// or `"eabihf"`. Defaults to "".
2182
+ /// This field is *not* forwarded directly to LLVM; its primary purpose is `cfg(target_abi)`.
2183
+ /// However, parts of the backend do check this field for specific values to enable special behavior.
2153
2184
pub abi : StaticCow < str > ,
2154
2185
/// Vendor name to use for conditional compilation (`target_vendor`). Defaults to "unknown".
2155
2186
pub vendor : StaticCow < str > ,
@@ -2446,8 +2477,17 @@ pub struct TargetOptions {
2446
2477
pub llvm_mcount_intrinsic : Option < StaticCow < str > > ,
2447
2478
2448
2479
/// LLVM ABI name, corresponds to the '-mabi' parameter available in multilib C compilers
2480
+ /// and the `-target-abi` flag in llc. In the LLVM API this is `MCOptions.ABIName`.
2449
2481
pub llvm_abiname : StaticCow < str > ,
2450
2482
2483
+ /// Control the float ABI to use, for architectures that support it. The only architecture we
2484
+ /// currently use this for is ARM. Corresponds to the `-float-abi` flag in llc. In the LLVM ABI
2485
+ /// this is `FloatABIType`. (clang's `-mfloat-abi` is similar but more complicated since it
2486
+ /// can also affect the `soft-float` target feature.)
2487
+ ///
2488
+ /// If not provided, LLVM will infer the float ABI from the target triple (`llvm_target`).
2489
+ pub llvm_floatabi : Option < FloatAbi > ,
2490
+
2451
2491
/// Whether or not RelaxElfRelocation flag will be passed to the linker
2452
2492
pub relax_elf_relocations : bool ,
2453
2493
@@ -2719,6 +2759,7 @@ impl Default for TargetOptions {
2719
2759
mcount : "mcount" . into ( ) ,
2720
2760
llvm_mcount_intrinsic : None ,
2721
2761
llvm_abiname : "" . into ( ) ,
2762
+ llvm_floatabi : None ,
2722
2763
relax_elf_relocations : false ,
2723
2764
llvm_args : cvs ! [ ] ,
2724
2765
use_ctors_section : false ,
0 commit comments