46 lines · plain
1## Show that llvm-objcopy and llvm-strip emit errors when attempting to modify2## archives containing unrecognized files, and do not modify anything. We use3## --strip-debug so that the section should be removed, and a difference4## detectable, if the file were modified.5 6# RUN: yaml2obj %s -o %t.o7# RUN: rm -f %t.a8# RUN: llvm-ar rc %t.a %t.o %s9# RUN: cp %t.a %t1.a10# RUN: cp %t.a %t2.a11 12# RUN: not llvm-objcopy --strip-debug %t1.a 2>&1 | FileCheck %s -DARCHIVE=%t1.a13# RUN: not llvm-strip --strip-debug %t2.a 2>&1 | FileCheck %s -DARCHIVE=%t2.a14## Verify that the archive was not modified, if any member couldn't be recognized.15# RUN: cmp %t.a %t1.a16# RUN: cmp %t.a %t2.a17 18# CHECK: error: '[[ARCHIVE]](archive-unknown-members.test)': The file was not recognized as a valid object file19 20# RUN: rm -f %t.thin1.a %t.thin2.a21# RUN: cp %t.o %t1.o22# RUN: cp %t.o %t2.o23# RUN: llvm-ar rcT %t.thin1.a %t1.o %s24# RUN: llvm-ar rcT %t.thin2.a %t2.o %s25 26# RUN: not llvm-objcopy --strip-debug %/t.thin1.a 2>&1 \27# RUN: | FileCheck %s --check-prefix=THIN -DARCHIVE=%/t.thin1.a -DMEMBER=%/s28# RUN: not llvm-strip --strip-debug %/t.thin2.a 2>&1 \29# RUN: | FileCheck %s --check-prefix=THIN -DARCHIVE=%/t.thin2.a -DMEMBER=%/s30## Verify that the first member was not modified, if a later member could not31## be recognized.32# RUN: cmp %t.o %t1.o33# RUN: cmp %t.o %t2.o34 35# THIN: error: '[[ARCHIVE]]([[MEMBER]])': The file was not recognized as a valid object file36 37--- !ELF38FileHeader:39 Class: ELFCLASS6440 Data: ELFDATA2LSB41 Type: ET_EXEC42 Machine: EM_X86_6443Sections:44 - Name: .debug_foo45 Type: SHT_PROGBITS46