@@ -580,8 +580,10 @@ pub struct TargetOptions {
580580 /// user-defined libraries.
581581 pub post_link_args : LinkArgs ,
582582
583- /// Environment variables to be set before invoking the linker.
583+ /// Environment variables to be set for the linker invocation .
584584 pub link_env : Vec < ( String , String ) > ,
585+ /// Environment variables to be removed for the linker invocation.
586+ pub link_env_remove : Vec < String > ,
585587
586588 /// Extra arguments to pass to the external assembler (when used)
587589 pub asm_args : Vec < String > ,
@@ -843,6 +845,7 @@ impl Default for TargetOptions {
843845 post_link_objects_crt : Vec :: new ( ) ,
844846 late_link_args : LinkArgs :: new ( ) ,
845847 link_env : Vec :: new ( ) ,
848+ link_env_remove : Vec :: new ( ) ,
846849 archive_format : "gnu" . to_string ( ) ,
847850 custom_unwind_resume : false ,
848851 allow_asm : true ,
@@ -1118,6 +1121,7 @@ impl Target {
11181121 key ! ( post_link_objects_crt, list) ;
11191122 key ! ( post_link_args, link_args) ;
11201123 key ! ( link_env, env) ;
1124+ key ! ( link_env_remove, list) ;
11211125 key ! ( asm_args, list) ;
11221126 key ! ( cpu) ;
11231127 key ! ( features) ;
@@ -1334,6 +1338,7 @@ impl ToJson for Target {
13341338 target_option_val ! ( post_link_objects_crt) ;
13351339 target_option_val ! ( link_args - post_link_args) ;
13361340 target_option_val ! ( env - link_env) ;
1341+ target_option_val ! ( link_env_remove) ;
13371342 target_option_val ! ( asm_args) ;
13381343 target_option_val ! ( cpu) ;
13391344 target_option_val ! ( features) ;
0 commit comments