@@ -30,8 +30,8 @@ pub use cc::{cc, extra_c_flags, extra_cxx_flags, Cc};
3030pub use clang:: { clang, Clang } ;
3131pub use diff:: { diff, Diff } ;
3232pub use llvm:: {
33- llvm_filecheck, llvm_objdump, llvm_profdata, llvm_readobj, LlvmFilecheck , LlvmObjdump ,
34- LlvmProfdata , LlvmReadobj ,
33+ llvm_ar , llvm_filecheck, llvm_objdump, llvm_profdata, llvm_readobj, LlvmAr , LlvmFilecheck ,
34+ LlvmObjdump , LlvmProfdata , LlvmReadobj ,
3535} ;
3636pub use run:: { cmd, run, run_fail, run_with_args} ;
3737pub use rustc:: { aux_build, bare_rustc, rustc, Rustc } ;
@@ -61,19 +61,6 @@ pub fn target() -> String {
6161 env_var ( "TARGET" )
6262}
6363
64- /// `AR`
65- #[ track_caller]
66- pub fn ar ( inputs : & [ impl AsRef < Path > ] , output_path : impl AsRef < Path > ) {
67- let output = fs:: File :: create ( & output_path) . expect ( & format ! (
68- "the file in path \" {}\" could not be created" ,
69- output_path. as_ref( ) . display( )
70- ) ) ;
71- let mut builder = ar:: Builder :: new ( output) ;
72- for input in inputs {
73- builder. append_path ( input) . unwrap ( ) ;
74- }
75- }
76-
7764/// Check if target is windows-like.
7865#[ must_use]
7966pub fn is_windows ( ) -> bool {
@@ -305,12 +292,12 @@ pub fn build_native_static_lib(lib_name: &str) -> PathBuf {
305292 } else {
306293 cc ( ) . arg ( "-v" ) . arg ( "-c" ) . out_exe ( & obj_file) . input ( src) . run ( ) ;
307294 } ;
308- let mut obj_file = PathBuf :: from ( format ! ( "{lib_name}.o" ) ) ;
309- if is_msvc ( ) {
310- obj_file . set_extension ( "" ) ;
311- obj_file . set_extension ( "obj" ) ;
312- }
313- ar ( & [ obj_file ] , & lib_path ) ;
295+ let obj_file = if is_msvc ( ) {
296+ PathBuf :: from ( format ! ( "{lib_name}.obj" ) )
297+ } else {
298+ PathBuf :: from ( format ! ( "{lib_name}.o" ) )
299+ } ;
300+ llvm_ar ( ) . obj_to_ar ( ) . output_input ( & lib_path , & obj_file ) . run ( ) ;
314301 path ( lib_path)
315302}
316303
0 commit comments