llvm-for-llvmta/test/tools/obj2yaml/ELF/llvm-addrsig-section.yaml

78 lines
2.1 KiB
YAML
Raw Normal View History

2022-04-25 10:02:23 +02:00
## Check how obj2yaml dumps the SHT_LLVM_ADDRSIG section.
## Check that when possible obj2yaml tries to produce the "Name" tag when
## dumping entries of the SHT_LLVM_ADDRSIG section. It falls back to producing
## the "Index" tag when it can't match a symbol index with a symbol table entry.
# RUN: yaml2obj --docnum=1 %s -o %t1
# RUN: obj2yaml %t1 | FileCheck %s --check-prefix=NAME
# NAME: - Name: .llvm_addrsig
# NAME-NEXT: Type: SHT_LLVM_ADDRSIG
# NAME-NEXT: Link: .symtab
# NAME-NEXT: Symbols: [ foo, bar, '3', '4294967295' ]
# NAME: - Name: .llvm_addrsig_unlinked
# NAME-NEXT: Type: SHT_LLVM_ADDRSIG
# NAME-NEXT: Symbols: [ '1', '2', '3', '4294967295' ]
--- !ELF
FileHeader:
Class: ELFCLASS64
Data: ELFDATA2LSB
Type: ET_DYN
Sections:
- Name: .llvm_addrsig
Type: SHT_LLVM_ADDRSIG
Symbols: [ 1, 2, 3, 0xFFFFFFFF ]
- Name: .llvm_addrsig_unlinked
Type: SHT_LLVM_ADDRSIG
Link: 0
Symbols: [ 1, 2, 3, 0xFFFFFFFF ]
Symbols:
- Name: foo
Type: STT_FUNC
Binding: STB_GLOBAL
- Name: bar
Type: STT_FUNC
Binding: STB_GLOBAL
## Check that obj2yaml dumps the SHT_LLVM_ADDRSIG section
## data using the "Content" tag when at least one of the entries is broken,
## e.g. because the entry contains a malformed uleb128 value.
# RUN: yaml2obj --docnum=2 %s -o %t2
# RUN: obj2yaml %t2 | FileCheck %s --check-prefix=INVALID-ENTRY
# INVALID-ENTRY: - Name: .llvm_addrsig
# INVALID-ENTRY-NEXT: Type: SHT_LLVM_ADDRSIG
# INVALID-ENTRY-NEXT: Content: FFFFFFFFFF
--- !ELF
FileHeader:
Class: ELFCLASS64
Data: ELFDATA2LSB
Type: ET_DYN
Sections:
- Name: .llvm_addrsig
Type: SHT_LLVM_ADDRSIG
Content: "FFFFFFFFFF"
## obj2yaml produces a "Symbols" tag when describing an empty SHT_LLVM_ADDRSIG section.
# RUN: yaml2obj --docnum=3 %s -o %t3
# RUN: obj2yaml %t3 | FileCheck %s --check-prefix=EMPTY
# EMPTY: - Name: .llvm_addrsig
# EMPTY-NEXT: Type: SHT_LLVM_ADDRSIG
# EMPTY-NEXT: Symbols: [ ]
--- !ELF
FileHeader:
Class: ELFCLASS64
Data: ELFDATA2LSB
Type: ET_DYN
Sections:
- Name: .llvm_addrsig
Type: SHT_LLVM_ADDRSIG
Content: ""