1 ## Check that we are able to dump MIPS PLT GOT entries using -A properly.
3 # RUN: yaml2obj --docnum=1 %s -o %t.plt.o
4 # RUN: llvm-readobj -A %t.plt.o | FileCheck %s --check-prefix=LLVM
5 # RUN: llvm-readelf -A %t.plt.o | \
6 # RUN: FileCheck %s --strict-whitespace --match-full-lines --check-prefix=GNU
9 # LLVM-NEXT: Reserved entries [
11 # LLVM-NEXT: Address: 0x2000
12 # LLVM-NEXT: Initial: 0x0
13 # LLVM-NEXT: Purpose: PLT lazy resolver
16 # LLVM-NEXT: Address: 0x2008
17 # LLVM-NEXT: Initial: 0x0
18 # LLVM-NEXT: Purpose: Module pointer
21 # LLVM-NEXT: Entries [
23 # LLVM-NEXT: Address: 0x2010
24 # LLVM-NEXT: Initial: 0x0
25 # LLVM-NEXT: Value: 0x0
26 # LLVM-NEXT: Type: None (0x0)
27 # LLVM-NEXT: Section: Undefined (0x0)
28 # LLVM-NEXT: Name: foo (5)
31 # LLVM-NEXT: Address: 0x2018
32 # LLVM-NEXT: Initial: 0x0
33 # LLVM-NEXT: Value: 0x0
34 # LLVM-NEXT: Type: None (0x0)
35 # LLVM-NEXT: Section: Undefined (0x0)
36 # LLVM-NEXT: Name: bar (1)
43 # GNU-NEXT: Reserved entries:
44 # GNU-NEXT: Address Initial Purpose
45 # GNU-NEXT: 0000000000002000 0000000000000000 PLT lazy resolver
46 # GNU-NEXT: 0000000000002008 0000000000000000 Module pointer
49 # GNU-NEXT: Address Initial Sym.Val. Type Ndx Name
50 # GNU-NEXT: 0000000000002010 0000000000000000 0000000000000000 NOTYPE UND foo
51 # GNU-NEXT: 0000000000002018 0000000000000000 0000000000000000 NOTYPE UND bar
69 Type: R_MIPS_JUMP_SLOT
72 Type: R_MIPS_JUMP_SLOT
75 Flags: [ SHF_WRITE, SHF_ALLOC ]
77 Size: 32 ## (dynamic symbols number + 2) * 8
89 ## Check we report errors when dynamic tags, needed for dumping PLT, are missing.
91 # RUN: yaml2obj --docnum=2 -DTAG=DT_MIPS_PLTGOT %s -o %t.err1.o
92 # RUN: llvm-readobj -A %t.err1.o 2>&1 | FileCheck %s -DFILE=%t.err1.o --check-prefixes=NO-OUTPUT,ERR1
94 # RUN: yaml2obj --docnum=2 -DTAG=DT_JMPREL %s -o %t.err2.o
95 # RUN: llvm-readobj -A %t.err2.o 2>&1 | FileCheck %s -DFILE=%t.err2.o --check-prefixes=NO-OUTPUT,ERR2
112 ## Check we report errors when we are unable to find PLTGOT/JMPREL sections.
113 # RUN: yaml2obj --docnum=3 %s -DVAL1=0xffff -o %t.err3.o
114 # RUN: llvm-readobj -A %t.err3.o 2>&1 | FileCheck %s -DFILE=%t.err3.o -check-prefixes=NO-OUTPUT,ERR3
116 # RUN: yaml2obj --docnum=3 %s -DVAL2=0xffff -o %t.err4.o
117 # RUN: llvm-readobj -A %t.err4.o 2>&1 | FileCheck %s -DFILE=%t.err4.o -check-prefixes=NO-OUTPUT,ERR4
129 - Tag: DT_MIPS_PLTGOT
142 ## Check we report errors when we are unable to dump PLTGOT properly.
144 # RUN: yaml2obj --docnum=3 -DVAL1=0x100 %s -o %t.err5.o
145 # RUN: llvm-readobj -A %t.err5.o 2>&1 | FileCheck %s -DFILE=%t.err5.o -check-prefixes=NO-OUTPUT,ERR5
147 # RUN: yaml2obj --docnum=3 -DVAL2=0x100 -DLINK=0xaaaaaaaa %s -o %t.err6.o
148 # RUN: llvm-readobj -A %t.err6.o 2>&1 | FileCheck %s -DFILE=%t.err6.o -check-prefixes=NO-OUTPUT,ERR6
150 # RUN: yaml2obj --docnum=3 -DVAL2=0x100 %s -o %t.err7.o
151 # RUN: llvm-readobj -A %t.err7.o 2>&1 | FileCheck %s -DFILE=%t.err7.o -check-prefixes=NO-OUTPUT,ERR7
153 # NO-OUTPUT: LoadName: <Not found>
154 # NO-OUTPUT-NEXT: There is no .MIPS.abiflags section in the file.
155 # NO-OUTPUT-NEXT: There is no .MIPS.options section in the file.
156 # NO-OUTPUT-NEXT: There is no .reginfo section in the file.
158 # ERR1-NEXT: warning: '[[FILE]]': cannot find JMPREL dynamic tag
159 # ERR2-NEXT: warning: '[[FILE]]': cannot find MIPS_PLTGOT dynamic tag
160 # ERR3-NEXT: warning: '[[FILE]]': there is no non-empty PLTGOT section at 0xffff
161 # ERR4-NEXT: warning: '[[FILE]]': there is no non-empty RELPLT section at 0xffff
162 # ERR5-NEXT: warning: '[[FILE]]': unable to read PLTGOT section content: section [index 2] has a sh_offset (0x70) + sh_size (0xffffffff) that is greater than the file size (0x280)
163 # ERR6-NEXT: warning: '[[FILE]]': unable to get a symbol table linked to the SHT_PROGBITS section with index 2: invalid section index: 2863311530
164 # ERR7-NEXT: warning: '[[FILE]]': unable to get a string table for the SHT_DYNAMIC section with index 1: invalid sh_type for symbol table, expected SHT_SYMTAB or SHT_DYNSYM
167 # NO-OUTPUT-NOT: {{.}}
169 ## Check how we print PLT entries when they are unnamed section symbols.
170 # RUN: yaml2obj --docnum=4 %s -o %t3
171 # RUN: llvm-readobj -A %t3 2>&1 | FileCheck %s -DFILE=%t3 --check-prefix=SEC-SYMS-LLVM
172 # RUN: llvm-readelf -A %t3 2>&1 | FileCheck %s -DFILE=%t3 --check-prefix=SEC-SYMS-GNU
174 # SEC-SYMS-LLVM: PLT GOT {
175 # SEC-SYMS-LLVM: Entries [
176 # SEC-SYMS-LLVM: Entry {
177 # SEC-SYMS-LLVM: Section: Absolute (0xFFF1)
178 # SEC-SYMS-LLVM-NEXT: warning: '[[FILE]]': unable to get section index for symbol with st_shndx = 0xfff1 (SHN_ABS)
179 # SEC-SYMS-LLVM-NEXT: Name: <?> (0)
180 # SEC-SYMS-LLVM-NEXT: }
181 # SEC-SYMS-LLVM-NEXT: Entry {
182 # SEC-SYMS-LLVM: Section: .got.plt (0x2)
183 # SEC-SYMS-LLVM-NEXT: Name: .got.plt (0)
184 # SEC-SYMS-LLVM-NEXT: }
185 # SEC-SYMS-LLVM-NEXT: Entry {
186 # SEC-SYMS-LLVM: Section: Common (0xFFF2)
187 # SEC-SYMS-LLVM-NEXT: warning: '[[FILE]]': unable to get section index for symbol with st_shndx = 0xfff2 (SHN_COMMON)
188 # SEC-SYMS-LLVM-NEXT: Name: <?> (0)
189 # SEC-SYMS-LLVM-NEXT: }
190 # SEC-SYMS-LLVM-NEXT: Entry {
191 # SEC-SYMS-LLVM: Type: Section (0x3)
192 # SEC-SYMS-LLVM-NEXT: warning: '[[FILE]]': found an extended symbol index (4), but unable to locate the extended symbol index table
193 # SEC-SYMS-LLVM-NEXT: Section: Reserved (0xFFFF)
194 # SEC-SYMS-LLVM-NEXT: Name: <?> (0)
195 # SEC-SYMS-LLVM-NEXT: }
196 # SEC-SYMS-LLVM-NEXT: ]
197 # SEC-SYMS-LLVM-NEXT: }
199 # SEC-SYMS-GNU: PLT GOT:
200 # SEC-SYMS-GNU: Entries:
201 # SEC-SYMS-GNU-NEXT: Address {{.*}} Ndx Name
202 # SEC-SYMS-GNU-NEXT: warning: '[[FILE]]': unable to get section index for symbol with st_shndx = 0xfff1 (SHN_ABS)
203 # SEC-SYMS-GNU-NEXT: 0000000000002010 {{.*}} ABS <?>
204 # SEC-SYMS-GNU-NEXT: 0000000000002018 {{.*}} 2 .got.plt
205 # SEC-SYMS-GNU-NEXT: warning: '[[FILE]]': unable to get section index for symbol with st_shndx = 0xfff2 (SHN_COMMON)
206 # SEC-SYMS-GNU-NEXT: 0000000000002020 {{.*}} COM <?>
207 # SEC-SYMS-GNU-NEXT: warning: '[[FILE]]': found an extended symbol index (4), but unable to locate the extended symbol index table
208 # SEC-SYMS-GNU-NEXT: 0000000000002028 {{.*}} RSV[0xffff] <?>
225 Type: R_MIPS_JUMP_SLOT
228 Type: R_MIPS_JUMP_SLOT
231 Type: R_MIPS_JUMP_SLOT
234 Type: R_MIPS_JUMP_SLOT
237 Flags: [ SHF_WRITE, SHF_ALLOC ]
239 Size: 48 ## (dynamic symbols number + 2) * 8
245 - Tag: DT_MIPS_PLTGOT