1 # RUN: yaml2obj %s -o %t
3 # RUN: llvm-objcopy --strip-debug %t %t2
4 # RUN: llvm-readobj --file-headers --sections --symbols %t2 | FileCheck %s
6 # Verify that the previous run of llvm-objcopy has not modified the input.
9 # RUN: llvm-objcopy -g %t %t2g
10 # Verify that --strip-debug and -g produce the same output
13 # RUN: llvm-strip --strip-debug %t3
17 # RUN: llvm-strip -d %t4
21 # RUN: llvm-strip -g %t5
25 # RUN: llvm-strip -S %t6
29 # RUN: llvm-ar crs %t.a %t
30 # RUN: llvm-objcopy --strip-debug %t.a %t.a
31 # RUN: llvm-ar p %t.a > %t7
34 # Verify that an archive with multiple object files is handled correctly.
35 # RUN: cp %t %t.duplicate
36 # RUN: cp %t2 %t.duplicate.stripped
37 # RUN: rm -f %t.multiple-stripped-obj.a
38 # RUN: llvm-ar crs %t.multiple-stripped-obj.a %t2 %t.duplicate.stripped
39 # RUN: rm -f %t.multiple-obj.a
40 # RUN: llvm-ar crs %t.multiple-obj.a %t %t.duplicate
41 # RUN: llvm-objcopy --strip-debug %t.multiple-obj.a %t.multiple-obj.stripped.a
42 # RUN: llvm-ar p %t.multiple-stripped-obj.a > %t.multiple-stripped-obj.a.dump
43 # RUN: llvm-ar p %t.multiple-obj.stripped.a > %t.multiple-obj.stripped.a.dump
44 # RUN: cmp %t.multiple-stripped-obj.a.dump %t.multiple-obj.stripped.a.dump
46 # We can not use %t inside the patterns passed to FileCheck,
47 # thus we have to use "recognizable" file names.
51 # RUN: rm -f %t.non-object.a
52 # RUN: llvm-ar cr %t.non-object.a %t1.o %t2.txt %t3.o
53 # RUN: llvm-ar t %t.non-object.a | FileCheck %s --check-prefix=NON-OBJECT-ARCHIVE-MEMBERS
55 # NON-OBJECT-ARCHIVE-MEMBERS: 1.o
56 # NON-OBJECT-ARCHIVE-MEMBERS-NEXT: 2.txt
57 # NON-OBJECT-ARCHIVE-MEMBERS-NEXT: 3.o
59 # RUN: cp %t.non-object.a %t.non-object.copy.a
60 # RUN: not llvm-objcopy --strip-debug %t.non-object.a %t2.non-object.a 2>&1 | FileCheck %s --check-prefix=BAD-FORMAT
62 # BAD-FORMAT: The file was not recognized as a valid object file
64 # Verify that %t.non-object.a has not been modified.
65 # RUN: cmp %t.non-object.a %t.non-object.copy.a
67 # RUN: rm -f %t.thin.a
68 # Copy %t to %t.thin.archive.member to avoid changing %t directly.
69 # RUN: cp %t %t.thin.archive.member
70 # RUN: llvm-ar crsT %t.thin.a %t.thin.archive.member
71 # RUN: llvm-objcopy --strip-debug %t.thin.a %t2.thin.a
72 # RUN: cat %t.thin.a | FileCheck %s --check-prefix=VERIFY-THIN-ARCHIVE
73 # RUN: cat %t2.thin.a | FileCheck %s --check-prefix=VERIFY-THIN-ARCHIVE
75 # VERIFY-THIN-ARCHIVE: !<thin>
77 # Verify that the member of a thin archive was properly modified.
78 # RUN: cmp %t2 %t.thin.archive.member
80 # RUN: rm -f %t.non-object.thin.a
81 # RUN: llvm-ar crsT %t.non-object.thin.a %t1.o %t2.txt %t3.o
82 # RUN: cp %t.non-object.thin.a %t.non-object.thin.copy.a
83 # RUN: not llvm-objcopy --strip-debug %t.non-object.thin.a %t.non-object.thin.a 2>&1 | FileCheck %s --check-prefix=BAD-FORMAT
85 # Verify that in the case of error thin archive and its memebers are not getting modified.
86 # RUN: cmp %t.non-object.thin.a %t.non-object.thin.copy.a
101 ## .zdebug is no longer recognized as a debug section.
110 Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
111 AddressAlign: 0x0000000000000010
123 # CHECK: SectionHeaderCount: 6
125 # CHECK: Name: .zdebugfoo
127 # CHECK: Name: .symtab
128 # CHECK: Name: .strtab
129 # CHECK: Name: .shstrtab
131 # Check that *only* foo is copied and not debugfoo or filesymbol.
133 # CHECK-NEXT: Symbol {
137 # CHECK-NEXT: Binding:
140 # CHECK-NEXT: Section: Undefined
142 # CHECK-NEXT: Symbol {
143 # CHECK-NEXT: Name: foo
146 # CHECK-NEXT: Binding: Global
149 # CHECK-NEXT: Section: .text