1 ## Show that llvm-objcopy/llvm-strip removes all symbols and debug sections.
3 # RUN: yaml2obj %p/Inputs/strip-all.yaml -o %t.exec
4 # RUN: yaml2obj %p/Inputs/strip-all-with-dwarf.yaml -o %t.dwarf
5 # RUN: yaml2obj %p/Inputs/strip-chained-fixups.yaml -o %t.fixups
6 # RUN: yaml2obj %p/Inputs/strip-all-with-codesignature.yaml -o %t.codesignature
8 ## Check that the symbol list satisfies the order: local / defined external /
9 ## undefined external, otherwise llvm-objcopy will fail.
10 # RUN: llvm-objcopy %t.exec /dev/null
12 # RUN: llvm-objcopy --strip-all %t.exec %t.exec.stripped
13 # RUN: llvm-readobj --sections --relocations --symbols %t.exec.stripped \
14 # RUN: | FileCheck --check-prefix=COMMON %s
16 # RUN: llvm-objcopy --strip-all %t.dwarf %t.dwarf.stripped
17 # RUN: llvm-readobj --sections --relocations --symbols %t.dwarf.stripped \
18 # RUN: | FileCheck --check-prefixes=COMMON,DWARF %s
20 # RUN: llvm-objcopy --strip-all %t.fixups %t.fixups.stripped
21 # RUN: llvm-readobj --sections --relocations --symbols %t.fixups.stripped \
22 # RUN: | FileCheck --check-prefix=COMMON %s
24 ## The output of "llvm-strip" should be identical with that of
25 ## "llvm-strip --strip-all" and "llvm-objcopy --strip-all".
26 # RUN: llvm-strip %t.exec -o %t2
27 # RUN: llvm-strip --strip-all %t.exec -o %t3
28 # RUN: cmp %t2 %t.exec.stripped
29 # RUN: cmp %t3 %t.exec.stripped
31 # RUN: llvm-strip %t.dwarf -o %t4
32 # RUN: llvm-strip --strip-all %t.dwarf -o %t5
33 # RUN: cmp %t4 %t.dwarf.stripped
34 # RUN: cmp %t5 %t.dwarf.stripped
36 # RUN: llvm-lipo %t.dwarf -create -output %t.dwarf.universal
37 # RUN: llvm-strip %t.dwarf.universal -o %t.dwarf.universal.stripped
38 # RUN: llvm-lipo %t.dwarf.universal.stripped -thin x86_64 -output %t6
39 # RUN: cmp %t6 %t.dwarf.stripped
41 # RUN: llvm-strip %t.fixups -o %t7
42 # RUN: llvm-strip --strip-all %t.fixups -o %t8
43 # RUN: cmp %t7 %t.fixups.stripped
44 # RUN: cmp %t8 %t.fixups.stripped
46 # RUN: llvm-objcopy --strip-all %t.codesignature %t9
47 # RUN: llvm-otool -l %t9 | FileCheck --check-prefix=CODESIGNATURE %s
48 # RUN: llvm-strip %t.codesignature -o %t10
49 # RUN: llvm-otool -l %t10 | FileCheck --check-prefix=CODESIGNATURE %s
50 # RUN: llvm-strip --strip-all %t.codesignature -o %t11
51 # RUN: llvm-otool -l %t11 | FileCheck --check-prefix=CODESIGNATURE %s
53 ## Make sure that code signatures are preserved
55 # CODESIGNATURE: cmd LC_DYLIB_CODE_SIGN_DRS
56 # CODESIGNATURE-NEXT: cmdsize 16
57 # CODESIGNATURE-NEXT: dataoff 8408
58 # CODESIGNATURE-NEXT: datasize 64
59 # CODESIGNATURE-NEXT: Load command
60 # CODESIGNATURE-NEXT: cmd LC_CODE_SIGNATURE
61 # CODESIGNATURE-NEXT: cmdsize 16
62 # CODESIGNATURE-NEXT: dataoff 8480
63 # CODESIGNATURE-NEXT: datasize 240
65 ## Make sure that debug sections are removed.
67 # DWARF-NOT: Name: __debug_str
68 # DWARF-NOT: Name: __debug_abbrev
69 # DWARF-NOT: Name: __debug_info
70 # DWARF-NOT: Name: __debug_macinfo
71 # DWARF-NOT: Name: __apple_names
72 # DWARF-NOT: Name: __apple_objc
73 # DWARF-NOT: Name: __apple_namespac
74 # DWARF-NOT: Name: __apple_types
75 # DWARF-NOT: Name: __debug_line
78 ## Make sure that all relocations and symbols
79 ## (except those which have the flag ReferencedDynamically set) are removed.
80 # COMMON: Relocations [
82 # COMMON-NEXT: Symbols [
83 # COMMON-NEXT: Symbol {
84 # COMMON-NEXT: Name: __mh_execute_header
86 # COMMON-NEXT: Type: Section
87 # COMMON-NEXT: Section: __text
88 # COMMON-NEXT: RefType: UndefinedNonLazy
89 # COMMON-NEXT: Flags [ (0x10)
90 # COMMON-NEXT: ReferencedDynamically (0x10)