1## This is a generic test for SHT_REL/SHT_RELA sections. 2 3## Check that we do not print excessive default 4## fields for SHT_REL[A] sections. 5# RUN: yaml2obj %s -o %t1 6# RUN: obj2yaml %t1 | FileCheck %s --check-prefix=YAML 7 8## Note: it is important to have at least two sections with sh_info == 0. 9## Previously we printed a broken Info field in this case. 10# YAML: - Name: .rela.dyn 11# YAML-NEXT: Type: SHT_RELA 12# YAML-NEXT: - Name: .rel.dyn 13# YAML-NEXT: Type: SHT_REL 14# YAML-NEXT: - Name 15 16--- !ELF 17FileHeader: 18 Class: ELFCLASS64 19 Data: ELFDATA2LSB 20 Type: ET_DYN 21Sections: 22 - Name: .rela.dyn 23 Type: SHT_RELA 24 - Name: .rel.dyn 25 Type: SHT_REL 26## Trigger the .dynsym emission. 27DynamicSymbols: [] 28 29## Test the behavior when the sh_entsize field is broken. 30## Here we use the 0xFE value instead of expected 0x18/0x10. 31 32# RUN: yaml2obj -DTYPE=SHT_RELA --docnum=2 %s -o %t2.rela 33# RUN: not obj2yaml %t2.rela 2>&1 | FileCheck %s --check-prefix=ERR 34# RUN: yaml2obj -DTYPE=SHT_REL --docnum=2 %s -o %t2.rel 35# RUN: not obj2yaml %t2.rel 2>&1 | FileCheck %s --check-prefix=ERR 36 37# ERR: section [index 1] has an invalid sh_entsize: 254 38 39--- !ELF 40FileHeader: 41 Class: ELFCLASS64 42 Data: ELFDATA2LSB 43 Type: ET_DYN 44Sections: 45 - Name: .foo 46 Type: [[TYPE]] 47 EntSize: 0xFE 48