File tree Expand file tree Collapse file tree 1 file changed +8
-9
lines changed Expand file tree Collapse file tree 1 file changed +8
-9
lines changed Original file line number Diff line number Diff line change @@ -98,30 +98,29 @@ fn build_hermit(src_dir: &Path, target_dir_opt: Option<&Path>) {
9898 }
9999
100100 let mut rustflags = vec ! [ "-Zmutable-noalias=no" . to_string( ) ] ;
101+ let outer_rustflags = env:: var ( "CARGO_ENCODED_RUSTFLAGS" ) . unwrap ( ) ;
101102
102103 #[ cfg( feature = "instrument" ) ]
103104 {
104105 rustflags. push ( "-Zinstrument-mcount" . to_string ( ) ) ;
105- // Add outer `RUSTFLAGS` to command
106- if let Ok ( var) = env:: var ( "RUSTFLAGS" ) {
107- rustflags. push ( var) ;
108- }
106+ // Add outer rustflags to command
107+ rustflags. push ( outer_rustflags) ;
109108 }
110109
111110 #[ cfg( not( feature = "instrument" ) ) ]
112111 {
113112 // If the `instrument` feature feature is not enabled,
114- // filter it from outer `RUSTFLAGS` before adding them to the command.
115- if let Ok ( var ) = env :: var ( "RUSTFLAGS" ) {
116- let flags = var
117- . split ( ', ' )
113+ // filter it from outer rustflags before adding them to the command.
114+ if !outer_rustflags . is_empty ( ) {
115+ let flags = outer_rustflags
116+ . split ( '\x1f ' )
118117 . filter ( |& flag| !flag. contains ( "instrument-mcount" ) )
119118 . map ( String :: from) ;
120119 rustflags. extend ( flags) ;
121120 }
122121 }
123122
124- cmd. env ( "RUSTFLAGS " , rustflags. join ( " " ) ) ;
123+ cmd. env ( "CARGO_ENCODED_RUSTFLAGS " , rustflags. join ( "\x1f " ) ) ;
125124
126125 let status = cmd. status ( ) . expect ( "failed to start kernel build" ) ;
127126 assert ! ( status. success( ) ) ;
You can’t perform that action at this time.
0 commit comments