brintos

brintos / llvm-project-archived public Read only

0
0
Text · 24.0 KiB · 6e6d808 Raw
606 lines · plain
1## Check that we are able to dump MIPS GOT entries using -A properly.2 3## Check how we dump 64-bit inputs.4 5# RUN: yaml2obj --docnum=1 -DTYPE=ET_REL %s -o %t.got.o6# RUN: yaml2obj --docnum=1 -DTYPE=ET_DYN %s -o %t.got.so7# RUN: yaml2obj --docnum=1 -DTYPE=ET_EXEC %s -o %t.got.exe8 9# RUN: llvm-readobj -A %t.got.o 2>&1 | FileCheck %s -DOTHERNUM=0 -check-prefix=BASIC-LLVM10# RUN: llvm-readobj -A %t.got.so 2>&1 | FileCheck %s -DOTHERNUM=0 -check-prefix=BASIC-LLVM11# RUN: llvm-readobj -A %t.got.exe 2>&1 | FileCheck %s -DOTHERNUM=0 -check-prefix=BASIC-LLVM12# RUN: llvm-readelf -A %t.got.o 2>&1 | FileCheck %s -check-prefix=BASIC-GNU \13# RUN:   --implicit-check-not="Number of" --strict-whitespace --match-full-lines14# RUN: llvm-readelf -A %t.got.so 2>&1 | FileCheck %s -check-prefix=BASIC-GNU \15# RUN:   --implicit-check-not="Number of" --strict-whitespace --match-full-lines16# RUN: llvm-readelf -A %t.got.exe 2>&1 | FileCheck %s -check-prefix=BASIC-GNU \17# RUN:   --implicit-check-not="Number of" --strict-whitespace --match-full-lines18 19--- !ELF20FileHeader:21  Class:   ELFCLASS6422  Data:    ELFDATA2LSB23  Type:    [[TYPE=ET_EXEC]]24  Machine: EM_MIPS25Sections:26  - Name:    .got27    Type:    SHT_PROGBITS28    Address: 0x112229    ContentArray: [ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,  ## Lazy resolver.30                    0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,  ## Module pointer (GNU extension)31                    0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,  ## Local entry 132                    0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22,  ## Local entry 233                    0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA,  ## Global entry 134                    0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB ] ## Global entry 235    Size: [[SIZE=<none>]]36  - Name:   .dynamic37    Type:   SHT_DYNAMIC38    ShType: [[DYNAMICTYPE=<none>]]39    Entries:40      - Tag:   DT_MIPS_LOCAL_GOTNO41        Value: 442      - Tag:   DT_MIPS_GOTSYM43        Value: 144      - Tag:   DT_PLTGOT45        Value: 0x112246DynamicSymbols:47  - Name: foo48  - Name: bar49    Type: STT_FUNC50 51# BASIC-LLVM:      Primary GOT {52# BASIC-LLVM-NEXT:   Canonical gp value: 0x911253# BASIC-LLVM-NEXT:   Reserved entries [54# BASIC-LLVM-NEXT:     Entry {55# BASIC-LLVM-NEXT:       Address: 0x112256# BASIC-LLVM-NEXT:       Access: -3275257# BASIC-LLVM-NEXT:       Initial: 0x058# BASIC-LLVM-NEXT:       Purpose: Lazy resolver59# BASIC-LLVM-NEXT:     }60# BASIC-LLVM-NEXT:     Entry {61# BASIC-LLVM-NEXT:       Address: 0x112A62# BASIC-LLVM-NEXT:       Access: -3274463# BASIC-LLVM-NEXT:       Initial: 0xFFFFFFFFFFFFFFFF64# BASIC-LLVM-NEXT:       Purpose: Module pointer (GNU extension)65# BASIC-LLVM-NEXT:     }66# BASIC-LLVM-NEXT:   ]67# BASIC-LLVM-NEXT:   Local entries [68# BASIC-LLVM-NEXT:     Entry {69# BASIC-LLVM-NEXT:       Address: 0x113270# BASIC-LLVM-NEXT:       Access: -3273671# BASIC-LLVM-NEXT:       Initial: 0x111111111111111172# BASIC-LLVM-NEXT:     }73# BASIC-LLVM-NEXT:     Entry {74# BASIC-LLVM-NEXT:       Address: 0x113A75# BASIC-LLVM-NEXT:       Access: -3272876# BASIC-LLVM-NEXT:       Initial: 0x222222222222222277# BASIC-LLVM-NEXT:     }78# BASIC-LLVM-NEXT:   ]79# BASIC-LLVM-NEXT:   Global entries [80# BASIC-LLVM-NEXT:     Entry {81# BASIC-LLVM-NEXT:       Address: 0x114282# BASIC-LLVM-NEXT:       Access: -3272083# BASIC-LLVM-NEXT:       Initial: 0xAAAAAAAAAAAAAAAA84# BASIC-LLVM-NEXT:       Value: 0x085# BASIC-LLVM-NEXT:       Type: None (0x0)86# BASIC-LLVM-NEXT:       Section: Undefined (0x0)87# BASIC-LLVM-NEXT:       Name: foo (5)88# BASIC-LLVM-NEXT:     }89# BASIC-LLVM-NEXT:     Entry {90# BASIC-LLVM-NEXT:       Address: 0x114A91# BASIC-LLVM-NEXT:       Access: -3271292# BASIC-LLVM-NEXT:       Initial: 0xBBBBBBBBBBBBBBBB93# BASIC-LLVM-NEXT:       Value: 0x094# BASIC-LLVM-NEXT:       Type: Function (0x2)95# BASIC-LLVM-NEXT:       Section: Undefined (0x0)96# BASIC-LLVM-NEXT:       Name: bar (1)97# BASIC-LLVM-NEXT:     }98# BASIC-LLVM-NEXT:   ]99# BASIC-LLVM-NEXT:   Number of TLS and multi-GOT entries: [[OTHERNUM]]100# BASIC-LLVM-NEXT: }101 102#            BASIC-GNU:Primary GOT:103#       BASIC-GNU-NEXT: Canonical gp value: 0000000000009112104#      BASIC-GNU-EMPTY:105#       BASIC-GNU-NEXT: Reserved entries:106#       BASIC-GNU-NEXT:           Address     Access          Initial Purpose107#       BASIC-GNU-NEXT:  0000000000001122 -32752(gp) 0000000000000000 Lazy resolver108#       BASIC-GNU-NEXT:  000000000000112a -32744(gp) ffffffffffffffff Module pointer (GNU extension)109#      BASIC-GNU-EMPTY:110#       BASIC-GNU-NEXT: Local entries:111#       BASIC-GNU-NEXT:           Address     Access          Initial112#       BASIC-GNU-NEXT:  0000000000001132 -32736(gp) 1111111111111111 {{$}}113#       BASIC-GNU-NEXT:  000000000000113a -32728(gp) 2222222222222222 {{$}}114#      BASIC-GNU-EMPTY:115#       BASIC-GNU-NEXT: Global entries:116#       BASIC-GNU-NEXT:           Address     Access          Initial         Sym.Val. Type    Ndx Name117#       BASIC-GNU-NEXT:  0000000000001142 -32720(gp) aaaaaaaaaaaaaaaa 0000000000000000 NOTYPE  UND foo118#       BASIC-GNU-NEXT:  000000000000114a -32712(gp) bbbbbbbbbbbbbbbb 0000000000000000 FUNC    UND bar119#      BASIC-GNU-EMPTY:120# BASIC-GNU-OTHER-NEXT: Number of TLS and multi-GOT entries [[OTHERNUM]]121 122## Check we are able to print the number of TLS and multi-GOT entries properly.123 124# RUN: yaml2obj --docnum=1 %s -DSIZE=56 -o %t.other.entries1.exe125# RUN: yaml2obj --docnum=1 %s -DSIZE=64 -o %t.other.entries2.exe126# RUN: llvm-readobj -A %t.other.entries1.exe 2>&1 | FileCheck %s -DOTHERNUM=1 --check-prefix=BASIC-LLVM127# RUN: llvm-readobj -A %t.other.entries2.exe 2>&1 | FileCheck %s -DOTHERNUM=2 -check-prefix=BASIC-LLVM128# RUN: llvm-readelf -A %t.other.entries1.exe 2>&1 | FileCheck %s -DOTHERNUM=1 \129# RUN:   --check-prefixes=BASIC-GNU,BASIC-GNU-OTHER --strict-whitespace --match-full-lines130# RUN: llvm-readelf -A %t.other.entries2.exe 2>&1 | FileCheck %s -DOTHERNUM=2 \131# RUN:   --check-prefixes=BASIC-GNU,BASIC-GNU-OTHER --strict-whitespace --match-full-lines132 133## Check how we print static GOT. Our code assumes that the GOT is static when there134## is no .dynamic section, so we change its type to hide it.135 136# RUN: yaml2obj --docnum=1 -DDYNAMICTYPE=SHT_PROGBITS %s -o %t.got-static.exe137# RUN: llvm-readobj -A %t.got-static.exe | FileCheck %s --check-prefix=STATIC-GOT-LLVM138# RUN: llvm-readelf -A %t.got-static.exe | FileCheck %s --check-prefix=STATIC-GOT-GNU139 140# STATIC-GOT-LLVM:      Static GOT {141# STATIC-GOT-LLVM-NEXT:   Canonical gp value: 0x9112142# STATIC-GOT-LLVM-NEXT:   Reserved entries [143# STATIC-GOT-LLVM-NEXT:     Entry {144# STATIC-GOT-LLVM-NEXT:       Address: 0x1122145# STATIC-GOT-LLVM-NEXT:       Access: -32752146# STATIC-GOT-LLVM-NEXT:       Initial: 0x0147# STATIC-GOT-LLVM-NEXT:       Purpose: Lazy resolver148# STATIC-GOT-LLVM-NEXT:     }149# STATIC-GOT-LLVM-NEXT:     Entry {150# STATIC-GOT-LLVM-NEXT:       Address: 0x112A151# STATIC-GOT-LLVM-NEXT:       Access: -32744152# STATIC-GOT-LLVM-NEXT:       Initial: 0xFFFFFFFFFFFFFFFF153# STATIC-GOT-LLVM-NEXT:       Purpose: Module pointer (GNU extension)154# STATIC-GOT-LLVM-NEXT:     }155# STATIC-GOT-LLVM-NEXT:   ]156# STATIC-GOT-LLVM-NEXT:   Local entries [157# STATIC-GOT-LLVM-NEXT:     Entry {158# STATIC-GOT-LLVM-NEXT:       Address: 0x1132159# STATIC-GOT-LLVM-NEXT:       Access: -32736160# STATIC-GOT-LLVM-NEXT:       Initial: 0x1111111111111111161# STATIC-GOT-LLVM-NEXT:     }162# STATIC-GOT-LLVM-NEXT:     Entry {163# STATIC-GOT-LLVM-NEXT:       Address: 0x113A164# STATIC-GOT-LLVM-NEXT:       Access: -32728165# STATIC-GOT-LLVM-NEXT:       Initial: 0x2222222222222222166# STATIC-GOT-LLVM-NEXT:     }167# STATIC-GOT-LLVM-NEXT:     Entry {168# STATIC-GOT-LLVM-NEXT:       Address: 0x1142169# STATIC-GOT-LLVM-NEXT:       Access: -32720170# STATIC-GOT-LLVM-NEXT:       Initial: 0xAAAAAAAAAAAAAAAA171# STATIC-GOT-LLVM-NEXT:     }172# STATIC-GOT-LLVM-NEXT:     Entry {173# STATIC-GOT-LLVM-NEXT:       Address: 0x114A174# STATIC-GOT-LLVM-NEXT:       Access: -32712175# STATIC-GOT-LLVM-NEXT:       Initial: 0xBBBBBBBBBBBBBBBB176# STATIC-GOT-LLVM-NEXT:     }177# STATIC-GOT-LLVM-NEXT:   ]178# STATIC-GOT-LLVM-NEXT: }179 180# STATIC-GOT-GNU:       Static GOT:181# STATIC-GOT-GNU-NEXT:   Canonical gp value: 0000000000009112182# STATIC-GOT-GNU-EMPTY:183# STATIC-GOT-GNU-NEXT:   Reserved entries:184# STATIC-GOT-GNU-NEXT:             Address     Access          Initial Purpose185# STATIC-GOT-GNU-NEXT:    0000000000001122 -32752(gp) 0000000000000000 Lazy resolver186# STATIC-GOT-GNU-NEXT:    000000000000112a -32744(gp) ffffffffffffffff Module pointer (GNU extension)187# STATIC-GOT-GNU-EMPTY:188# STATIC-GOT-GNU-NEXT:   Local entries:189# STATIC-GOT-GNU-NEXT:             Address     Access          Initial190# STATIC-GOT-GNU-NEXT:    0000000000001132 -32736(gp) 1111111111111111191# STATIC-GOT-GNU-NEXT:    000000000000113a -32728(gp) 2222222222222222192# STATIC-GOT-GNU-NEXT:    0000000000001142 -32720(gp) aaaaaaaaaaaaaaaa193# STATIC-GOT-GNU-NEXT:    000000000000114a -32712(gp) bbbbbbbbbbbbbbbb194# STATIC-GOT-GNU-EMPTY:195# STATIC-GOT-GNU-NOT:   {{.}}196 197## Check how we dump 32-bit inputs.198 199# RUN: yaml2obj --docnum=2 %s -o %t.got32.exe200# RUN: llvm-readobj -A %t.got32.exe 2>&1 | FileCheck %s -check-prefix=BASIC32-LLVM201# RUN: llvm-readelf -A %t.got32.exe 2>&1 | FileCheck %s -check-prefix=BASIC32-GNU \202# RUN:   --strict-whitespace --match-full-lines203 204# BASIC32-LLVM:      Primary GOT {205# BASIC32-LLVM-NEXT:   Canonical gp value: 0x9112206# BASIC32-LLVM-NEXT:   Reserved entries [207# BASIC32-LLVM-NEXT:     Entry {208# BASIC32-LLVM-NEXT:       Address: 0x1122209# BASIC32-LLVM-NEXT:       Access: -32752210# BASIC32-LLVM-NEXT:       Initial: 0x0211# BASIC32-LLVM-NEXT:       Purpose: Lazy resolver212# BASIC32-LLVM-NEXT:     }213# BASIC32-LLVM-NEXT:     Entry {214# BASIC32-LLVM-NEXT:       Address: 0x1126215# BASIC32-LLVM-NEXT:       Access: -32748216# BASIC32-LLVM-NEXT:       Initial: 0xFFFFFFFF217# BASIC32-LLVM-NEXT:       Purpose: Module pointer (GNU extension)218# BASIC32-LLVM-NEXT:     }219# BASIC32-LLVM-NEXT:   ]220# BASIC32-LLVM-NEXT:   Local entries [221# BASIC32-LLVM-NEXT:     Entry {222# BASIC32-LLVM-NEXT:       Address: 0x112A223# BASIC32-LLVM-NEXT:       Access: -32744224# BASIC32-LLVM-NEXT:       Initial: 0x11111111225# BASIC32-LLVM-NEXT:     }226# BASIC32-LLVM-NEXT:     Entry {227# BASIC32-LLVM-NEXT:       Address: 0x112E228# BASIC32-LLVM-NEXT:       Access: -32740229# BASIC32-LLVM-NEXT:       Initial: 0x22222222230# BASIC32-LLVM-NEXT:     }231# BASIC32-LLVM-NEXT:   ]232# BASIC32-LLVM-NEXT:   Global entries [233# BASIC32-LLVM-NEXT:     Entry {234# BASIC32-LLVM-NEXT:       Address: 0x1132235# BASIC32-LLVM-NEXT:       Access: -32736236# BASIC32-LLVM-NEXT:       Initial: 0xAAAAAAAA237# BASIC32-LLVM-NEXT:       Value: 0x0238# BASIC32-LLVM-NEXT:       Type: None (0x0)239# BASIC32-LLVM-NEXT:       Section: Undefined (0x0)240# BASIC32-LLVM-NEXT:       Name: foo (5)241# BASIC32-LLVM-NEXT:     }242# BASIC32-LLVM-NEXT:     Entry {243# BASIC32-LLVM-NEXT:       Address: 0x1136244# BASIC32-LLVM-NEXT:       Access: -32732245# BASIC32-LLVM-NEXT:       Initial: 0xBBBBBBBB246# BASIC32-LLVM-NEXT:       Value: 0x0247# BASIC32-LLVM-NEXT:       Type: Function (0x2)248# BASIC32-LLVM-NEXT:       Section: Undefined (0x0)249# BASIC32-LLVM-NEXT:       Name: bar (1)250# BASIC32-LLVM-NEXT:     }251# BASIC32-LLVM-NEXT:   ]252# BASIC32-LLVM-NEXT:   Number of TLS and multi-GOT entries: 1253# BASIC32-LLVM-NEXT: }254 255#       BASIC32-GNU:Primary GOT:256#  BASIC32-GNU-NEXT: Canonical gp value: 00009112257# BASIC32-GNU-EMPTY:258#  BASIC32-GNU-NEXT: Reserved entries:259#  BASIC32-GNU-NEXT:   Address     Access  Initial Purpose260#  BASIC32-GNU-NEXT:  00001122 -32752(gp) 00000000 Lazy resolver261#  BASIC32-GNU-NEXT:  00001126 -32748(gp) ffffffff Module pointer (GNU extension)262# BASIC32-GNU-EMPTY:263#  BASIC32-GNU-NEXT: Local entries:264#  BASIC32-GNU-NEXT:   Address     Access  Initial265#  BASIC32-GNU-NEXT:  0000112a -32744(gp) 11111111 {{$}}266#  BASIC32-GNU-NEXT:  0000112e -32740(gp) 22222222 {{$}}267# BASIC32-GNU-EMPTY:268#  BASIC32-GNU-NEXT: Global entries:269#  BASIC32-GNU-NEXT:   Address     Access  Initial Sym.Val. Type    Ndx Name270#  BASIC32-GNU-NEXT:  00001132 -32736(gp) aaaaaaaa 00000000 NOTYPE  UND foo271#  BASIC32-GNU-NEXT:  00001136 -32732(gp) bbbbbbbb 00000000 FUNC    UND bar272# BASIC32-GNU-EMPTY:273#  BASIC32-GNU-NEXT: Number of TLS and multi-GOT entries 1274 275--- !ELF276FileHeader:277  Class:   ELFCLASS32278  Data:    ELFDATA2LSB279  Type:    ET_EXEC280  Machine: EM_MIPS281Sections:282  - Name:    .got283    Type:    SHT_PROGBITS284    Address: 0x1122285    ContentArray: [ 0x00, 0x00, 0x00, 0x00,  ## Lazy resolver.286                    0xFF, 0xFF, 0xFF, 0xFF,  ## Module pointer (GNU extension).287                    0x11, 0x11, 0x11, 0x11,  ## Local entry 1.288                    0x22, 0x22, 0x22, 0x22,  ## Local entry 2.289                    0xAA, 0xAA, 0xAA, 0xAA,  ## Global entry 1.290                    0xBB, 0xBB, 0xBB, 0xBB,  ## Global entry 2.291                    0x00, 0x00, 0x00, 0x00 ] ## Other entry.292  - Name: .dynamic293    Type: SHT_DYNAMIC294    Entries:295      - Tag:   DT_MIPS_LOCAL_GOTNO296        Value: 4297      - Tag:   DT_MIPS_GOTSYM298        Value: 1299      - Tag:   DT_PLTGOT300        Value: 0x1122301DynamicSymbols:302  - Name: foo303  - Name: bar304    Type: STT_FUNC305 306## Check what we print when there are no local nor global GOT entries.307 308# RUN: yaml2obj --docnum=3 %s -o %t.got-noentries.exe309# RUN: llvm-readobj -A %t.got-noentries.exe | FileCheck %s --check-prefix=GOT-EMPTY-LLVM310# RUN: llvm-readelf -A %t.got-noentries.exe | FileCheck %s --check-prefix=GOT-EMPTY-GNU311 312# GOT-EMPTY-LLVM:      Primary GOT {313# GOT-EMPTY-LLVM-NEXT:   Canonical gp value: 0x9112314# GOT-EMPTY-LLVM-NEXT:   Reserved entries [315# GOT-EMPTY-LLVM-NEXT:     Entry {316# GOT-EMPTY-LLVM-NEXT:       Address: 0x1122317# GOT-EMPTY-LLVM-NEXT:       Access: -32752318# GOT-EMPTY-LLVM-NEXT:       Initial: 0x0319# GOT-EMPTY-LLVM-NEXT:       Purpose: Lazy resolver320# GOT-EMPTY-LLVM-NEXT:     }321# GOT-EMPTY-LLVM-NEXT:     Entry {322# GOT-EMPTY-LLVM-NEXT:       Address: 0x112A323# GOT-EMPTY-LLVM-NEXT:       Access: -32744324# GOT-EMPTY-LLVM-NEXT:       Initial: 0xFFFFFFFFFFFFFFFF325# GOT-EMPTY-LLVM-NEXT:       Purpose: Module pointer (GNU extension)326# GOT-EMPTY-LLVM-NEXT:     }327# GOT-EMPTY-LLVM-NEXT:   ]328# GOT-EMPTY-LLVM-NEXT:   Local entries [329# GOT-EMPTY-LLVM-NEXT:   ]330# GOT-EMPTY-LLVM-NEXT:   Global entries [331# GOT-EMPTY-LLVM-NEXT:   ]332# GOT-EMPTY-LLVM-NEXT:   Number of TLS and multi-GOT entries: 0333# GOT-EMPTY-LLVM-NEXT: }334 335# GOT-EMPTY-GNU:      Primary GOT:336# GOT-EMPTY-GNU-NEXT:  Canonical gp value: 0000000000009112337# GOT-EMPTY-GNU-EMPTY:338# GOT-EMPTY-GNU-NEXT:  Reserved entries:339# GOT-EMPTY-GNU-NEXT:            Address     Access          Initial Purpose340# GOT-EMPTY-GNU-NEXT:   0000000000001122 -32752(gp) 0000000000000000 Lazy resolver341# GOT-EMPTY-GNU-NEXT:   000000000000112a -32744(gp) ffffffffffffffff Module pointer (GNU extension)342# GOT-EMPTY-GNU-NOT:  {{.}}343 344--- !ELF345FileHeader:346  Class:   ELFCLASS64347  Data:    ELFDATA2LSB348  Type:    ET_EXEC349  Machine: EM_MIPS350Sections:351  - Name:    .got352    Type:    SHT_PROGBITS353    Address: 0x1122354    ContentArray: [ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,  ## Lazy resolver.355                    0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF ] ## Module pointer (GNU extension)356    Size: [[SIZE=<none>]]357  - Name: .dynamic358    Type: SHT_DYNAMIC359    Entries:360      - Tag:   DT_MIPS_LOCAL_GOTNO361        Value: 2362      - Tag:   DT_MIPS_GOTSYM363        Value: 1364      - Tag:   DT_PLTGOT365        Value: 0x1122366DynamicSymbols: []367 368## Check we report errors when dynamic tags, needed for dumping GOT, are missing.369 370# RUN: yaml2obj --docnum=4 -DTAG1=DT_MIPS_LOCAL_GOTNO -DTAG2=DT_MIPS_GOTSYM %s -o %t.err1.o371# RUN: llvm-readobj -A %t.err1.o 2>&1 | FileCheck %s -DFILE=%t.err1.o -check-prefixes=NO-OUTPUT,ERR1372 373# RUN: yaml2obj --docnum=4 -DTAG1=DT_PLTGOT -DTAG2=DT_MIPS_GOTSYM %s -o %t.err2.o374# RUN: llvm-readobj -A %t.err2.o 2>&1 | FileCheck %s -DFILE=%t.err2.o -check-prefixes=NO-OUTPUT,ERR2375 376# RUN: yaml2obj --docnum=4 -DTAG1=DT_PLTGOT -DTAG2=DT_MIPS_LOCAL_GOTNO %s -o %t.err3.o377# RUN: llvm-readobj -A %t.err3.o 2>&1 | FileCheck %s -DFILE=%t.err3.o -check-prefixes=NO-OUTPUT,ERR3378 379--- !ELF380FileHeader:381  Class:   ELFCLASS64382  Data:    ELFDATA2LSB383  Type:    ET_EXEC384  Machine: EM_MIPS385Sections:386  - Name: .dynamic387    Type: SHT_DYNAMIC388    Entries:389      - Tag:   [[TAG1]]390        Value: 0391      - Tag:   [[TAG2]]392        Value: 0393      - Tag:   DT_NULL394        Value: 0395DynamicSymbols: []396 397# RUN: yaml2obj --docnum=5 -DVAL1=0xffff %s -o %t.err4.o398# RUN: llvm-readobj -A %t.err4.o 2>&1 | FileCheck %s -DFILE=%t.err4.o -check-prefixes=NO-OUTPUT,ERR4399 400# RUN: yaml2obj --docnum=5 -DVAL2=0xffff %s -o %t.err5.o401# RUN: llvm-readobj -A %t.err5.o 2>&1 | FileCheck %s -DFILE=%t.err5.o -check-prefixes=NO-OUTPUT,ERR5402 403--- !ELF404FileHeader:405  Class:   ELFCLASS64406  Data:    ELFDATA2LSB407  Type:    ET_EXEC408  Machine: EM_MIPS409Sections:410  - Name: .dynamic411    Type: SHT_DYNAMIC412    Entries:413      - Tag:   DT_MIPS_LOCAL_GOTNO414        Value: 0415      - Tag:   DT_MIPS_GOTSYM416        Value: [[VAL1=0]]417      - Tag:   DT_PLTGOT418        Value: [[VAL2=0]]419DynamicSymbols: []420 421# NO-OUTPUT:      LoadName: <Not found>422# NO-OUTPUT-NEXT: There is no .MIPS.abiflags section in the file.423# NO-OUTPUT-NEXT: There is no .MIPS.options section in the file.424# NO-OUTPUT-NEXT: There is no .reginfo section in the file.425 426# ERR1-NEXT: warning: '[[FILE]]': cannot find PLTGOT dynamic tag427# ERR2-NEXT: warning: '[[FILE]]': cannot find MIPS_LOCAL_GOTNO dynamic tag428# ERR3-NEXT: warning: '[[FILE]]': cannot find MIPS_GOTSYM dynamic tag429# ERR4-NEXT: warning: '[[FILE]]': DT_MIPS_GOTSYM value (65535) exceeds the number of dynamic symbols (1)430# ERR5-NEXT: warning: '[[FILE]]': there is no non-empty GOT section at 0xffff431 432# NO-OUTPUT-EMPTY:433# NO-OUTPUT-NOT: {{.}}434 435## Check that we do not report a warning about the .got section when we are able to locate it by name.436# RUN: yaml2obj --docnum=6 -DNAME=0xffff %s -o %t.err6.o437# RUN: llvm-readobj -A %t.err6.o 2>&1 | \438# RUN:   FileCheck %s -DFILE=%t.err6.o -check-prefix=NAME-ERR-FOUND --implicit-check-not=warning:439# RUN: llvm-readelf -A %t.err6.o 2>&1 | \440# RUN:   FileCheck %s -DFILE=%t.err6.o -check-prefix=NAME-ERR-FOUND --implicit-check-not=warning:441 442# 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 table443# 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 table444 445--- !ELF446FileHeader:447  Class:   ELFCLASS64448  Data:    ELFDATA2LSB449  Type:    ET_REL450  Machine: EM_MIPS451Sections:452  - Type:   SHT_PROGBITS453    ShName: [[NAME=<none>]]454  - Name:   .got455    Type:   SHT_PROGBITS456    ShName: [[GOTNAME=<none>]]457  - Type:   SHT_PROGBITS458    ShName: [[NAME=<none>]]459 460## Check we report a warning when we are unable to find the .got section due to an error.461# RUN: yaml2obj --docnum=6 -DGOTNAME=0xffff %s -o %t.err7.o462# RUN: llvm-readelf -A %t.err7.o 2>&1 | FileCheck %s -DFILE=%t.err7.o --check-prefix=NAME-ERR-NOTFOUND --implicit-check-not=warning:463# RUN: llvm-readobj -A %t.err7.o 2>&1 | FileCheck %s -DFILE=%t.err7.o --check-prefix=NAME-ERR-NOTFOUND --implicit-check-not=warning:464 465# 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 table466 467## Check that we correctly show .got section content when there are some other zero-sized468## sections with the same address as the .got section.469## In this test the empty .data section has the same address as the .got section.470 471# RUN: yaml2obj --docnum=7 %s -o %t.err7.o472# RUN: llvm-readobj -A %t.err7.o 2>&1 | FileCheck %s -DFILE=%t.err7.o --check-prefix=SAME-ADDR-LLVM473# RUN: llvm-readelf -A %t.err7.o 2>&1 | FileCheck %s -DFILE=%t.err7.o --check-prefix=SAME-ADDR-GNU474 475# SAME-ADDR-LLVM:      Primary GOT {476# SAME-ADDR-LLVM-NEXT:   Canonical gp value: 0x9112477# SAME-ADDR-LLVM-NEXT:   Reserved entries [478# SAME-ADDR-LLVM-NEXT:     Entry {479# SAME-ADDR-LLVM-NEXT:       Address: 0x1122480# SAME-ADDR-LLVM-NEXT:       Access: -32752481# SAME-ADDR-LLVM-NEXT:       Initial: 0x0482# SAME-ADDR-LLVM-NEXT:       Purpose: Lazy resolver483# SAME-ADDR-LLVM-NEXT:     }484# SAME-ADDR-LLVM-NEXT:   ]485# SAME-ADDR-LLVM-NEXT:   Local entries [486# SAME-ADDR-LLVM-NEXT:   ]487# SAME-ADDR-LLVM-NEXT:   Global entries [488# SAME-ADDR-LLVM-NEXT:     Entry {489# SAME-ADDR-LLVM-NEXT:       Address: 0x112A490# SAME-ADDR-LLVM-NEXT:       Access: -32744491# SAME-ADDR-LLVM-NEXT:       Initial: 0x0492# SAME-ADDR-LLVM-NEXT:       Value: 0x0493# SAME-ADDR-LLVM-NEXT:       Type: None (0x0)494# SAME-ADDR-LLVM-NEXT:       Section: Undefined (0x0)495# SAME-ADDR-LLVM-NEXT:       Name: foo (1)496# SAME-ADDR-LLVM-NEXT:     }497# SAME-ADDR-LLVM-NEXT:   ]498# SAME-ADDR-LLVM-NEXT:   Number of TLS and multi-GOT entries: 0499# SAME-ADDR-LLVM-NEXT: }500 501# SAME-ADDR-GNU:      Primary GOT:502# SAME-ADDR-GNU-NEXT:  Canonical gp value: 0000000000009112503# SAME-ADDR-GNU-EMPTY:504# SAME-ADDR-GNU-NEXT:  Reserved entries:505# SAME-ADDR-GNU-NEXT:            Address     Access          Initial Purpose506# SAME-ADDR-GNU-NEXT:   0000000000001122 -32752(gp) 0000000000000000 Lazy resolver507# SAME-ADDR-GNU-EMPTY:508# SAME-ADDR-GNU-NEXT:  Global entries:509# SAME-ADDR-GNU-NEXT:            Address     Access          Initial         Sym.Val. Type    Ndx Name510# SAME-ADDR-GNU-NEXT:   000000000000112a -32744(gp) 0000000000000000 0000000000000000 NOTYPE  UND foo511 512--- !ELF513FileHeader:514  Class:   ELFCLASS64515  Data:    ELFDATA2LSB516  Type:    ET_REL517  Machine: EM_MIPS518Sections:519  - Name:    .data520    Type:    SHT_PROGBITS521    Address: 0x1122522    Size:    0523  - Name:    .got524    Type:    SHT_PROGBITS525    Address: 0x1122526    Size:    16527  - Name: .dynamic528    Type: SHT_DYNAMIC529    Entries:530      - Tag:   DT_MIPS_LOCAL_GOTNO531        Value: 1532      - Tag:   DT_MIPS_GOTSYM533        Value: 1534      - Tag:   DT_PLTGOT535        Value: 0x1122536DynamicSymbols:537  - Name: foo538 539## Check how we print global GOT entries when they are unnamed section symbols.540# RUN: yaml2obj --docnum=8 %s -o %t.err8.o541# RUN: llvm-readobj -A %t.err8.o 2>&1 | FileCheck %s -DFILE=%t.err8.o --check-prefix=SEC-SYMS-LLVM542# RUN: llvm-readelf -A %t.err8.o 2>&1 | FileCheck %s -DFILE=%t.err8.o --check-prefix=SEC-SYMS-GNU543 544# SEC-SYMS-LLVM:      Global entries [545# SEC-SYMS-LLVM-NEXT:   Entry {546# SEC-SYMS-LLVM:          Section: Absolute (0xFFF1)547# SEC-SYMS-LLVM-NEXT: warning: '[[FILE]]': unable to get section index for symbol with st_shndx = 0xfff1 (SHN_ABS)548# SEC-SYMS-LLVM-NEXT:     Name: <?> (0)549# SEC-SYMS-LLVM-NEXT:   }550# SEC-SYMS-LLVM-NEXT:   Entry {551# SEC-SYMS-LLVM:          Section: .got (0x1)552# SEC-SYMS-LLVM-NEXT:     Name: .got (0)553# SEC-SYMS-LLVM-NEXT:   }554# SEC-SYMS-LLVM-NEXT:   Entry {555# SEC-SYMS-LLVM:          Section: Common (0xFFF2)556# SEC-SYMS-LLVM-NEXT: warning: '[[FILE]]': unable to get section index for symbol with st_shndx = 0xfff2 (SHN_COMMON)557# SEC-SYMS-LLVM-NEXT:     Name: <?> (0)558# SEC-SYMS-LLVM-NEXT:   }559# SEC-SYMS-LLVM-NEXT: Entry {560# SEC-SYMS-LLVM:          Type: Section (0x3)561# SEC-SYMS-LLVM-NEXT: warning: '[[FILE]]': found an extended symbol index (4), but unable to locate the extended symbol index table562# SEC-SYMS-LLVM-NEXT:     Section: Reserved (0xFFFF)563# SEC-SYMS-LLVM-NEXT:     Name: <?> (0)564# SEC-SYMS-LLVM-NEXT:   }565# SEC-SYMS-LLVM-NEXT: ]566 567# SEC-SYMS-GNU:      Global entries:568# SEC-SYMS-GNU-NEXT:  {{.*}} Ndx Name569# SEC-SYMS-GNU-NEXT: warning: '[[FILE]]': unable to get section index for symbol with st_shndx = 0xfff1 (SHN_ABS)570# SEC-SYMS-GNU-NEXT:  {{.*}} ABS <?>571# SEC-SYMS-GNU-NEXT:  {{.*}}   1 .got572# SEC-SYMS-GNU-NEXT: warning: '[[FILE]]': unable to get section index for symbol with st_shndx = 0xfff2 (SHN_COMMON)573# SEC-SYMS-GNU-NEXT:  {{.*}} COM <?>574# SEC-SYMS-GNU-NEXT: warning: '[[FILE]]': found an extended symbol index (4), but unable to locate the extended symbol index table575# SEC-SYMS-GNU-NEXT:  {{.*}} RSV[0xffff] <?>576 577--- !ELF578FileHeader:579  Class:   ELFCLASS64580  Data:    ELFDATA2LSB581  Type:    ET_REL582  Machine: EM_MIPS583Sections:584  - Name:    .got585    Type:    SHT_PROGBITS586    Address: 0x1122587    Size:    48588  - Name: .dynamic589    Type: SHT_DYNAMIC590    Entries:591      - Tag:   DT_MIPS_LOCAL_GOTNO592        Value: 1593      - Tag:   DT_MIPS_GOTSYM594        Value: 1595      - Tag:   DT_PLTGOT596        Value: 0x1122597DynamicSymbols:598  - Type:    STT_SECTION599    Index:   SHN_ABS600  - Type:    STT_SECTION601    Section: .got602  - Type:    STT_SECTION603    Index:   SHN_COMMON604  - Type:    STT_SECTION605    Index:   SHN_XINDEX606