49 lines · yaml
1## This is a generic test for SHT_REL/SHT_RELA sections.2 3## Check that we do not print excessive default4## fields for SHT_REL[A] sections.5# RUN: yaml2obj %s -o %t16# RUN: obj2yaml %t1 | FileCheck %s --check-prefix=YAML7 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.dyn11# YAML-NEXT: Type: SHT_RELA12# YAML-NEXT: - Name: .rel.dyn13# YAML-NEXT: Type: SHT_REL14# YAML-NEXT: - Name15 16--- !ELF17FileHeader:18 Class: ELFCLASS6419 Data: ELFDATA2LSB20 Type: ET_DYN21Sections:22 - Name: .rela.dyn23 Type: SHT_RELA24 - Name: .rel.dyn25 Type: SHT_REL26## 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.rela33# RUN: not obj2yaml %t2.rela 2>&1 | FileCheck %s --check-prefix=ERR134# RUN: yaml2obj -DTYPE=SHT_REL --docnum=2 %s -o %t2.rel35# RUN: not obj2yaml %t2.rel 2>&1 | FileCheck %s --check-prefix=ERR236 37# ERR1: section [index 1] has invalid sh_entsize: expected 24, but got 25438# ERR2: section [index 1] has invalid sh_entsize: expected 16, but got 25439 40--- !ELF41FileHeader:42 Class: ELFCLASS6443 Data: ELFDATA2LSB44 Type: ET_DYN45Sections:46 - Name: .foo47 Type: [[TYPE]]48 EntSize: 0xFE49