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
|
## Test how we dump SHT_LLVM_CALL_GRAPH_PROFILE sections for 32 and 64-bit targets.
## Test we use the "Entries" property when it is possible to dump values correctly.
# RUN: yaml2obj -D BITS=64 -D ENCODE=LSB %s -o %t.le64
# RUN: obj2yaml %t.le64 | FileCheck %s --check-prefix=BASIC
# RUN: yaml2obj -D BITS=64 -D ENCODE=MSB %s -o %t.be64
# RUN: obj2yaml %t.be64 | FileCheck %s --check-prefix=BASIC
# RUN: yaml2obj -D BITS=32 -D ENCODE=LSB %s -o %t.le32
# RUN: obj2yaml %t.le32 | FileCheck %s --check-prefix=BASIC
# RUN: yaml2obj -D BITS=32 -D ENCODE=MSB %s -o %t.be32
# RUN: obj2yaml %t.be32 | FileCheck %s --check-prefix=BASIC
# BASIC: Sections:
# BASIC-NEXT: - Name: .llvm.call-graph-profile
# BASIC-NEXT: Type: SHT_LLVM_CALL_GRAPH_PROFILE
# BASIC-NEXT: Link: .symtab
# BASIC-NEXT: Entries:
# BASIC-NEXT: - Weight: 89
# BASIC-NEXT: - Weight: 98
# BASIC-NEXT: Symbols:
--- !ELF
FileHeader:
Class: ELFCLASS[[BITS]]
Data: ELFDATA2[[ENCODE]]
Type: ET_DYN
Sections:
- Name: .llvm.call-graph-profile
Type: SHT_LLVM_CALL_GRAPH_PROFILE
Entries:
- Weight: 89
- Weight: 98
Symbols:
- Name: foo
- Name: bar
## Check how we handle broken cases.
# RUN: yaml2obj --docnum=2 %s -o %t.invalid
# RUN: obj2yaml %t.invalid | FileCheck %s --check-prefix=INVALID
# INVALID: --- !ELF
# INVALID-NEXT: FileHeader:
# INVALID-NEXT: Class: ELFCLASS32
# INVALID-NEXT: Data: ELFDATA2MSB
# INVALID-NEXT: Type: ET_DYN
# INVALID-NEXT: Sections:
# INVALID-NEXT: - Name: .empty
# INVALID-NEXT: Type: SHT_LLVM_CALL_GRAPH_PROFILE
# INVALID-NEXT: Link: .symtab
# INVALID-NEXT: - Name: .multiple.8.valid
# INVALID-NEXT: Type: SHT_LLVM_CALL_GRAPH_PROFILE
# INVALID-NEXT: Link: .symtab
# INVALID-NEXT: Entries:
# INVALID-NEXT: Weight: 3
# INVALID-NEXT: - Name: .non.multiple.8
# INVALID-NEXT: Type: SHT_LLVM_CALL_GRAPH_PROFILE
# INVALID-NEXT: Link: .symtab
# INVALID-NEXT: Content: '000000000000000300'
# INVALID-NEXT: - Name: .multiple.8.invalid
# INVALID-NEXT: Type: SHT_LLVM_CALL_GRAPH_PROFILE
# INVALID-NEXT: Link: .symtab
# INVALID-NEXT: Content: 008899AABBCCDDEEFF
# INVALID-NEXT: - Name: .link.to.symtable
# INVALID-NEXT: Type: SHT_LLVM_CALL_GRAPH_PROFILE
# INVALID-NEXT: Link: .symtab
# INVALID-NEXT: Entries:
# INVALID-NEXT: - Weight: 0
# INVALID-NEXT: - Name: .link.to.non.symtable.1
# INVALID-NEXT: Type: SHT_LLVM_CALL_GRAPH_PROFILE
# INVALID-NEXT: Entries:
# INVALID-NEXT: - Weight: 0
# INVALID-NEXT: - Name: .link.to.non.symtable.2
# INVALID-NEXT: Type: SHT_LLVM_CALL_GRAPH_PROFILE
# INVALID-NEXT: Link: .empty
# INVALID-NEXT: Entries:
# INVALID-NEXT: - Weight: 0
# INVALID-NEXT: - Name: .zero.entry.size
# INVALID-NEXT: Type: SHT_LLVM_CALL_GRAPH_PROFILE
# INVALID-NEXT: Link: .symtab
# INVALID-NEXT: EntSize: 0x0
# INVALID-NEXT: Entries:
# INVALID-NEXT: - Weight: 0
# INVALID-NEXT: - Name: .invalid.entry.size
# INVALID-NEXT: Type: SHT_LLVM_CALL_GRAPH_PROFILE
# INVALID-NEXT: Link: .symtab
# INVALID-NEXT: EntSize: 0x1
# INVALID-NEXT: Entries:
# INVALID-NEXT: - Weight: 0
# INVALID-NEXT: Symbols:
# INVALID-NEXT: - Name: foo
# INVALID-NEXT: - Name: bar
--- !ELF
FileHeader:
Class: ELFCLASS32
Data: ELFDATA2MSB
Type: ET_DYN
Sections:
## Case 1: Content is empty.
- Name: .empty
Type: SHT_LLVM_CALL_GRAPH_PROFILE
## Case 2: Check that we use the "Entries" property to dump the data when it
## has a size that is a multiple of 16 and is valid (it is possible to match
## symbol indexes to symbols), but fallback to dumping the whole section
## using the "Content" property otherwise.
## TODO: Teach yaml2obj to accept 'Size' key for SHT_LLVM_CALL_GRAPH_PROFILE
## sections and use Entries for cases below.
- Name: .multiple.8.valid
Type: SHT_LLVM_CALL_GRAPH_PROFILE
Content: "0000000000000003"
- Name: .non.multiple.8
Type: SHT_LLVM_CALL_GRAPH_PROFILE
Content: "000000000000000300"
- Name: .multiple.8.invalid
Type: SHT_LLVM_CALL_GRAPH_PROFILE
Content: "008899AABBCCDDEEFF"
## Case 4: Check we use the "Content" property when a linked section
## is not a symbol table.
- Name: .link.to.symtable
Type: SHT_LLVM_CALL_GRAPH_PROFILE
Entries:
- Weight: 0
- Name: .link.to.non.symtable.1
Type: SHT_LLVM_CALL_GRAPH_PROFILE
Link: 0
Entries:
- Weight: 0
- Name: .link.to.non.symtable.2
Type: SHT_LLVM_CALL_GRAPH_PROFILE
Link: 1
Entries:
- Weight: 0
## Case 5: Check we can dump a section that has a sh_entsize that is not a multiple of 16.
## Check that in these cases we print the "EntSize" key.
- Name: .zero.entry.size
Type: SHT_LLVM_CALL_GRAPH_PROFILE
EntSize: 0
Entries:
- Weight: 0
- Name: .invalid.entry.size
Type: SHT_LLVM_CALL_GRAPH_PROFILE
EntSize: 1
Entries:
- Weight: 0
Symbols:
- Name: foo
- Name: bar
|