52 lines · yaml
1## Check how obj2yaml dumps the sh_entsize field.2 3## Check we don't dump the "EntSize" key for SHT_SYMTAB/SHT_DYNSYM sections4## when the value of sh_entsize is equal to sizeof(ELF_Sym) == 0x18.5 6# RUN: yaml2obj %s -o %t7# RUN: obj2yaml %t | FileCheck %s8 9# CHECK: - Name: .rodata.cst410# CHECK-NEXT: Type: SHT_PROGBITS11# CHECK-NEXT: EntSize: 0x412# CHECK-NEXT: - Name: .mysymtab13# CHECK-NEXT: Type: SHT_SYMTAB14# CHECK-NEXT: Link: .strtab15# CHECK-NEXT: Size: 0x016# CHECK-NEXT: - Name: .mydynsym17# CHECK-NEXT: Type: SHT_DYNSYM18# CHECK-NEXT: Size: 0x019# CHECK-NEXT: ...20 21--- !ELF22FileHeader:23 Class: ELFCLASS6424 Data: ELFDATA2LSB25 Type: ET_REL26Sections:27 - Name: .rodata.cst428 Type: SHT_PROGBITS29 EntSize: 0x430 - Name: .mysymtab31 Type: SHT_SYMTAB32 EntSize: [[SYMTABES=0x18]]33 - Name: .mydynsym34 Type: SHT_DYNSYM35 EntSize: [[DYNSYMES=0x18]]36 37## Document that we are unable to dump a SHT_SYMTAB section when its entry size38## is not equal to sizeof(ELF_Sym).39 40# RUN: yaml2obj %s -DSYMTABES=0x19 -o %t241# RUN: not obj2yaml %t2 2>&1 | FileCheck %s -DFILE=%t2 --check-prefix=ERR142 43# ERR1: Error reading file: [[FILE]]: section [index 2] has invalid sh_entsize: expected 24, but got 2544 45## Document that we are unable to dump a SHT_DYNSYM section when its entry size46## is not equal to sizeof(ELF_Sym).47 48# RUN: yaml2obj %s -DDYNSYMES=0x19 -o %t349# RUN: not obj2yaml %t3 2>&1 | FileCheck %s -DFILE=%t3 --check-prefix=ERR250 51# ERR2: Error reading file: [[FILE]]: section [index 3] has invalid sh_entsize: expected 24, but got 2552