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 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605
|
## Check that we are able to dump MIPS GOT entries using -A properly.
## Check how we dump 64-bit inputs.
# RUN: yaml2obj --docnum=1 -DTYPE=ET_REL %s -o %t.got.o
# RUN: yaml2obj --docnum=1 -DTYPE=ET_DYN %s -o %t.got.so
# RUN: yaml2obj --docnum=1 -DTYPE=ET_EXEC %s -o %t.got.exe
# RUN: llvm-readobj -A %t.got.o 2>&1 | FileCheck %s -DOTHERNUM=0 -check-prefix=BASIC-LLVM
# RUN: llvm-readobj -A %t.got.so 2>&1 | FileCheck %s -DOTHERNUM=0 -check-prefix=BASIC-LLVM
# RUN: llvm-readobj -A %t.got.exe 2>&1 | FileCheck %s -DOTHERNUM=0 -check-prefix=BASIC-LLVM
# RUN: llvm-readelf -A %t.got.o 2>&1 | FileCheck %s -check-prefix=BASIC-GNU \
# RUN: --implicit-check-not="Number of" --strict-whitespace --match-full-lines
# RUN: llvm-readelf -A %t.got.so 2>&1 | FileCheck %s -check-prefix=BASIC-GNU \
# RUN: --implicit-check-not="Number of" --strict-whitespace --match-full-lines
# RUN: llvm-readelf -A %t.got.exe 2>&1 | FileCheck %s -check-prefix=BASIC-GNU \
# RUN: --implicit-check-not="Number of" --strict-whitespace --match-full-lines
--- !ELF
FileHeader:
Class: ELFCLASS64
Data: ELFDATA2LSB
Type: [[TYPE=ET_EXEC]]
Machine: EM_MIPS
Sections:
- Name: .got
Type: SHT_PROGBITS
Address: 0x1122
ContentArray: [ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ## Lazy resolver.
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, ## Module pointer (GNU extension)
0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, ## Local entry 1
0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, ## Local entry 2
0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, ## Global entry 1
0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB ] ## Global entry 2
Size: [[SIZE=<none>]]
- Name: .dynamic
Type: SHT_DYNAMIC
ShType: [[DYNAMICTYPE=<none>]]
Entries:
- Tag: DT_MIPS_LOCAL_GOTNO
Value: 4
- Tag: DT_MIPS_GOTSYM
Value: 1
- Tag: DT_PLTGOT
Value: 0x1122
DynamicSymbols:
- Name: foo
- Name: bar
Type: STT_FUNC
# BASIC-LLVM: Primary GOT {
# BASIC-LLVM-NEXT: Canonical gp value: 0x9112
# BASIC-LLVM-NEXT: Reserved entries [
# BASIC-LLVM-NEXT: Entry {
# BASIC-LLVM-NEXT: Address: 0x1122
# BASIC-LLVM-NEXT: Access: -32752
# BASIC-LLVM-NEXT: Initial: 0x0
# BASIC-LLVM-NEXT: Purpose: Lazy resolver
# BASIC-LLVM-NEXT: }
# BASIC-LLVM-NEXT: Entry {
# BASIC-LLVM-NEXT: Address: 0x112A
# BASIC-LLVM-NEXT: Access: -32744
# BASIC-LLVM-NEXT: Initial: 0xFFFFFFFFFFFFFFFF
# BASIC-LLVM-NEXT: Purpose: Module pointer (GNU extension)
# BASIC-LLVM-NEXT: }
# BASIC-LLVM-NEXT: ]
# BASIC-LLVM-NEXT: Local entries [
# BASIC-LLVM-NEXT: Entry {
# BASIC-LLVM-NEXT: Address: 0x1132
# BASIC-LLVM-NEXT: Access: -32736
# BASIC-LLVM-NEXT: Initial: 0x1111111111111111
# BASIC-LLVM-NEXT: }
# BASIC-LLVM-NEXT: Entry {
# BASIC-LLVM-NEXT: Address: 0x113A
# BASIC-LLVM-NEXT: Access: -32728
# BASIC-LLVM-NEXT: Initial: 0x2222222222222222
# BASIC-LLVM-NEXT: }
# BASIC-LLVM-NEXT: ]
# BASIC-LLVM-NEXT: Global entries [
# BASIC-LLVM-NEXT: Entry {
# BASIC-LLVM-NEXT: Address: 0x1142
# BASIC-LLVM-NEXT: Access: -32720
# BASIC-LLVM-NEXT: Initial: 0xAAAAAAAAAAAAAAAA
# BASIC-LLVM-NEXT: Value: 0x0
# BASIC-LLVM-NEXT: Type: None (0x0)
# BASIC-LLVM-NEXT: Section: Undefined (0x0)
# BASIC-LLVM-NEXT: Name: foo (5)
# BASIC-LLVM-NEXT: }
# BASIC-LLVM-NEXT: Entry {
# BASIC-LLVM-NEXT: Address: 0x114A
# BASIC-LLVM-NEXT: Access: -32712
# BASIC-LLVM-NEXT: Initial: 0xBBBBBBBBBBBBBBBB
# BASIC-LLVM-NEXT: Value: 0x0
# BASIC-LLVM-NEXT: Type: Function (0x2)
# BASIC-LLVM-NEXT: Section: Undefined (0x0)
# BASIC-LLVM-NEXT: Name: bar (1)
# BASIC-LLVM-NEXT: }
# BASIC-LLVM-NEXT: ]
# BASIC-LLVM-NEXT: Number of TLS and multi-GOT entries: [[OTHERNUM]]
# BASIC-LLVM-NEXT: }
# BASIC-GNU:Primary GOT:
# BASIC-GNU-NEXT: Canonical gp value: 0000000000009112
# BASIC-GNU-EMPTY:
# BASIC-GNU-NEXT: Reserved entries:
# BASIC-GNU-NEXT: Address Access Initial Purpose
# BASIC-GNU-NEXT: 0000000000001122 -32752(gp) 0000000000000000 Lazy resolver
# BASIC-GNU-NEXT: 000000000000112a -32744(gp) ffffffffffffffff Module pointer (GNU extension)
# BASIC-GNU-EMPTY:
# BASIC-GNU-NEXT: Local entries:
# BASIC-GNU-NEXT: Address Access Initial
# BASIC-GNU-NEXT: 0000000000001132 -32736(gp) 1111111111111111 {{$}}
# BASIC-GNU-NEXT: 000000000000113a -32728(gp) 2222222222222222 {{$}}
# BASIC-GNU-EMPTY:
# BASIC-GNU-NEXT: Global entries:
# BASIC-GNU-NEXT: Address Access Initial Sym.Val. Type Ndx Name
# BASIC-GNU-NEXT: 0000000000001142 -32720(gp) aaaaaaaaaaaaaaaa 0000000000000000 NOTYPE UND foo
# BASIC-GNU-NEXT: 000000000000114a -32712(gp) bbbbbbbbbbbbbbbb 0000000000000000 FUNC UND bar
# BASIC-GNU-EMPTY:
# BASIC-GNU-OTHER-NEXT: Number of TLS and multi-GOT entries [[OTHERNUM]]
## Check we are able to print the number of TLS and multi-GOT entries properly.
# RUN: yaml2obj --docnum=1 %s -DSIZE=56 -o %t.other.entries1.exe
# RUN: yaml2obj --docnum=1 %s -DSIZE=64 -o %t.other.entries2.exe
# RUN: llvm-readobj -A %t.other.entries1.exe 2>&1 | FileCheck %s -DOTHERNUM=1 --check-prefix=BASIC-LLVM
# RUN: llvm-readobj -A %t.other.entries2.exe 2>&1 | FileCheck %s -DOTHERNUM=2 -check-prefix=BASIC-LLVM
# RUN: llvm-readelf -A %t.other.entries1.exe 2>&1 | FileCheck %s -DOTHERNUM=1 \
# RUN: --check-prefixes=BASIC-GNU,BASIC-GNU-OTHER --strict-whitespace --match-full-lines
# RUN: llvm-readelf -A %t.other.entries2.exe 2>&1 | FileCheck %s -DOTHERNUM=2 \
# RUN: --check-prefixes=BASIC-GNU,BASIC-GNU-OTHER --strict-whitespace --match-full-lines
## Check how we print static GOT. Our code assumes that the GOT is static when there
## is no .dynamic section, so we change its type to hide it.
# RUN: yaml2obj --docnum=1 -DDYNAMICTYPE=SHT_PROGBITS %s -o %t.got-static.exe
# RUN: llvm-readobj -A %t.got-static.exe | FileCheck %s --check-prefix=STATIC-GOT-LLVM
# RUN: llvm-readelf -A %t.got-static.exe | FileCheck %s --check-prefix=STATIC-GOT-GNU
# STATIC-GOT-LLVM: Static GOT {
# STATIC-GOT-LLVM-NEXT: Canonical gp value: 0x9112
# STATIC-GOT-LLVM-NEXT: Reserved entries [
# STATIC-GOT-LLVM-NEXT: Entry {
# STATIC-GOT-LLVM-NEXT: Address: 0x1122
# STATIC-GOT-LLVM-NEXT: Access: -32752
# STATIC-GOT-LLVM-NEXT: Initial: 0x0
# STATIC-GOT-LLVM-NEXT: Purpose: Lazy resolver
# STATIC-GOT-LLVM-NEXT: }
# STATIC-GOT-LLVM-NEXT: Entry {
# STATIC-GOT-LLVM-NEXT: Address: 0x112A
# STATIC-GOT-LLVM-NEXT: Access: -32744
# STATIC-GOT-LLVM-NEXT: Initial: 0xFFFFFFFFFFFFFFFF
# STATIC-GOT-LLVM-NEXT: Purpose: Module pointer (GNU extension)
# STATIC-GOT-LLVM-NEXT: }
# STATIC-GOT-LLVM-NEXT: ]
# STATIC-GOT-LLVM-NEXT: Local entries [
# STATIC-GOT-LLVM-NEXT: Entry {
# STATIC-GOT-LLVM-NEXT: Address: 0x1132
# STATIC-GOT-LLVM-NEXT: Access: -32736
# STATIC-GOT-LLVM-NEXT: Initial: 0x1111111111111111
# STATIC-GOT-LLVM-NEXT: }
# STATIC-GOT-LLVM-NEXT: Entry {
# STATIC-GOT-LLVM-NEXT: Address: 0x113A
# STATIC-GOT-LLVM-NEXT: Access: -32728
# STATIC-GOT-LLVM-NEXT: Initial: 0x2222222222222222
# STATIC-GOT-LLVM-NEXT: }
# STATIC-GOT-LLVM-NEXT: Entry {
# STATIC-GOT-LLVM-NEXT: Address: 0x1142
# STATIC-GOT-LLVM-NEXT: Access: -32720
# STATIC-GOT-LLVM-NEXT: Initial: 0xAAAAAAAAAAAAAAAA
# STATIC-GOT-LLVM-NEXT: }
# STATIC-GOT-LLVM-NEXT: Entry {
# STATIC-GOT-LLVM-NEXT: Address: 0x114A
# STATIC-GOT-LLVM-NEXT: Access: -32712
# STATIC-GOT-LLVM-NEXT: Initial: 0xBBBBBBBBBBBBBBBB
# STATIC-GOT-LLVM-NEXT: }
# STATIC-GOT-LLVM-NEXT: ]
# STATIC-GOT-LLVM-NEXT: }
# STATIC-GOT-GNU: Static GOT:
# STATIC-GOT-GNU-NEXT: Canonical gp value: 0000000000009112
# STATIC-GOT-GNU-EMPTY:
# STATIC-GOT-GNU-NEXT: Reserved entries:
# STATIC-GOT-GNU-NEXT: Address Access Initial Purpose
# STATIC-GOT-GNU-NEXT: 0000000000001122 -32752(gp) 0000000000000000 Lazy resolver
# STATIC-GOT-GNU-NEXT: 000000000000112a -32744(gp) ffffffffffffffff Module pointer (GNU extension)
# STATIC-GOT-GNU-EMPTY:
# STATIC-GOT-GNU-NEXT: Local entries:
# STATIC-GOT-GNU-NEXT: Address Access Initial
# STATIC-GOT-GNU-NEXT: 0000000000001132 -32736(gp) 1111111111111111
# STATIC-GOT-GNU-NEXT: 000000000000113a -32728(gp) 2222222222222222
# STATIC-GOT-GNU-NEXT: 0000000000001142 -32720(gp) aaaaaaaaaaaaaaaa
# STATIC-GOT-GNU-NEXT: 000000000000114a -32712(gp) bbbbbbbbbbbbbbbb
# STATIC-GOT-GNU-EMPTY:
# STATIC-GOT-GNU-NOT: {{.}}
## Check how we dump 32-bit inputs.
# RUN: yaml2obj --docnum=2 %s -o %t.got32.exe
# RUN: llvm-readobj -A %t.got32.exe 2>&1 | FileCheck %s -check-prefix=BASIC32-LLVM
# RUN: llvm-readelf -A %t.got32.exe 2>&1 | FileCheck %s -check-prefix=BASIC32-GNU \
# RUN: --strict-whitespace --match-full-lines
# BASIC32-LLVM: Primary GOT {
# BASIC32-LLVM-NEXT: Canonical gp value: 0x9112
# BASIC32-LLVM-NEXT: Reserved entries [
# BASIC32-LLVM-NEXT: Entry {
# BASIC32-LLVM-NEXT: Address: 0x1122
# BASIC32-LLVM-NEXT: Access: -32752
# BASIC32-LLVM-NEXT: Initial: 0x0
# BASIC32-LLVM-NEXT: Purpose: Lazy resolver
# BASIC32-LLVM-NEXT: }
# BASIC32-LLVM-NEXT: Entry {
# BASIC32-LLVM-NEXT: Address: 0x1126
# BASIC32-LLVM-NEXT: Access: -32748
# BASIC32-LLVM-NEXT: Initial: 0xFFFFFFFF
# BASIC32-LLVM-NEXT: Purpose: Module pointer (GNU extension)
# BASIC32-LLVM-NEXT: }
# BASIC32-LLVM-NEXT: ]
# BASIC32-LLVM-NEXT: Local entries [
# BASIC32-LLVM-NEXT: Entry {
# BASIC32-LLVM-NEXT: Address: 0x112A
# BASIC32-LLVM-NEXT: Access: -32744
# BASIC32-LLVM-NEXT: Initial: 0x11111111
# BASIC32-LLVM-NEXT: }
# BASIC32-LLVM-NEXT: Entry {
# BASIC32-LLVM-NEXT: Address: 0x112E
# BASIC32-LLVM-NEXT: Access: -32740
# BASIC32-LLVM-NEXT: Initial: 0x22222222
# BASIC32-LLVM-NEXT: }
# BASIC32-LLVM-NEXT: ]
# BASIC32-LLVM-NEXT: Global entries [
# BASIC32-LLVM-NEXT: Entry {
# BASIC32-LLVM-NEXT: Address: 0x1132
# BASIC32-LLVM-NEXT: Access: -32736
# BASIC32-LLVM-NEXT: Initial: 0xAAAAAAAA
# BASIC32-LLVM-NEXT: Value: 0x0
# BASIC32-LLVM-NEXT: Type: None (0x0)
# BASIC32-LLVM-NEXT: Section: Undefined (0x0)
# BASIC32-LLVM-NEXT: Name: foo (5)
# BASIC32-LLVM-NEXT: }
# BASIC32-LLVM-NEXT: Entry {
# BASIC32-LLVM-NEXT: Address: 0x1136
# BASIC32-LLVM-NEXT: Access: -32732
# BASIC32-LLVM-NEXT: Initial: 0xBBBBBBBB
# BASIC32-LLVM-NEXT: Value: 0x0
# BASIC32-LLVM-NEXT: Type: Function (0x2)
# BASIC32-LLVM-NEXT: Section: Undefined (0x0)
# BASIC32-LLVM-NEXT: Name: bar (1)
# BASIC32-LLVM-NEXT: }
# BASIC32-LLVM-NEXT: ]
# BASIC32-LLVM-NEXT: Number of TLS and multi-GOT entries: 1
# BASIC32-LLVM-NEXT: }
# BASIC32-GNU:Primary GOT:
# BASIC32-GNU-NEXT: Canonical gp value: 00009112
# BASIC32-GNU-EMPTY:
# BASIC32-GNU-NEXT: Reserved entries:
# BASIC32-GNU-NEXT: Address Access Initial Purpose
# BASIC32-GNU-NEXT: 00001122 -32752(gp) 00000000 Lazy resolver
# BASIC32-GNU-NEXT: 00001126 -32748(gp) ffffffff Module pointer (GNU extension)
# BASIC32-GNU-EMPTY:
# BASIC32-GNU-NEXT: Local entries:
# BASIC32-GNU-NEXT: Address Access Initial
# BASIC32-GNU-NEXT: 0000112a -32744(gp) 11111111 {{$}}
# BASIC32-GNU-NEXT: 0000112e -32740(gp) 22222222 {{$}}
# BASIC32-GNU-EMPTY:
# BASIC32-GNU-NEXT: Global entries:
# BASIC32-GNU-NEXT: Address Access Initial Sym.Val. Type Ndx Name
# BASIC32-GNU-NEXT: 00001132 -32736(gp) aaaaaaaa 00000000 NOTYPE UND foo
# BASIC32-GNU-NEXT: 00001136 -32732(gp) bbbbbbbb 00000000 FUNC UND bar
# BASIC32-GNU-EMPTY:
# BASIC32-GNU-NEXT: Number of TLS and multi-GOT entries 1
--- !ELF
FileHeader:
Class: ELFCLASS32
Data: ELFDATA2LSB
Type: ET_EXEC
Machine: EM_MIPS
Sections:
- Name: .got
Type: SHT_PROGBITS
Address: 0x1122
ContentArray: [ 0x00, 0x00, 0x00, 0x00, ## Lazy resolver.
0xFF, 0xFF, 0xFF, 0xFF, ## Module pointer (GNU extension).
0x11, 0x11, 0x11, 0x11, ## Local entry 1.
0x22, 0x22, 0x22, 0x22, ## Local entry 2.
0xAA, 0xAA, 0xAA, 0xAA, ## Global entry 1.
0xBB, 0xBB, 0xBB, 0xBB, ## Global entry 2.
0x00, 0x00, 0x00, 0x00 ] ## Other entry.
- Name: .dynamic
Type: SHT_DYNAMIC
Entries:
- Tag: DT_MIPS_LOCAL_GOTNO
Value: 4
- Tag: DT_MIPS_GOTSYM
Value: 1
- Tag: DT_PLTGOT
Value: 0x1122
DynamicSymbols:
- Name: foo
- Name: bar
Type: STT_FUNC
## Check what we print when there are no local nor global GOT entries.
# RUN: yaml2obj --docnum=3 %s -o %t.got-noentries.exe
# RUN: llvm-readobj -A %t.got-noentries.exe | FileCheck %s --check-prefix=GOT-EMPTY-LLVM
# RUN: llvm-readelf -A %t.got-noentries.exe | FileCheck %s --check-prefix=GOT-EMPTY-GNU
# GOT-EMPTY-LLVM: Primary GOT {
# GOT-EMPTY-LLVM-NEXT: Canonical gp value: 0x9112
# GOT-EMPTY-LLVM-NEXT: Reserved entries [
# GOT-EMPTY-LLVM-NEXT: Entry {
# GOT-EMPTY-LLVM-NEXT: Address: 0x1122
# GOT-EMPTY-LLVM-NEXT: Access: -32752
# GOT-EMPTY-LLVM-NEXT: Initial: 0x0
# GOT-EMPTY-LLVM-NEXT: Purpose: Lazy resolver
# GOT-EMPTY-LLVM-NEXT: }
# GOT-EMPTY-LLVM-NEXT: Entry {
# GOT-EMPTY-LLVM-NEXT: Address: 0x112A
# GOT-EMPTY-LLVM-NEXT: Access: -32744
# GOT-EMPTY-LLVM-NEXT: Initial: 0xFFFFFFFFFFFFFFFF
# GOT-EMPTY-LLVM-NEXT: Purpose: Module pointer (GNU extension)
# GOT-EMPTY-LLVM-NEXT: }
# GOT-EMPTY-LLVM-NEXT: ]
# GOT-EMPTY-LLVM-NEXT: Local entries [
# GOT-EMPTY-LLVM-NEXT: ]
# GOT-EMPTY-LLVM-NEXT: Global entries [
# GOT-EMPTY-LLVM-NEXT: ]
# GOT-EMPTY-LLVM-NEXT: Number of TLS and multi-GOT entries: 0
# GOT-EMPTY-LLVM-NEXT: }
# GOT-EMPTY-GNU: Primary GOT:
# GOT-EMPTY-GNU-NEXT: Canonical gp value: 0000000000009112
# GOT-EMPTY-GNU-EMPTY:
# GOT-EMPTY-GNU-NEXT: Reserved entries:
# GOT-EMPTY-GNU-NEXT: Address Access Initial Purpose
# GOT-EMPTY-GNU-NEXT: 0000000000001122 -32752(gp) 0000000000000000 Lazy resolver
# GOT-EMPTY-GNU-NEXT: 000000000000112a -32744(gp) ffffffffffffffff Module pointer (GNU extension)
# GOT-EMPTY-GNU-NOT: {{.}}
--- !ELF
FileHeader:
Class: ELFCLASS64
Data: ELFDATA2LSB
Type: ET_EXEC
Machine: EM_MIPS
Sections:
- Name: .got
Type: SHT_PROGBITS
Address: 0x1122
ContentArray: [ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ## Lazy resolver.
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF ] ## Module pointer (GNU extension)
Size: [[SIZE=<none>]]
- Name: .dynamic
Type: SHT_DYNAMIC
Entries:
- Tag: DT_MIPS_LOCAL_GOTNO
Value: 2
- Tag: DT_MIPS_GOTSYM
Value: 1
- Tag: DT_PLTGOT
Value: 0x1122
DynamicSymbols: []
## Check we report errors when dynamic tags, needed for dumping GOT, are missing.
# RUN: yaml2obj --docnum=4 -DTAG1=DT_MIPS_LOCAL_GOTNO -DTAG2=DT_MIPS_GOTSYM %s -o %t.err1.o
# RUN: llvm-readobj -A %t.err1.o 2>&1 | FileCheck %s -DFILE=%t.err1.o -check-prefixes=NO-OUTPUT,ERR1
# RUN: yaml2obj --docnum=4 -DTAG1=DT_PLTGOT -DTAG2=DT_MIPS_GOTSYM %s -o %t.err2.o
# RUN: llvm-readobj -A %t.err2.o 2>&1 | FileCheck %s -DFILE=%t.err2.o -check-prefixes=NO-OUTPUT,ERR2
# RUN: yaml2obj --docnum=4 -DTAG1=DT_PLTGOT -DTAG2=DT_MIPS_LOCAL_GOTNO %s -o %t.err3.o
# RUN: llvm-readobj -A %t.err3.o 2>&1 | FileCheck %s -DFILE=%t.err3.o -check-prefixes=NO-OUTPUT,ERR3
--- !ELF
FileHeader:
Class: ELFCLASS64
Data: ELFDATA2LSB
Type: ET_EXEC
Machine: EM_MIPS
Sections:
- Name: .dynamic
Type: SHT_DYNAMIC
Entries:
- Tag: [[TAG1]]
Value: 0
- Tag: [[TAG2]]
Value: 0
- Tag: DT_NULL
Value: 0
DynamicSymbols: []
# RUN: yaml2obj --docnum=5 -DVAL1=0xffff %s -o %t.err4.o
# RUN: llvm-readobj -A %t.err4.o 2>&1 | FileCheck %s -DFILE=%t.err4.o -check-prefixes=NO-OUTPUT,ERR4
# RUN: yaml2obj --docnum=5 -DVAL2=0xffff %s -o %t.err5.o
# RUN: llvm-readobj -A %t.err5.o 2>&1 | FileCheck %s -DFILE=%t.err5.o -check-prefixes=NO-OUTPUT,ERR5
--- !ELF
FileHeader:
Class: ELFCLASS64
Data: ELFDATA2LSB
Type: ET_EXEC
Machine: EM_MIPS
Sections:
- Name: .dynamic
Type: SHT_DYNAMIC
Entries:
- Tag: DT_MIPS_LOCAL_GOTNO
Value: 0
- Tag: DT_MIPS_GOTSYM
Value: [[VAL1=0]]
- Tag: DT_PLTGOT
Value: [[VAL2=0]]
DynamicSymbols: []
# NO-OUTPUT: LoadName: <Not found>
# NO-OUTPUT-NEXT: There is no .MIPS.abiflags section in the file.
# NO-OUTPUT-NEXT: There is no .MIPS.options section in the file.
# NO-OUTPUT-NEXT: There is no .reginfo section in the file.
# ERR1-NEXT: warning: '[[FILE]]': cannot find PLTGOT dynamic tag
# ERR2-NEXT: warning: '[[FILE]]': cannot find MIPS_LOCAL_GOTNO dynamic tag
# ERR3-NEXT: warning: '[[FILE]]': cannot find MIPS_GOTSYM dynamic tag
# ERR4-NEXT: warning: '[[FILE]]': DT_MIPS_GOTSYM value (65535) exceeds the number of dynamic symbols (1)
# ERR5-NEXT: warning: '[[FILE]]': there is no non-empty GOT section at 0xffff
# NO-OUTPUT-EMPTY:
# NO-OUTPUT-NOT: {{.}}
## Check that we do not report a warning about the .got section when we are able to locate it by name.
# RUN: yaml2obj --docnum=6 -DNAME=0xffff %s -o %t.err6.o
# RUN: llvm-readobj -A %t.err6.o 2>&1 | \
# RUN: FileCheck %s -DFILE=%t.err6.o -check-prefix=NAME-ERR-FOUND --implicit-check-not=warning:
# RUN: llvm-readelf -A %t.err6.o 2>&1 | \
# RUN: FileCheck %s -DFILE=%t.err6.o -check-prefix=NAME-ERR-FOUND --implicit-check-not=warning:
# NAME-ERR-FOUND: warning: '[[FILE]]': unable to read the name of SHT_PROGBITS section with index 1: a section [index 1] has an invalid sh_name (0xffff) offset which goes past the end of the section name string table
# NAME-ERR-FOUND-NEXT: warning: '[[FILE]]': unable to read the name of SHT_PROGBITS section with index 3: a section [index 3] has an invalid sh_name (0xffff) offset which goes past the end of the section name string table
--- !ELF
FileHeader:
Class: ELFCLASS64
Data: ELFDATA2LSB
Type: ET_REL
Machine: EM_MIPS
Sections:
- Type: SHT_PROGBITS
ShName: [[NAME=<none>]]
- Name: .got
Type: SHT_PROGBITS
ShName: [[GOTNAME=<none>]]
- Type: SHT_PROGBITS
ShName: [[NAME=<none>]]
## Check we report a warning when we are unable to find the .got section due to an error.
# RUN: yaml2obj --docnum=6 -DGOTNAME=0xffff %s -o %t.err7.o
# RUN: llvm-readelf -A %t.err7.o 2>&1 | FileCheck %s -DFILE=%t.err7.o --check-prefix=NAME-ERR-NOTFOUND --implicit-check-not=warning:
# RUN: llvm-readobj -A %t.err7.o 2>&1 | FileCheck %s -DFILE=%t.err7.o --check-prefix=NAME-ERR-NOTFOUND --implicit-check-not=warning:
# NAME-ERR-NOTFOUND: warning: '[[FILE]]': unable to read the name of SHT_PROGBITS section with index 2: a section [index 2] has an invalid sh_name (0xffff) offset which goes past the end of the section name string table
## Check that we correctly show .got section content when there are some other zero-sized
## sections with the same address as the .got section.
## In this test the empty .data section has the same address as the .got section.
# RUN: yaml2obj --docnum=7 %s -o %t.err7.o
# RUN: llvm-readobj -A %t.err7.o 2>&1 | FileCheck %s -DFILE=%t.err7.o --check-prefix=SAME-ADDR-LLVM
# RUN: llvm-readelf -A %t.err7.o 2>&1 | FileCheck %s -DFILE=%t.err7.o --check-prefix=SAME-ADDR-GNU
# SAME-ADDR-LLVM: Primary GOT {
# SAME-ADDR-LLVM-NEXT: Canonical gp value: 0x9112
# SAME-ADDR-LLVM-NEXT: Reserved entries [
# SAME-ADDR-LLVM-NEXT: Entry {
# SAME-ADDR-LLVM-NEXT: Address: 0x1122
# SAME-ADDR-LLVM-NEXT: Access: -32752
# SAME-ADDR-LLVM-NEXT: Initial: 0x0
# SAME-ADDR-LLVM-NEXT: Purpose: Lazy resolver
# SAME-ADDR-LLVM-NEXT: }
# SAME-ADDR-LLVM-NEXT: ]
# SAME-ADDR-LLVM-NEXT: Local entries [
# SAME-ADDR-LLVM-NEXT: ]
# SAME-ADDR-LLVM-NEXT: Global entries [
# SAME-ADDR-LLVM-NEXT: Entry {
# SAME-ADDR-LLVM-NEXT: Address: 0x112A
# SAME-ADDR-LLVM-NEXT: Access: -32744
# SAME-ADDR-LLVM-NEXT: Initial: 0x0
# SAME-ADDR-LLVM-NEXT: Value: 0x0
# SAME-ADDR-LLVM-NEXT: Type: None (0x0)
# SAME-ADDR-LLVM-NEXT: Section: Undefined (0x0)
# SAME-ADDR-LLVM-NEXT: Name: foo (1)
# SAME-ADDR-LLVM-NEXT: }
# SAME-ADDR-LLVM-NEXT: ]
# SAME-ADDR-LLVM-NEXT: Number of TLS and multi-GOT entries: 0
# SAME-ADDR-LLVM-NEXT: }
# SAME-ADDR-GNU: Primary GOT:
# SAME-ADDR-GNU-NEXT: Canonical gp value: 0000000000009112
# SAME-ADDR-GNU-EMPTY:
# SAME-ADDR-GNU-NEXT: Reserved entries:
# SAME-ADDR-GNU-NEXT: Address Access Initial Purpose
# SAME-ADDR-GNU-NEXT: 0000000000001122 -32752(gp) 0000000000000000 Lazy resolver
# SAME-ADDR-GNU-EMPTY:
# SAME-ADDR-GNU-NEXT: Global entries:
# SAME-ADDR-GNU-NEXT: Address Access Initial Sym.Val. Type Ndx Name
# SAME-ADDR-GNU-NEXT: 000000000000112a -32744(gp) 0000000000000000 0000000000000000 NOTYPE UND foo
--- !ELF
FileHeader:
Class: ELFCLASS64
Data: ELFDATA2LSB
Type: ET_REL
Machine: EM_MIPS
Sections:
- Name: .data
Type: SHT_PROGBITS
Address: 0x1122
Size: 0
- Name: .got
Type: SHT_PROGBITS
Address: 0x1122
Size: 16
- Name: .dynamic
Type: SHT_DYNAMIC
Entries:
- Tag: DT_MIPS_LOCAL_GOTNO
Value: 1
- Tag: DT_MIPS_GOTSYM
Value: 1
- Tag: DT_PLTGOT
Value: 0x1122
DynamicSymbols:
- Name: foo
## Check how we print global GOT entries when they are unnamed section symbols.
# RUN: yaml2obj --docnum=8 %s -o %t.err8.o
# RUN: llvm-readobj -A %t.err8.o 2>&1 | FileCheck %s -DFILE=%t.err8.o --check-prefix=SEC-SYMS-LLVM
# RUN: llvm-readelf -A %t.err8.o 2>&1 | FileCheck %s -DFILE=%t.err8.o --check-prefix=SEC-SYMS-GNU
# SEC-SYMS-LLVM: Global entries [
# SEC-SYMS-LLVM-NEXT: Entry {
# SEC-SYMS-LLVM: Section: Absolute (0xFFF1)
# SEC-SYMS-LLVM-NEXT: warning: '[[FILE]]': unable to get section index for symbol with st_shndx = 0xfff1 (SHN_ABS)
# SEC-SYMS-LLVM-NEXT: Name: <?> (0)
# SEC-SYMS-LLVM-NEXT: }
# SEC-SYMS-LLVM-NEXT: Entry {
# SEC-SYMS-LLVM: Section: .got (0x1)
# SEC-SYMS-LLVM-NEXT: Name: .got (0)
# SEC-SYMS-LLVM-NEXT: }
# SEC-SYMS-LLVM-NEXT: Entry {
# SEC-SYMS-LLVM: Section: Common (0xFFF2)
# SEC-SYMS-LLVM-NEXT: warning: '[[FILE]]': unable to get section index for symbol with st_shndx = 0xfff2 (SHN_COMMON)
# SEC-SYMS-LLVM-NEXT: Name: <?> (0)
# SEC-SYMS-LLVM-NEXT: }
# SEC-SYMS-LLVM-NEXT: Entry {
# SEC-SYMS-LLVM: Type: Section (0x3)
# SEC-SYMS-LLVM-NEXT: warning: '[[FILE]]': found an extended symbol index (4), but unable to locate the extended symbol index table
# SEC-SYMS-LLVM-NEXT: Section: Reserved (0xFFFF)
# SEC-SYMS-LLVM-NEXT: Name: <?> (0)
# SEC-SYMS-LLVM-NEXT: }
# SEC-SYMS-LLVM-NEXT: ]
# SEC-SYMS-GNU: Global entries:
# SEC-SYMS-GNU-NEXT: {{.*}} Ndx Name
# SEC-SYMS-GNU-NEXT: warning: '[[FILE]]': unable to get section index for symbol with st_shndx = 0xfff1 (SHN_ABS)
# SEC-SYMS-GNU-NEXT: {{.*}} ABS <?>
# SEC-SYMS-GNU-NEXT: {{.*}} 1 .got
# SEC-SYMS-GNU-NEXT: warning: '[[FILE]]': unable to get section index for symbol with st_shndx = 0xfff2 (SHN_COMMON)
# SEC-SYMS-GNU-NEXT: {{.*}} COM <?>
# SEC-SYMS-GNU-NEXT: warning: '[[FILE]]': found an extended symbol index (4), but unable to locate the extended symbol index table
# SEC-SYMS-GNU-NEXT: {{.*}} RSV[0xffff] <?>
--- !ELF
FileHeader:
Class: ELFCLASS64
Data: ELFDATA2LSB
Type: ET_REL
Machine: EM_MIPS
Sections:
- Name: .got
Type: SHT_PROGBITS
Address: 0x1122
Size: 48
- Name: .dynamic
Type: SHT_DYNAMIC
Entries:
- Tag: DT_MIPS_LOCAL_GOTNO
Value: 1
- Tag: DT_MIPS_GOTSYM
Value: 1
- Tag: DT_PLTGOT
Value: 0x1122
DynamicSymbols:
- Type: STT_SECTION
Index: SHN_ABS
- Type: STT_SECTION
Section: .got
- Type: STT_SECTION
Index: SHN_COMMON
- Type: STT_SECTION
Index: SHN_XINDEX
|