@@ -106,9 +106,11 @@ pub struct LlvmArchiveBuilderBuilder;
106
106
107
107
impl ArchiveBuilderBuilder for LlvmArchiveBuilderBuilder {
108
108
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 {
112
114
Box :: new ( LlvmArchiveBuilder { sess, additions : Vec :: new ( ) } )
113
115
} else {
114
116
Box :: new ( ArArchiveBuilder :: new ( sess, & LLVM_OBJECT_READER ) )
@@ -198,25 +200,11 @@ static LLVM_OBJECT_READER: ObjectReader = ObjectReader {
198
200
get_xcoff_member_alignment : DEFAULT_OBJECT_READER . get_xcoff_member_alignment ,
199
201
} ;
200
202
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
-
211
203
#[ deny( unsafe_op_in_unsafe_fn) ]
212
204
fn get_llvm_object_symbols (
213
205
buf : & [ u8 ] ,
214
206
f : & mut dyn FnMut ( & [ u8 ] ) -> io:: Result < ( ) > ,
215
207
) -> io:: Result < bool > {
216
- if !should_use_llvm_reader ( buf) {
217
- return ( DEFAULT_OBJECT_READER . get_symbols ) ( buf, f) ;
218
- }
219
-
220
208
let mut state = Box :: new ( f) ;
221
209
222
210
let err = unsafe {
@@ -253,18 +241,10 @@ fn get_llvm_object_symbols(
253
241
}
254
242
255
243
fn 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
-
260
244
unsafe { llvm:: LLVMRustIs64BitSymbolicFile ( buf. as_ptr ( ) , buf. len ( ) ) }
261
245
}
262
246
263
247
fn 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
-
268
248
unsafe { llvm:: LLVMRustIsECObject ( buf. as_ptr ( ) , buf. len ( ) ) }
269
249
}
270
250
0 commit comments