llvm.org GIT mirror llvm / 3ea0447
[yaml2obj] - Teach tool to produce SHT_GROUP section with a custom type. Currently, it is possible to use yaml2obj for producing SHT_GROUP sections of type GRP_COMDAT. For LLD test case I need to produce an object with a broken (different from GRP_COMDAT) type. The patch teaches tool to do such things. Differential revision: https://reviews.llvm.org/D50761 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@339764 91177308-0d34-0410-b5e6-96231b3b80d8 George Rimar 1 year, 1 month ago
2 changed file(s) with 36 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
0 # RUN: yaml2obj %s -o %t
1 # RUN: llvm-readobj -sections -elf-section-groups %t | FileCheck %s
2
3 --- !ELF
4 FileHeader:
5 Class: ELFCLASS64
6 Data: ELFDATA2LSB
7 Type: ET_REL
8 Machine: EM_X86_64
9 Sections:
10 - Name: .group
11 Type: SHT_GROUP
12 Link: .symtab
13 Info: foo
14 Members:
15 - SectionOrType: 0xFF
16 - SectionOrType: 3
17 Symbols:
18 Global:
19 - Name: foo
20
21 ## Check we are able to produce SHT_GROUP section with a custom Type (0xFF).
22 # CHECK: Groups {
23 # CHECK-NEXT: Group {
24 # CHECK-NEXT: Name: .group
25 # CHECK-NEXT: Index: 1
26 # CHECK-NEXT: Link: 2
27 # CHECK-NEXT: Info: 1
28 # CHECK-NEXT: Type: COMDAT (0xFF)
29 # CHECK-NEXT: Signature: foo
30 # CHECK-NEXT: Section(s) in group [
31 # CHECK-NEXT: .strtab (3)
32 # CHECK-NEXT: ]
33 # CHECK-NEXT: }
536536 unsigned int sectionIndex = 0;
537537 if (member.sectionNameOrType == "GRP_COMDAT")
538538 sectionIndex = llvm::ELF::GRP_COMDAT;
539 else if (SN2I.lookup(member.sectionNameOrType, sectionIndex)) {
539 else if (SN2I.lookup(member.sectionNameOrType, sectionIndex) &&
540 !to_integer(member.sectionNameOrType, sectionIndex)) {
540541 WithColor::error() << "Unknown section referenced: '"
541542 << member.sectionNameOrType << "' at YAML section' "
542543 << Section.Name << "\n";