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>) {
98
98
}
99
99
100
100
let mut rustflags = vec ! [ "-Zmutable-noalias=no" . to_string( ) ] ;
101
+ let outer_rustflags = env:: var ( "CARGO_ENCODED_RUSTFLAGS" ) . unwrap ( ) ;
101
102
102
103
#[ cfg( feature = "instrument" ) ]
103
104
{
104
105
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) ;
109
108
}
110
109
111
110
#[ cfg( not( feature = "instrument" ) ) ]
112
111
{
113
112
// 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 ' )
118
117
. filter ( |& flag| !flag. contains ( "instrument-mcount" ) )
119
118
. map ( String :: from) ;
120
119
rustflags. extend ( flags) ;
121
120
}
122
121
}
123
122
124
- cmd. env ( "RUSTFLAGS " , rustflags. join ( " " ) ) ;
123
+ cmd. env ( "CARGO_ENCODED_RUSTFLAGS " , rustflags. join ( "\x1f " ) ) ;
125
124
126
125
let status = cmd. status ( ) . expect ( "failed to start kernel build" ) ;
127
126
assert ! ( status. success( ) ) ;
You can’t perform that action at this time.
0 commit comments