1## Show that llvm-objcopy and llvm-strip emit errors when attempting to modify 2## archives containing unrecognized files, and do not modify anything. We use 3## --strip-debug so that the section should be removed, and a difference 4## detectable, if the file were modified. 5 6# RUN: yaml2obj %s -o %t.o 7# RUN: rm -f %t.a 8# RUN: llvm-ar rc %t.a %t.o %s 9# RUN: cp %t.a %t1.a 10# RUN: cp %t.a %t2.a 11 12# RUN: not llvm-objcopy --strip-debug %t1.a 2>&1 | FileCheck %s -DARCHIVE=%t1.a 13# RUN: not llvm-strip --strip-debug %t2.a 2>&1 | FileCheck %s -DARCHIVE=%t2.a 14## Verify that the archive was not modified, if any member couldn't be recognized. 15# RUN: cmp %t.a %t1.a 16# RUN: cmp %t.a %t2.a 17 18# CHECK: error: '[[ARCHIVE]](archive-unknown-members.test)': The file was not recognized as a valid object file 19 20# RUN: rm -f %t.thin1.a %t.thin2.a 21# RUN: cp %t.o %t1.o 22# RUN: cp %t.o %t2.o 23# RUN: llvm-ar rcT %t.thin1.a %t1.o %s 24# RUN: llvm-ar rcT %t.thin2.a %t2.o %s 25 26# RUN: not llvm-objcopy --strip-debug %/t.thin1.a 2>&1 \ 27# RUN: | FileCheck %s --check-prefix=THIN -DARCHIVE=%/t.thin1.a -DMEMBER=%/s 28# RUN: not llvm-strip --strip-debug %/t.thin2.a 2>&1 \ 29# RUN: | FileCheck %s --check-prefix=THIN -DARCHIVE=%/t.thin2.a -DMEMBER=%/s 30## Verify that the first member was not modified, if a later member could not 31## be recognized. 32# RUN: cmp %t.o %t1.o 33# RUN: cmp %t.o %t2.o 34 35# THIN: error: '[[ARCHIVE]]([[MEMBER]])': The file was not recognized as a valid object file 36 37--- !ELF 38FileHeader: 39 Class: ELFCLASS64 40 Data: ELFDATA2LSB 41 Type: ET_EXEC 42 Machine: EM_X86_64 43Sections: 44 - Name: .debug_foo 45 Type: SHT_PROGBITS 46