@@ -1085,6 +1085,35 @@ impl ToJson for CodeModel {
10851085 }
10861086}
10871087
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+
10881117#[ derive( Clone , Copy , PartialEq , Hash , Debug ) ]
10891118pub enum TlsModel {
10901119 GeneralDynamic ,
@@ -2150,6 +2179,8 @@ pub struct TargetOptions {
21502179 pub env : StaticCow < str > ,
21512180 /// ABI name to distinguish multiple ABIs on the same OS and architecture. For instance, `"eabi"`
21522181 /// 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.
21532184 pub abi : StaticCow < str > ,
21542185 /// Vendor name to use for conditional compilation (`target_vendor`). Defaults to "unknown".
21552186 pub vendor : StaticCow < str > ,
@@ -2446,8 +2477,17 @@ pub struct TargetOptions {
24462477 pub llvm_mcount_intrinsic : Option < StaticCow < str > > ,
24472478
24482479 /// 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`.
24492481 pub llvm_abiname : StaticCow < str > ,
24502482
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 API
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+
24512491 /// Whether or not RelaxElfRelocation flag will be passed to the linker
24522492 pub relax_elf_relocations : bool ,
24532493
@@ -2719,6 +2759,7 @@ impl Default for TargetOptions {
27192759 mcount : "mcount" . into ( ) ,
27202760 llvm_mcount_intrinsic : None ,
27212761 llvm_abiname : "" . into ( ) ,
2762+ llvm_floatabi : None ,
27222763 relax_elf_relocations : false ,
27232764 llvm_args : cvs ! [ ] ,
27242765 use_ctors_section : false ,
0 commit comments