• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# RUN: yaml2obj %s > %t
2# RUN: cp %t %t1
3# RUN: llvm-objcopy --strip-unneeded %t %t2
4# Verify that llvm-objcopy has not modified the input.
5# RUN: cmp %t %t1
6# RUN: llvm-readobj -symbols %t2 | FileCheck %s
7
8# Verify that llvm-strip modifies the symbol table the same way.
9# RUN: llvm-strip --strip-unneeded %t
10# RUN: cmp %t %t2
11
12!ELF
13FileHeader:
14  Class:           ELFCLASS64
15  Data:            ELFDATA2LSB
16  Type:            ET_REL
17  Machine:         EM_X86_64
18Sections:
19  - Name:            .text
20    Type:            SHT_PROGBITS
21    Flags:           [ SHF_ALLOC, SHF_EXECINSTR ]
22    Address:         0x1000
23    AddressAlign:    0x0000000000000010
24    Size:            64
25  - Name:            .group
26    Type:            SHT_GROUP
27    Link:            .symtab
28    AddressAlign:    0x0000000000000004
29    Info:            barfoo
30    Members:
31      - SectionOrType:   GRP_COMDAT
32      - SectionOrType:   .text
33  - Name:            .rel.text
34    Type:            SHT_REL
35    Link:            .symtab
36    Info:            .text
37    Relocations:
38      - Offset: 0x1000
39        Symbol: foo
40        Type:   R_X86_64_PC32
41Symbols:
42  Local:
43    - Name:     foo
44      Type:     STT_FUNC
45      Section:  .text
46      Value:    0x1000
47      Size:     8
48    - Name:     bar
49      Type:     STT_FUNC
50      Size:     8
51      Section:  .text
52      Value:    0x1008
53    - Name:     barfoo
54      Type:     STT_FUNC
55      Size:     8
56      Section:  .text
57      Value:    0x1010
58    - Name:     fileSymbol
59      Type:     STT_FILE
60    - Name:     sectionSymbol
61      Type:     STT_SECTION
62  Weak:
63    - Name:     baz
64      Type:     STT_FUNC
65      Size:     8
66      Section:  .text
67      Value:    0x1018
68    - Name:     foobaz
69      Type:     STT_FUNC
70  Global:
71    - Name:     foobar
72      Type:     STT_FUNC
73    - Name:     barbaz
74      Type:     STT_FUNC
75      Size:     8
76      Section:  .text
77      Value:    0x1020
78
79#CHECK: Symbols [
80#CHECK-NEXT:  Symbol {
81#CHECK-NEXT:    Name:
82#CHECK-NEXT:    Value: 0x0
83#CHECK-NEXT:    Size: 0
84#CHECK-NEXT:    Binding: Local
85#CHECK-NEXT:    Type: None
86#CHECK-NEXT:    Other: 0
87#CHECK-NEXT:    Section: Undefined
88#CHECK-NEXT:  }
89#CHECK-NEXT:  Symbol {
90#CHECK-NEXT:    Name: foo
91#CHECK-NEXT:    Value: 0x1000
92#CHECK-NEXT:    Size: 8
93#CHECK-NEXT:    Binding: Local
94#CHECK-NEXT:    Type: Function
95#CHECK-NEXT:    Other: 0
96#CHECK-NEXT:    Section: .text
97#CHECK-NEXT:  }
98#CHECK-NEXT:  Symbol {
99#CHECK-NEXT:    Name: barfoo
100#CHECK-NEXT:    Value: 0x1010
101#CHECK-NEXT:    Size: 8
102#CHECK-NEXT:    Binding: Local
103#CHECK-NEXT:    Type: Function
104#CHECK-NEXT:    Other: 0
105#CHECK-NEXT:    Section: .text
106#CHECK-NEXT:  }
107#CHECK-NEXT:  Symbol {
108#CHECK-NEXT:    Name: fileSymbol
109#CHECK-NEXT:    Value: 0x0
110#CHECK-NEXT:    Size: 0
111#CHECK-NEXT:    Binding: Local
112#CHECK-NEXT:    Type: File
113#CHECK-NEXT:    Other: 0
114#CHECK-NEXT:    Section: Undefined
115#CHECK-NEXT:  }
116#CHECK-NEXT:  Symbol {
117#CHECK-NEXT:    Name: sectionSymbol
118#CHECK-NEXT:    Value: 0x0
119#CHECK-NEXT:    Size: 0
120#CHECK-NEXT:    Binding: Local
121#CHECK-NEXT:    Type: Section
122#CHECK-NEXT:    Other: 0
123#CHECK-NEXT:    Section: Undefined
124#CHECK-NEXT:  }
125#CHECK-NEXT:  Symbol {
126#CHECK-NEXT:    Name: barbaz
127#CHECK-NEXT:    Value: 0x1020
128#CHECK-NEXT:    Size: 8
129#CHECK-NEXT:    Binding: Global
130#CHECK-NEXT:    Type: Function
131#CHECK-NEXT:    Other: 0
132#CHECK-NEXT:    Section: .text
133#CHECK-NEXT:  }
134#CHECK-NEXT:  Symbol {
135#CHECK-NEXT:    Name: baz
136#CHECK-NEXT:    Value: 0x1018
137#CHECK-NEXT:    Size: 8
138#CHECK-NEXT:    Binding: Weak
139#CHECK-NEXT:    Type: Function
140#CHECK-NEXT:    Other: 0
141#CHECK-NEXT:    Section: .text
142#CHECK-NEXT:  }
143#CHECK-NEXT:]
144