@@ -683,6 +683,10 @@ pub struct TargetOptions {
683683 /// target features. This is `true` by default, and `false` for targets like
684684 /// wasm32 where the whole program either has simd or not.
685685 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 > >
686690}
687691
688692impl Default for TargetOptions {
@@ -763,6 +767,7 @@ impl Default for TargetOptions {
763767 emit_debug_gdb_scripts : true ,
764768 requires_uwtable : false ,
765769 simd_types_indirect : true ,
770+ override_export_symbols : None ,
766771 }
767772 }
768773}
@@ -898,6 +903,14 @@ impl Target {
898903 )
899904 ) ;
900905 } ) ;
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+ } ) ;
901914 ( $key_name: ident, optional) => ( {
902915 let name = ( stringify!( $key_name) ) . replace( "_" , "-" ) ;
903916 if let Some ( o) = obj. find( & name[ ..] ) {
@@ -1044,6 +1057,7 @@ impl Target {
10441057 key ! ( emit_debug_gdb_scripts, bool ) ;
10451058 key ! ( requires_uwtable, bool ) ;
10461059 key ! ( simd_types_indirect, bool ) ;
1060+ key ! ( override_export_symbols, opt_list) ;
10471061
10481062 if let Some ( array) = obj. find ( "abi-blacklist" ) . and_then ( Json :: as_array) {
10491063 for name in array. iter ( ) . filter_map ( |abi| abi. as_string ( ) ) {
@@ -1253,6 +1267,7 @@ impl ToJson for Target {
12531267 target_option_val ! ( emit_debug_gdb_scripts) ;
12541268 target_option_val ! ( requires_uwtable) ;
12551269 target_option_val ! ( simd_types_indirect) ;
1270+ target_option_val ! ( override_export_symbols) ;
12561271
12571272 if default. abi_blacklist != self . options . abi_blacklist {
12581273 d. insert ( "abi-blacklist" . to_string ( ) , self . options . abi_blacklist . iter ( )
0 commit comments