File: strip-all.test

package info (click to toggle)
llvm-toolchain-14 1%3A14.0.6-12
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,496,180 kB
  • sloc: cpp: 5,593,972; ansic: 986,872; asm: 585,869; python: 184,223; objc: 72,530; lisp: 31,119; f90: 27,793; javascript: 9,780; pascal: 9,762; sh: 9,482; perl: 7,468; ml: 5,432; awk: 3,523; makefile: 2,538; xml: 953; cs: 573; fortran: 567
file content (74 lines) | stat: -rw-r--r-- 2,754 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
## Show that llvm-objcopy/llvm-strip removes all symbols and debug sections.

# RUN: yaml2obj %p/Inputs/strip-all.yaml -o %t.exec
# RUN: yaml2obj %p/Inputs/strip-all-with-dwarf.yaml -o %t.dwarf
# RUN: yaml2obj %p/Inputs/strip-chained-fixups.yaml -o %t.fixups

## Check that the symbol list satisfies the order: local / defined external /
## undefined external, otherwise llvm-objcopy will fail.
# RUN: llvm-objcopy %t.exec /dev/null

# RUN: llvm-objcopy --strip-all %t.exec %t.exec.stripped
# RUN: llvm-readobj --sections --relocations --symbols %t.exec.stripped \
# RUN:   | FileCheck --check-prefix=COMMON %s

# RUN: llvm-objcopy --strip-all %t.dwarf %t.dwarf.stripped
# RUN: llvm-readobj --sections --relocations --symbols %t.dwarf.stripped \
# RUN:   | FileCheck --check-prefixes=COMMON,DWARF %s

# RUN: llvm-objcopy --strip-all %t.fixups %t.fixups.stripped
# RUN: llvm-readobj --sections --relocations --symbols %t.fixups.stripped \
# RUN:   | FileCheck --check-prefix=COMMON %s

## The output of "llvm-strip" should be identical with that of
## "llvm-strip --strip-all" and "llvm-objcopy --strip-all".
# RUN: llvm-strip %t.exec -o %t2
# RUN: llvm-strip --strip-all %t.exec -o %t3
# cmp %t2 %t.exec.stripped
# cmp %t3 %t.exec.stripped

# RUN: llvm-strip %t.dwarf -o %t4
# RUN: llvm-strip --strip-all %t.dwarf -o %t5
# cmp %t4 %t.dwarf.stripped
# cmp %t5 %t.dwarf.stripped

# RUN: llvm-lipo %t.dwarf -create -output %t.dwarf.universal
# RUN: llvm-strip %t.dwarf.universal -o %t.dwarf.universal.stripped
# RUN: llvm-lipo %t.dwarf.universal.stripped -thin x86_64 -output %t6
# RUN: cmp %t6 %t.dwarf.stripped

# RUN: llvm-strip %t.exec -o %t7
# RUN: llvm-strip --strip-all %t.exec -o %t8
# cmp %t7 %t.fixups.stripped
# cmp %t8 %t.fixups.stripped

## Make sure that debug sections are removed.
# DWARF:       Sections [
# DWARF-NOT:     Name: __debug_str
# DWARF-NOT:     Name: __debug_abbrev
# DWARF-NOT:     Name: __debug_info
# DWARF-NOT:     Name: __debug_macinfo
# DWARF-NOT:     Name: __apple_names
# DWARF-NOT:     Name: __apple_objc
# DWARF-NOT:     Name: __apple_namespac
# DWARF-NOT:     Name: __apple_types
# DWARF-NOT:     Name: __debug_line
# DWARF:       ]

## Make sure that all relocations and symbols
## (except those which have the flag ReferencedDynamically set) are removed.
# COMMON:      Relocations [
# COMMON-NEXT: ]
# COMMON-NEXT: Symbols [
# COMMON-NEXT:    Symbol {
# COMMON-NEXT:      Name: __mh_execute_header
# COMMON-NEXT:      Extern
# COMMON-NEXT:      Type: Section
# COMMON-NEXT:      Section: __text
# COMMON-NEXT:      RefType: UndefinedNonLazy
# COMMON-NEXT:      Flags [ (0x10)
# COMMON-NEXT:        ReferencedDynamically (0x10)
# COMMON-NEXT:      ]
# COMMON-NEXT:      Value:
# COMMON-NEXT:    }
# COMMON-NEXT: ]