@@ -106,9 +106,11 @@ pub struct LlvmArchiveBuilderBuilder;
106106
107107impl ArchiveBuilderBuilder for LlvmArchiveBuilderBuilder {
108108 fn new_archive_builder < ' a > ( & self , sess : & ' a Session ) -> Box < dyn ArchiveBuilder + ' a > {
109- // FIXME use ArArchiveBuilder on most targets again once reading thin archives is
110- // implemented
111- if true {
109+ // Keeping LlvmArchiveBuilder around in case of a regression caused by using
110+ // ArArchiveBuilder.
111+ // FIXME(#128955) remove a couple of months after #128936 gets merged in case
112+ // no regression is found.
113+ if false {
112114 Box :: new ( LlvmArchiveBuilder { sess, additions : Vec :: new ( ) } )
113115 } else {
114116 Box :: new ( ArArchiveBuilder :: new ( sess, & LLVM_OBJECT_READER ) )
@@ -198,25 +200,11 @@ static LLVM_OBJECT_READER: ObjectReader = ObjectReader {
198200 get_xcoff_member_alignment : DEFAULT_OBJECT_READER . get_xcoff_member_alignment ,
199201} ;
200202
201- fn should_use_llvm_reader ( buf : & [ u8 ] ) -> bool {
202- let is_bitcode = unsafe { llvm:: LLVMRustIsBitcode ( buf. as_ptr ( ) , buf. len ( ) ) } ;
203-
204- // COFF bigobj file, msvc LTO file or import library. See
205- // https://github.com/llvm/llvm-project/blob/453f27bc9/llvm/lib/BinaryFormat/Magic.cpp#L38-L51
206- let is_unsupported_windows_obj_file = buf. get ( 0 ..4 ) == Some ( b"\0 \0 \xFF \xFF " ) ;
207-
208- is_bitcode || is_unsupported_windows_obj_file
209- }
210-
211203#[ deny( unsafe_op_in_unsafe_fn) ]
212204fn get_llvm_object_symbols (
213205 buf : & [ u8 ] ,
214206 f : & mut dyn FnMut ( & [ u8 ] ) -> io:: Result < ( ) > ,
215207) -> io:: Result < bool > {
216- if !should_use_llvm_reader ( buf) {
217- return ( DEFAULT_OBJECT_READER . get_symbols ) ( buf, f) ;
218- }
219-
220208 let mut state = Box :: new ( f) ;
221209
222210 let err = unsafe {
@@ -253,18 +241,10 @@ fn get_llvm_object_symbols(
253241}
254242
255243fn llvm_is_64_bit_object_file ( buf : & [ u8 ] ) -> bool {
256- if !should_use_llvm_reader ( buf) {
257- return ( DEFAULT_OBJECT_READER . is_64_bit_object_file ) ( buf) ;
258- }
259-
260244 unsafe { llvm:: LLVMRustIs64BitSymbolicFile ( buf. as_ptr ( ) , buf. len ( ) ) }
261245}
262246
263247fn llvm_is_ec_object_file ( buf : & [ u8 ] ) -> bool {
264- if !should_use_llvm_reader ( buf) {
265- return ( DEFAULT_OBJECT_READER . is_ec_object_file ) ( buf) ;
266- }
267-
268248 unsafe { llvm:: LLVMRustIsECObject ( buf. as_ptr ( ) , buf. len ( ) ) }
269249}
270250
0 commit comments