60 lines · yaml
1## Checks that the tool is able to read section groups from ELF.2 3## Check how groups sections are dumped.4## Check we don't dump the "EntSize" key when sh_entsize == 4.5 6# RUN: yaml2obj %s -o %t1.o7# RUN: obj2yaml %t1.o | FileCheck %s -DSEC=.rodata8 9# CHECK: - Name: .group10# CHECK-NEXT: Type: SHT_GROUP11# CHECK-NEXT: Link: .symtab12# CHECK-NEXT: Info: signature13# CHECK-NEXT: Members:14# CHECK-NEXT: - SectionOrType: GRP_COMDAT15# CHECK-NEXT: - SectionOrType: [[SEC]]16# CHECK-NEXT: - Name:17 18--- !ELF19FileHeader:20 Class: ELFCLASS6421 Data: ELFDATA2LSB22 Type: ET_REL23Sections:24 - Name: .group25 Type: SHT_GROUP26 Link: .symtab27 Info: [[INFO=signature]]28 EntSize: [[ENTSIZE=<none>]]29 Members:30 - SectionOrType: GRP_COMDAT31 - SectionOrType: [[SEC=.rodata]]32 - Name: .rodata33 Type: SHT_PROGBITS34Symbols:35 - Name: signature36 Type: STT_OBJECT37 Section: .rodata38 39## Document that yaml2obj can't dump the SHT_GROUP section when its sh_entsize != 4.40 41# RUN: yaml2obj %s -DENTSIZE=0xfe -o %t1.entsize.o42# RUN: not obj2yaml %t1.entsize.o 2>&1 | \43# RUN: FileCheck %s -DFILE=%t1.entsize.o --check-prefix=ENTSIZE44 45# ENTSIZE: Error reading file: [[FILE]]: section [index 1] has invalid sh_entsize: expected 4, but got 25446 47## Check we are able to dump members of the SHT_GROUP section even when48## one of them has section index 0.49 50# RUN: yaml2obj -DSEC=0 %s -o %tnull.o51# RUN: obj2yaml %tnull.o | FileCheck %s -DSEC="''"52 53## Check obj2yaml report an error when sh_info field of54## group section contains invalid (too large) signature symbol index.55 56# RUN: yaml2obj -DINFO=0xFF %s -o %t2.o57# RUN: not obj2yaml %t2.o 2>&1 | FileCheck %s -DFILE=%t2.o --check-prefix=ERR58 59# ERR: Error reading file: [[FILE]]: unable to get symbol from section [index 3]: invalid symbol index (255)60