• Home
  • History
  • Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1## Checks that the tool is able to read section groups from ELF.
2
3# RUN: yaml2obj --docnum=1 %s -o %t1.o
4# RUN: llvm-readobj --elf-section-groups %t1.o | FileCheck %s -check-prefix=OBJ
5# RUN: obj2yaml %t1.o | FileCheck %s --check-prefix YAML
6
7# OBJ:      Groups {
8# OBJ-NEXT:   Group {
9# OBJ-NEXT:     Name: .group
10# OBJ-NEXT:     Index: 1
11# OBJ-NEXT:     Link: 3
12# OBJ-NEXT:     Info: 1
13# OBJ-NEXT:     Type: COMDAT (0x1)
14# OBJ-NEXT:     Signature: signature
15# OBJ-NEXT:     Section(s) in group [
16# OBJ-NEXT:       .rodata (2)
17# OBJ-NEXT:     ]
18# OBJ-NEXT:   }
19# OBJ-NEXT: }
20
21# YAML: - Name: .group
22# YAML:   Type: SHT_GROUP
23# YAML:   Link: .symtab
24# YAML:   Info: signature
25# YAML:   Members:
26# YAML:     - SectionOrType: GRP_COMDAT
27# YAML:     - SectionOrType: .rodata
28
29--- !ELF
30FileHeader:
31  Class: ELFCLASS64
32  Data:  ELFDATA2LSB
33  Type:  ET_REL
34Sections:
35  - Name: .group
36    Type: SHT_GROUP
37    Link: .symtab
38    Info: signature
39    Members:
40      - SectionOrType: GRP_COMDAT
41      - SectionOrType: .rodata
42  - Name: .rodata
43    Type: SHT_PROGBITS
44Symbols:
45  - Name:    signature
46    Type:    STT_OBJECT
47    Section: .rodata
48
49## Check obj2yaml report an error when sh_info field of
50## group section contains invalid (too large) signature symbol index.
51
52# RUN: yaml2obj --docnum=2 %s -o %t2.o
53# RUN: not obj2yaml %t2.o 2>&1 | FileCheck %s --check-prefix ERR
54
55--- !ELF
56FileHeader:
57  Class: ELFCLASS64
58  Data:  ELFDATA2LSB
59  Type:  ET_REL
60Sections:
61  - Name: .group
62    Type: SHT_GROUP
63    Link: .symtab
64    Info: 0xFF
65    Members:
66      - SectionOrType: GRP_COMDAT
67Symbols: []
68
69# ERR: Error reading file: {{.*}}2.o: unable to get symbol from section [index 2]: invalid symbol index (255)
70