@@ -493,14 +493,11 @@ mod c {
493
493
// sets of flags to the same source file.
494
494
let src_dir = root. join ( "lib/builtins" ) ;
495
495
if target_arch == "aarch64" {
496
- let atomics_libs = build_aarch64_out_of_line_atomics_libraries ( & src_dir, cfg) ;
497
- if !atomics_libs. is_empty ( ) {
498
- for library in atomics_libs {
499
- cfg. object ( library) ;
500
- }
501
- // Some run-time CPU feature detection is necessary, as well.
502
- sources. extend ( & [ ( "__aarch64_have_lse_atomics" , "cpu_model.c" ) ] ) ;
503
- }
496
+ // See below for why we're building these as separate libraries.
497
+ build_aarch64_out_of_line_atomics_libraries ( & src_dir, cfg) ;
498
+
499
+ // Some run-time CPU feature detection is necessary, as well.
500
+ sources. extend ( & [ ( "__aarch64_have_lse_atomics" , "cpu_model.c" ) ] ) ;
504
501
}
505
502
506
503
for ( sym, src) in sources. map . iter ( ) {
@@ -513,10 +510,7 @@ mod c {
513
510
cfg. compile ( "libcompiler-rt.a" ) ;
514
511
}
515
512
516
- fn build_aarch64_out_of_line_atomics_libraries (
517
- builtins_dir : & Path ,
518
- cfg : & cc:: Build ,
519
- ) -> Vec < PathBuf > {
513
+ fn build_aarch64_out_of_line_atomics_libraries ( builtins_dir : & Path , cfg : & cc:: Build ) {
520
514
// NOTE: because we're recompiling the same source file in N different ways, building
521
515
// serially is necessary. If we want to lift this restriction, we can either:
522
516
// - create symlinks to lse.S and build those_(though we'd still need to pass special
@@ -528,11 +522,8 @@ mod c {
528
522
let outlined_atomics_file = builtins_dir. join ( "aarch64/lse.S" ) ;
529
523
println ! ( "cargo:rerun-if-changed={}" , outlined_atomics_file. display( ) ) ;
530
524
531
- let out_dir: PathBuf = env:: var ( "OUT_DIR" ) . unwrap ( ) . into ( ) ;
532
-
533
525
// Ideally, this would be a Vec of object files, but cc doesn't make it *entirely*
534
526
// trivial to build an individual object.
535
- let mut atomics_libraries = Vec :: new ( ) ;
536
527
for instruction_type in & [ "cas" , "swp" , "ldadd" , "ldclr" , "ldeor" , "ldset" ] {
537
528
for size in & [ 1 , 2 , 4 , 8 , 16 ] {
538
529
if * size == 16 && * instruction_type != "cas" {
@@ -556,11 +547,9 @@ mod c {
556
547
. file ( & outlined_atomics_file) ;
557
548
cfg. compile ( & library_name) ;
558
549
559
- atomics_libraries. push ( out_dir. join ( library_name) ) ;
560
550
println ! ( "cargo:rustc-cfg={}=\" optimized-c\" " , sym) ;
561
551
}
562
552
}
563
553
}
564
- atomics_libraries
565
554
}
566
555
}
0 commit comments