1 # RUN: llvm-readobj --dyn-symbols %p/Inputs/dynamic-table-so.x86 | FileCheck %s
3 ## Check the two-letter alias --dt is equivalent to the --dyn-symbols full flag
6 # RUN: llvm-readobj --dt %p/Inputs/dynamic-table-so.x86 > %t.readobj-dt-alias
7 # RUN: llvm-readobj --dyn-symbols %p/Inputs/dynamic-table-so.x86 > %t.readobj-dt-no-alias
8 # RUN: diff %t.readobj-dt-alias %t.readobj-dt-no-alias
10 # CHECK: DynamicSymbols [
11 # CHECK-NEXT: Symbol {
13 # CHECK-NEXT: Value: 0x0
15 # CHECK-NEXT: Binding: Local
16 # CHECK-NEXT: Type: None
17 # CHECK-NEXT: Other: 0
18 # CHECK-NEXT: Section: Undefined
20 # CHECK-NEXT: Symbol {
22 # CHECK-NEXT: Value: 0x618
24 # CHECK-NEXT: Binding: Local
25 # CHECK-NEXT: Type: Section
26 # CHECK-NEXT: Other: 0
27 # CHECK-NEXT: Section: .init
29 # CHECK-NEXT: Symbol {
31 # CHECK-NEXT: Value: 0x200DC0
33 # CHECK-NEXT: Binding: Local
34 # CHECK-NEXT: Type: Section
35 # CHECK-NEXT: Other: 0
36 # CHECK-NEXT: Section: .tbss
38 # CHECK-NEXT: Symbol {
39 # CHECK-NEXT: Name: _ITM_deregisterTMCloneTable{{ }}
40 # CHECK-NEXT: Value: 0x0
42 # CHECK-NEXT: Binding: Weak
43 # CHECK-NEXT: Type: None
44 # CHECK-NEXT: Other: 0
45 # CHECK-NEXT: Section: Undefined
47 # CHECK-NEXT: Symbol {
48 # CHECK-NEXT: Name: puts@GLIBC_2.2.5{{ }}
49 # CHECK-NEXT: Value: 0x0
51 # CHECK-NEXT: Binding: Global
52 # CHECK-NEXT: Type: Function
53 # CHECK-NEXT: Other: 0
54 # CHECK-NEXT: Section: Undefined
56 # CHECK-NEXT: Symbol {
57 # CHECK-NEXT: Name: __tls_get_addr@GLIBC_2.3{{ }}
58 # CHECK-NEXT: Value: 0x0
60 # CHECK-NEXT: Binding: Global
61 # CHECK-NEXT: Type: Function
62 # CHECK-NEXT: Other: 0
63 # CHECK-NEXT: Section: Undefined
65 # CHECK-NEXT: Symbol {
66 # CHECK-NEXT: Name: __gmon_start__{{ }}
67 # CHECK-NEXT: Value: 0x0
69 # CHECK-NEXT: Binding: Weak
70 # CHECK-NEXT: Type: None
71 # CHECK-NEXT: Other: 0
72 # CHECK-NEXT: Section: Undefined
74 # CHECK-NEXT: Symbol {
75 # CHECK-NEXT: Name: _Jv_RegisterClasses{{ }}
76 # CHECK-NEXT: Value: 0x0
78 # CHECK-NEXT: Binding: Weak
79 # CHECK-NEXT: Type: None
80 # CHECK-NEXT: Other: 0
81 # CHECK-NEXT: Section: Undefined
83 # CHECK-NEXT: Symbol {
84 # CHECK-NEXT: Name: _ITM_registerTMCloneTable{{ }}
85 # CHECK-NEXT: Value: 0x0
87 # CHECK-NEXT: Binding: Weak
88 # CHECK-NEXT: Type: None
89 # CHECK-NEXT: Other: 0
90 # CHECK-NEXT: Section: Undefined
92 # CHECK-NEXT: Symbol {
93 # CHECK-NEXT: Name: __cxa_finalize@GLIBC_2.2.5{{ }}
94 # CHECK-NEXT: Value: 0x0
96 # CHECK-NEXT: Binding: Weak
97 # CHECK-NEXT: Type: Function
98 # CHECK-NEXT: Other: 0
99 # CHECK-NEXT: Section: Undefined
101 # CHECK-NEXT: Symbol {
102 # CHECK-NEXT: Name: _edata{{ }}
103 # CHECK-NEXT: Value: 0x201030
104 # CHECK-NEXT: Size: 0
105 # CHECK-NEXT: Binding: Global
106 # CHECK-NEXT: Type: None
107 # CHECK-NEXT: Other: 0
108 # CHECK-NEXT: Section: .data
110 # CHECK-NEXT: Symbol {
111 # CHECK-NEXT: Name: foo{{ }}
112 # CHECK-NEXT: Value: 0x0
113 # CHECK-NEXT: Size: 4
114 # CHECK-NEXT: Binding: Global
115 # CHECK-NEXT: Type: TLS
116 # CHECK-NEXT: Other: 0
117 # CHECK-NEXT: Section: .tbss
119 # CHECK-NEXT: Symbol {
120 # CHECK-NEXT: Name: _end{{ }}
121 # CHECK-NEXT: Value: 0x201038
122 # CHECK-NEXT: Size: 0
123 # CHECK-NEXT: Binding: Global
124 # CHECK-NEXT: Type: None
125 # CHECK-NEXT: Other: 0
126 # CHECK-NEXT: Section: .bss
128 # CHECK-NEXT: Symbol {
129 # CHECK-NEXT: Name: __bss_start{{ }}
130 # CHECK-NEXT: Value: 0x201030
131 # CHECK-NEXT: Size: 0
132 # CHECK-NEXT: Binding: Global
133 # CHECK-NEXT: Type: None
134 # CHECK-NEXT: Other: 0
135 # CHECK-NEXT: Section: .bss
137 # CHECK-NEXT: Symbol {
138 # CHECK-NEXT: Name: main{{ }}
139 # CHECK-NEXT: Value: 0x780
140 # CHECK-NEXT: Size: 59
141 # CHECK-NEXT: Binding: Global
142 # CHECK-NEXT: Type: Function
143 # CHECK-NEXT: Other: 0
144 # CHECK-NEXT: Section: .text
146 # CHECK-NEXT: Symbol {
147 # CHECK-NEXT: Name: _init{{ }}
148 # CHECK-NEXT: Value: 0x618
149 # CHECK-NEXT: Size: 0
150 # CHECK-NEXT: Binding: Global
151 # CHECK-NEXT: Type: Function
152 # CHECK-NEXT: Other: 0
153 # CHECK-NEXT: Section: .init
155 # CHECK-NEXT: Symbol {
156 # CHECK-NEXT: Name: _fini{{ }}
157 # CHECK-NEXT: Value: 0x7BC
158 # CHECK-NEXT: Size: 0
159 # CHECK-NEXT: Binding: Global
160 # CHECK-NEXT: Type: Function
161 # CHECK-NEXT: Other: 0
162 # CHECK-NEXT: Section: .fini
166 ## Check that we are able to dump the dynamic symbol table even when we have no program headers.
167 ## In this case we find the table by it's type (SHT_DYNSYM) and ignore the DT_SYMTAB value.
169 # RUN: yaml2obj --docnum=1 %s -o %t1.so
170 # RUN: llvm-readobj %t1.so --dyn-symbols | FileCheck %s --check-prefix=NOPHDRS
191 ## Check we report a warning when there is no SHT_DYNSYM section and we can't map the DT_SYMTAB value
192 ## to an address because of the absence of a corresponding PT_LOAD program header.
194 # RUN: yaml2obj --docnum=2 %s -o %t2.so
195 # RUN: llvm-readobj %t2.so --dyn-symbols 2>&1 | FileCheck %s -DFILE=%t2.so --check-prefix=NOSHT-DYNSYM
197 # NOSHT-DYNSYM: warning: '[[FILE]]': Unable to parse DT_SYMTAB: virtual address is not in any segment: 0x0
198 # NOSHT-DYNSYM: DynamicSymbols [
199 # NOSHT-DYNSYM-NEXT: ]
220 ## Check that when we can't map the value of the DT_SYMTAB tag to an address, we report a warning and
221 ## use the information in the section header table to locate the dynamic symbol table.
223 # RUN: yaml2obj --docnum=3 %s -o %t3.so
224 # RUN: llvm-readobj %t3.so --dyn-symbols 2>&1 | FileCheck -DFILE=%t3.so %s --check-prefix=BROKEN-DTSYMTAB
226 # BROKEN-DTSYMTAB: warning: '[[FILE]]': Unable to parse DT_SYMTAB: virtual address is not in any segment: 0xffff1234
227 # BROKEN-DTSYMTAB: Name: foo
251 ## Check that if we can get the location of the dynamic symbol table using both the DT_SYMTAB value
252 ## and the section headers table then we prefer the former and report a warning.
254 # RUN: yaml2obj --docnum=4 %s -o %t4.so
255 # RUN: llvm-readobj %t4.so --dyn-symbols 2>&1 | FileCheck -DFILE=%t4.so %s --check-prefix=PREFER-DTSYMTAB
257 # PREFER-DTSYMTAB: warning: '[[FILE]]': SHT_DYNSYM section header and DT_SYMTAB disagree about the location of the dynamic symbol table
258 # PREFER-DTSYMTAB: Name: o
278 ## The Content describes 2 symbols: zero symbol and symbol with st_name == 3.
279 Content: "000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000"