blob: 9677f9f67ce10c5c16aaa909e92d663e9a30a6cc [file] [log] [blame]
## This test checks how we handle the --func-map option.
## Check 64-bit:
# RUN: yaml2obj --docnum=1 %s -DBITS=64 -DADDR=0x999999999 -o %t1.x64.o
# RUN: llvm-readobj %t1.x64.o --func-map 2>&1 | FileCheck %s -DADDR=0x999999999 -DFILE=%t1.x64.o --check-prefix=CHECK
# RUN: llvm-readelf %t1.x64.o --func-map | FileCheck %s --check-prefix=GNU
## Check 32-bit:
# RUN: yaml2obj --docnum=1 %s -DBITS=32 -o %t1.x32.o
# RUN: llvm-readobj %t1.x32.o --func-map 2>&1 | FileCheck -DADDR=0x11111 %s -DFILE=%t1.x32.o --check-prefix=CHECK
# RUN: llvm-readelf %t1.x32.o --func-map | FileCheck %s --check-prefix=GNU
## Check that a malformed section can be handled.
# RUN: yaml2obj --docnum=1 %s -DBITS=32 -DSIZE=3 -o %t2.o
# RUN: llvm-readobj %t2.o --func-map 2>&1 | FileCheck %s -DOFFSET=0x3 -DFILE=%t2.o --check-prefix=TRUNCATED
# CHECK: FuncMap [
# CHECK-NEXT: Function {
# CHECK-NEXT: At: [[ADDR]]
# CHECK-NEXT: warning: '[[FILE]]': could not identify function symbol for address ([[ADDR]]) in SHT_LLVM_FUNC_MAP section with index 3
# CHECK-NEXT: Name: <?>
# CHECK-NEXT: DynamicInstCount: 100
# CHECK-NEXT: }
# CHECK-NEXT: Function {
# CHECK-NEXT: At: 0x22222
# CHECK-NEXT: Name: foo
# CHECK-NEXT: DynamicInstCount: 200
# CHECK-NEXT: }
# CHECK-NEXT: ]
# CHECK-NEXT: FuncMap [
# CHECK-NEXT: Function {
# CHECK-NEXT: At: 0x33333
# CHECK-NEXT: Name: bar
# CHECK-NEXT: DynamicInstCount: 300
# CHECK-NEXT: }
# CHECK-NEXT: ]
# GNU: GNUStyle::printFuncMaps not implemented
# TRUNCATED: FuncMap [
# TRUNCATED-NEXT: warning: '[[FILE]]': unable to dump SHT_LLVM_FUNC_MAP section with index 3: unexpected end of data at offset [[OFFSET]]
# TRUNCATED-NEXT: ]
## Check that the other valid section is properly dumped.
# TRUNCATED-NEXT: FuncMap [
# TRUNCATED-NEXT: Function {
# TRUNCATED-NEXT: At: 0x33333
# TRUNCATED-NEXT: Name: bar
# TRUNCATED-NEXT: DynamicInstCount: 300
# TRUNCATED-NEXT: }
# TRUNCATED-NEXT: ]
--- !ELF
FileHeader:
Class: ELFCLASS[[BITS]]
Data: ELFDATA2LSB
Type: ET_EXEC
Sections:
- Name: .text
Type: SHT_PROGBITS
Flags: [SHF_ALLOC]
- Name: .text.bar
Type: SHT_PROGBITS
Flags: [SHF_ALLOC]
- Name: .llvm_func_map
Type: SHT_LLVM_FUNC_MAP
ShSize: [[SIZE=<none>]]
Link: .text
Entries:
- Version: 1
Address: [[ADDR=0x11111]]
DynInstCnt: 100
- Version: 1
Address: 0x22222
DynInstCnt: 200
- Name: dummy_section
Type: SHT_PROGBITS
Size: 16
- Name: '.llvm_func_map_2'
Type: SHT_LLVM_FUNC_MAP
Link: .text.bar
Entries:
- Version: 1
Address: 0x33333
DynInstCnt: 300
Symbols:
- Name: foo
Section: .text
Type: STT_FUNC
Value: 0x22222
- Name: bar
Section: .text.bar
Type: STT_FUNC
Value: 0x33333