@@ -157,6 +157,12 @@ fn copy_third_party_objects(builder: &Builder<'_>, compiler: &Compiler, target:
157
157
copy_and_stamp ( Path :: new ( & src) , "libunwind.a" ) ;
158
158
}
159
159
160
+ if builder. config . sanitizers && compiler. stage != 0 {
161
+ // The sanitizers are only copied in stage1 or above,
162
+ // to avoid creating dependency on LLVM.
163
+ target_deps. extend ( copy_sanitizers ( builder, & compiler, target) ) ;
164
+ }
165
+
160
166
target_deps
161
167
}
162
168
@@ -264,32 +270,30 @@ impl Step for StdLink {
264
270
let libdir = builder. sysroot_libdir ( target_compiler, target) ;
265
271
let hostdir = builder. sysroot_libdir ( target_compiler, compiler. host ) ;
266
272
add_to_sysroot ( builder, & libdir, & hostdir, & libstd_stamp ( builder, compiler, target) ) ;
267
-
268
- if builder. config . sanitizers && compiler. stage != 0 {
269
- // The sanitizers are only copied in stage1 or above,
270
- // to avoid creating dependency on LLVM.
271
- copy_sanitizers ( builder, & target_compiler, target) ;
272
- }
273
273
}
274
274
}
275
275
276
276
/// Copies sanitizer runtime libraries into target libdir.
277
- fn copy_sanitizers ( builder : & Builder < ' _ > , target_compiler : & Compiler , target : Interned < String > ) {
277
+ fn copy_sanitizers ( builder : & Builder < ' _ > ,
278
+ compiler : & Compiler ,
279
+ target : Interned < String > ) -> Vec < PathBuf > {
280
+ let mut target_deps = Vec :: new ( ) ;
281
+
278
282
let sanitizers = supported_sanitizers ( target) ;
279
283
if sanitizers. is_empty ( ) {
280
- return ;
284
+ return target_deps ;
281
285
}
282
286
283
287
let llvm_config: PathBuf = builder. ensure ( native:: Llvm {
284
- target : target_compiler . host ,
288
+ target : compiler . host ,
285
289
} ) ;
286
290
if builder. config . dry_run {
287
- return ;
291
+ return target_deps ;
288
292
}
289
293
290
294
// The compiler-rt installs sanitizer runtimes into clang resource directory.
291
295
let clang_resourcedir = clang_resourcedir ( & llvm_config) ;
292
- let libdir = builder. sysroot_libdir ( * target_compiler , target) ;
296
+ let libdir = builder. sysroot_libdir ( * compiler , target) ;
293
297
294
298
for ( path, name) in & sanitizers {
295
299
let src = clang_resourcedir. join ( path) ;
@@ -310,7 +314,11 @@ fn copy_sanitizers(builder: &Builder<'_>, target_compiler: &Compiler, target: In
310
314
. expect ( "failed to execute `install_name_tool`" ) ;
311
315
assert ! ( status. success( ) ) ;
312
316
}
317
+
318
+ target_deps. push ( dst) ;
313
319
}
320
+
321
+ target_deps
314
322
}
315
323
316
324
/// Returns path to clang's resource directory.
0 commit comments