@@ -683,6 +683,10 @@ pub struct TargetOptions {
683
683
/// target features. This is `true` by default, and `false` for targets like
684
684
/// wasm32 where the whole program either has simd or not.
685
685
pub simd_types_indirect : bool ,
686
+
687
+ /// If set, have the linker export exactly these symbols, instead of using
688
+ /// the usual logic to figure this out from the crate itself.
689
+ pub override_export_symbols : Option < Vec < String > >
686
690
}
687
691
688
692
impl Default for TargetOptions {
@@ -763,6 +767,7 @@ impl Default for TargetOptions {
763
767
emit_debug_gdb_scripts : true ,
764
768
requires_uwtable : false ,
765
769
simd_types_indirect : true ,
770
+ override_export_symbols : None ,
766
771
}
767
772
}
768
773
}
@@ -898,6 +903,14 @@ impl Target {
898
903
)
899
904
) ;
900
905
} ) ;
906
+ ( $key_name: ident, opt_list) => ( {
907
+ let name = ( stringify!( $key_name) ) . replace( "_" , "-" ) ;
908
+ obj. find( & name[ ..] ) . map( |o| o. as_array( )
909
+ . map( |v| base. options. $key_name = Some ( v. iter( )
910
+ . map( |a| a. as_string( ) . unwrap( ) . to_string( ) ) . collect( ) )
911
+ )
912
+ ) ;
913
+ } ) ;
901
914
( $key_name: ident, optional) => ( {
902
915
let name = ( stringify!( $key_name) ) . replace( "_" , "-" ) ;
903
916
if let Some ( o) = obj. find( & name[ ..] ) {
@@ -1044,6 +1057,7 @@ impl Target {
1044
1057
key ! ( emit_debug_gdb_scripts, bool ) ;
1045
1058
key ! ( requires_uwtable, bool ) ;
1046
1059
key ! ( simd_types_indirect, bool ) ;
1060
+ key ! ( override_export_symbols, opt_list) ;
1047
1061
1048
1062
if let Some ( array) = obj. find ( "abi-blacklist" ) . and_then ( Json :: as_array) {
1049
1063
for name in array. iter ( ) . filter_map ( |abi| abi. as_string ( ) ) {
@@ -1253,6 +1267,7 @@ impl ToJson for Target {
1253
1267
target_option_val ! ( emit_debug_gdb_scripts) ;
1254
1268
target_option_val ! ( requires_uwtable) ;
1255
1269
target_option_val ! ( simd_types_indirect) ;
1270
+ target_option_val ! ( override_export_symbols) ;
1256
1271
1257
1272
if default. abi_blacklist != self . options . abi_blacklist {
1258
1273
d. insert ( "abi-blacklist" . to_string ( ) , self . options . abi_blacklist . iter ( )
0 commit comments