brintos

brintos / llvm-project-archived public Read only

0
0
Text · 5.8 KiB · 121b1e9 Raw
168 lines · yaml
1## Test how we create SHT_LLVM_CALL_GRAPH_PROFILE sections.2 3## Test that the content of SHT_LLVM_CALL_GRAPH_PROFILE sections4## for 32/64-bit little/big endian targets is correct.5# RUN: yaml2obj --docnum=1 -D BITS=64 -D ENCODE=LSB %s -o %t.le646# RUN: llvm-readobj --cg-profile --sections --section-data %t.le64 | FileCheck %s --check-prefixes=BASIC,BASIC-LE7# RUN: yaml2obj --docnum=1 -D BITS=64 -D ENCODE=MSB %s -o %t.be648# RUN: llvm-readobj --cg-profile --sections --section-data %t.be64 | FileCheck %s --check-prefixes=BASIC,BASIC-BE9# RUN: yaml2obj --docnum=1 -D BITS=32 -D ENCODE=LSB %s -o %t.le3210# RUN: llvm-readobj --cg-profile --sections --section-data %t.le32 | FileCheck %s --check-prefixes=BASIC,BASIC-LE11# RUN: yaml2obj --docnum=1 -D BITS=32 -D ENCODE=MSB %s -o %t.be3212# RUN: llvm-readobj --cg-profile --sections --section-data %t.be32 | FileCheck %s --check-prefixes=BASIC,BASIC-BE13 14# BASIC:        Name: .llvm.call-graph-profile15# BASIC-NEXT:   Type: SHT_LLVM_CALL_GRAPH_PROFILE16# BASIC-NEXT:   Flags [17# BASIC-NEXT:   ]18# BASIC-NEXT:   Address: 0x019# BASIC-NEXT:   Offset:20# BASIC-NEXT:   Size: 1621## Check that we link SHT_LLVM_CALL_GRAPH_PROFILE section with .symtab by default.22# BASIC-NEXT:   Link: [[SYMTABNDX:.*]]23# BASIC-NEXT:   Info: 024# BASIC-NEXT:   AddressAlignment: 025## Check that the entry size is set to 16 by default.26# BASIC-NEXT:   EntrySize: 827# BASIC-NEXT:   SectionData (28# BASIC-LE-NEXT:  0000: 59000000 00000000 62000000 0000000029# BASIC-BE-NEXT:  0000: 00000000 00000059 00000000 0000006230# BASIC-NEXT:   )31# BASIC-NEXT: }32# BASIC-NEXT: Section {33# BASIC-NEXT:  Index: [[SYMTABNDX]]34# BASIC-NEXT:  Name: .symtab35 36# BASIC:      CGProfile [37# BASIC-NEXT:   CGProfileEntry {38# BASIC-NEXT:     Weight: 8939# BASIC-NEXT:   }40# BASIC-NEXT:   CGProfileEntry {41# BASIC-NEXT:     Weight: 9842# BASIC-NEXT:   }43# BASIC-NEXT: ]44 45--- !ELF46FileHeader:47  Class: ELFCLASS[[BITS]]48  Data:  ELFDATA2[[ENCODE]]49  Type:  ET_DYN50Sections:51  - Name: .llvm.call-graph-profile52    Type: SHT_LLVM_CALL_GRAPH_PROFILE53    Entries:54      - Weight: 8955      - Weight: 9856Symbols:57  - Name: foo58  - Name: bar59 60## Check we can set arbitrary sh_link and sh_entsize values.61## Check we can specify none of "Content", "Entries", and "Size" tags.62# RUN: yaml2obj --docnum=2 %s -o %t.link63# RUN: llvm-readelf --sections %t.link | FileCheck %s --check-prefix=LINK64 65# LINK: [Nr] Name      Type                    Address          Off    Size   ES Flg Lk66# LINK: [ 1] .llvm.foo LLVM_CALL_GRAPH_PROFILE 0000000000000000 000040 000000 00     067# LINK: [ 2] .llvm.bar LLVM_CALL_GRAPH_PROFILE 0000000000000000 000040 000000 ff     25568 69--- !ELF70FileHeader:71  Class: ELFCLASS6472  Data:  ELFDATA2LSB73  Type:  ET_DYN74Sections:75  - Name:    .llvm.foo76    Type:    SHT_LLVM_CALL_GRAPH_PROFILE77    Link:    0x078    EntSize: 079  - Name:    .llvm.bar80    Type:    SHT_LLVM_CALL_GRAPH_PROFILE81    Link:    0xFF82    EntSize: 0xFF83 84## Check we can describe SHT_LLVM_CALL_GRAPH_PROFILE sections using the "Content" tag.85# RUN: yaml2obj --docnum=3 %s -o %t.content86# RUN: llvm-readobj --sections --section-data %t.content | FileCheck %s --check-prefix=CONTENT87 88# CONTENT:      Name: .llvm.call-graph-profile89# CONTENT:      SectionData (90# CONTENT-NEXT:   0000: 11223344 |91# CONTENT-NEXT: )92 93--- !ELF94FileHeader:95  Class: ELFCLASS6496  Data:  ELFDATA2LSB97  Type:  ET_DYN98Sections:99  - Name:    .llvm.call-graph-profile100    Type:    SHT_LLVM_CALL_GRAPH_PROFILE101    Content: "11223344"102 103## Check we can use the "Content" key with the "Size" key when the size is greater104## than or equal to the content size.105 106# RUN: not yaml2obj --docnum=4 -DSIZE=1 -DCONTENT="'0011'" %s 2>&1 | \107# RUN:   FileCheck %s --check-prefix=CONTENT-SIZE-ERR108 109# CONTENT-SIZE-ERR: error: Section size must be greater than or equal to the content size110 111--- !ELF112FileHeader:113  Class: ELFCLASS64114  Data:  ELFDATA2LSB115  Type:  ET_DYN116Sections:117  - Name:    .llvm.foo118    Type:    SHT_LLVM_CALL_GRAPH_PROFILE119    Link:    0x1120    EntSize: 0x2121    Size:    [[SIZE=<none>]]122    Content: [[CONTENT=<none>]]123    Entries: [[ENTRIES=<none>]]124 125# RUN: yaml2obj --docnum=4 -DSIZE=2 -DCONTENT="'0011'" %s -o %t.cont.size.eq.o126# RUN: llvm-readobj --sections --section-data %t.cont.size.eq.o | \127# RUN:   FileCheck %s --check-prefix=CHECK-CONTENT -DDATA="0011"128 129# RUN: yaml2obj --docnum=4 -DSIZE=3 -DCONTENT="'0011'" %s -o %t.cont.size.gr.o130# RUN: llvm-readobj --sections --section-data %t.cont.size.gr.o | \131# RUN:   FileCheck %s --check-prefix=CHECK-CONTENT -DDATA="001100"132 133# CHECK-CONTENT:      Name: .llvm.foo134# CHECK-CONTENT-NEXT: Type: SHT_LLVM_CALL_GRAPH_PROFILE135# CHECK-CONTENT-NEXT: Flags [136# CHECK-CONTENT-NEXT: ]137# CHECK-CONTENT-NEXT: Address:138# CHECK-CONTENT-NEXT: Offset:139# CHECK-CONTENT-NEXT: Size:140# CHECK-CONTENT-NEXT: Link: 1141# CHECK-CONTENT-NEXT: Info:142# CHECK-CONTENT-NEXT: AddressAlignment:143# CHECK-CONTENT-NEXT: EntrySize: 2144# CHECK-CONTENT-NEXT: SectionData (145# CHECK-CONTENT-NEXT:   0000: [[DATA]] |146# CHECK-CONTENT-NEXT: )147 148## Check we can use the "Size" key alone to create the section.149 150# RUN: yaml2obj --docnum=4 -DSIZE=3 %s -o %t.size.o151# RUN: llvm-readobj --sections --section-data %t.size.o | \152# RUN:   FileCheck %s --check-prefix=CHECK-CONTENT -DDATA="000000"153 154## Check we can use the "Content" key alone to create the section.155 156# RUN: yaml2obj --docnum=4 -DCONTENT="'112233'" %s -o %t.content.o157# RUN: llvm-readobj --sections --section-data %t.content.o | \158# RUN:   FileCheck %s --check-prefix=CHECK-CONTENT -DDATA="112233"159 160## Check we can't use the "Entries" key together with the "Content" or "Size" keys.161 162# RUN: not yaml2obj --docnum=4 -DSIZE=0 -DENTRIES="[]" %s 2>&1 | \163# RUN:   FileCheck %s --check-prefix=ENTRIES-ERR164# RUN: not yaml2obj --docnum=4 -DCONTENT="'00'" -DENTRIES="[]" %s 2>&1 | \165# RUN:   FileCheck %s --check-prefix=ENTRIES-ERR166 167# ENTRIES-ERR: error: "Entries" cannot be used with "Content" or "Size"168