File: strip-debug.test

package info (click to toggle)
llvm-toolchain-20 1%3A20.1.8-1~exp1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 2,111,388 kB
  • sloc: cpp: 7,438,767; ansic: 1,393,871; asm: 1,012,926; python: 241,728; f90: 86,635; objc: 75,411; lisp: 42,144; pascal: 17,286; sh: 10,027; ml: 5,082; perl: 4,730; awk: 3,523; makefile: 3,349; javascript: 2,251; xml: 892; fortran: 672
file content (112 lines) | stat: -rw-r--r-- 3,294 bytes parent folder | download | duplicates (4)
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
# RUN: yaml2obj %s -o %t
# RUN: cp %t %t3
# RUN: llvm-objcopy --strip-debug %t %t2
## Test that debug sections (but not linking or names) are stripped with --strip-debug
# RUN: obj2yaml %t2 | FileCheck --implicit-check-not=.debug %s
#
# RUN: llvm-objcopy -g %t %t2g
# Verify that --strip-debug and -g produce the same output
# RUN: cmp %t2 %t2g

# RUN: llvm-strip --strip-debug %t3
# RUN: cmp %t2 %t3

# RUN: cp %t %t4
# RUN: llvm-strip -d %t4
# RUN: cmp %t2 %t4

# RUN: cp %t %t5
# RUN: llvm-strip -g %t5
# RUN: cmp %t2 %t5

# RUN: cp %t %t6
# RUN: llvm-strip -S %t6
# RUN: cmp %t2 %t6

# Verify that an archive with multiple object files is handled correctly.
# RUN: cp %t %t.duplicate
# RUN: cp %t2 %t.duplicate.stripped
# RUN: rm -f %t.multiple-stripped-obj.a
# RUN: llvm-ar crs %t.multiple-stripped-obj.a %t2 %t.duplicate.stripped
# RUN: rm -f %t.multiple-obj.a
# RUN: llvm-ar crs %t.multiple-obj.a %t %t.duplicate
# RUN: llvm-objcopy --strip-debug %t.multiple-obj.a %t.multiple-obj.stripped.a
# RUN: llvm-ar p %t.multiple-stripped-obj.a > %t.multiple-stripped-obj.a.dump
# RUN: llvm-ar p %t.multiple-obj.stripped.a > %t.multiple-obj.stripped.a.dump
# RUN: cmp %t.multiple-stripped-obj.a.dump %t.multiple-obj.stripped.a.dump

# CHECK:      Sections:
# CHECK-NEXT:   - Type: TYPE
# CHECK:        - Type: CUSTOM
## We expect the linking section to be preceeded by the removed `.debug_info`
## section.
# CHECK-NEXT:     Name:            .objcopy.removed
# CHECK-NEXT:     Payload:         ''
# CHECK-NEXT:   - Type: CUSTOM
# CHECK-NEXT:     Name: linking
# CHECK:          Name: name
# CHECK-NEXT:     FunctionNames:
# CHECK:          Name: producers
## Following the producers section we expect to find three removed sections.
## The `.debug_line` section that two reloction section corresponding to the
## two debug sections.
# CHECK:        - Type:            CUSTOM
# CHECK-NEXT:     Name:            .objcopy.removed
# CHECK-NEXT:     Payload:         ''
# CHECK-NEXT:   - Type:            CUSTOM
# CHECK-NEXT:     Name:            .objcopy.removed
# CHECK-NEXT:     Payload:         ''
# CHECK-NEXT:   - Type:            CUSTOM
# CHECK-NEXT:     Name:            .objcopy.removed
# CHECK-NEXT:     Payload:         ''


--- !WASM
FileHeader:
  Version: 0x00000001
Sections:
  - Type: TYPE
    Signatures:
      - Index: 0
        ParamTypes: []
        ReturnTypes: []
  - Type: FUNCTION
    FunctionTypes: [ 0 ]
  - Type: CODE
    Functions:
      - Index: 0
        Locals: []
        Body: 0B
  - Type: CUSTOM
    Name: .debug_info
    Payload: 'CAFE123456'
    Relocations:
      - Type:   R_WASM_FUNCTION_INDEX_LEB
        Index:  0
        Offset: 0x0000000
  - Type:            CUSTOM
    Name:            linking
    Version:         2
    SymbolTable:
      - Index:           0
        Kind:            FUNCTION
        Name:            foo
        Flags:           [ BINDING_LOCAL ]
        Function:        0
  - Type: CUSTOM
    Name: name
    FunctionNames:
     - Index:          0
       Name:           foo
  - Type: CUSTOM
    Name: producers
    Tools:
      - Name:   clang
        Version: 9.0.0
  - Type: CUSTOM
    Name: .debug_line
    Payload: 'DEADBEEF01'
    Relocations:
      - Type:   R_WASM_FUNCTION_INDEX_LEB
        Index:  0
        Offset: 0x0000000