1# RUN: yaml2obj --docnum=1 %s -o %t1 2# RUN: llvm-readobj --sections %t1 | FileCheck %s 3 4# CHECK: Name: .text 5# CHECK-NEXT: Type: SHT_PROGBITS 6# CHECK-NEXT: Flags [ 7# CHECK-NEXT: SHF_ALLOC 8# CHECK-NEXT: SHF_EXECINSTR 9# CHECK-NEXT: ] 10# CHECK-NEXT: Address: 11# CHECK-NEXT: Offset: 12# CHECK-NEXT: Size: 13# CHECK-NEXT: Link: 12345 14 15--- !ELF 16FileHeader: 17 Class: ELFCLASS64 18 Data: ELFDATA2LSB 19 Type: ET_REL 20Sections: 21 - Name: .text 22 Type: SHT_PROGBITS 23 Flags: [ SHF_ALLOC, SHF_EXECINSTR ] 24 Link: 12345 25 26## Check we report an error when an unknown section is referenced via a Link field. 27 28# RUN: not yaml2obj --docnum=2 %s 2>&1 | FileCheck %s --check-prefix=ERR 29 30# ERR: error: unknown section referenced: '.unknown1' by YAML section '.foo' 31# ERR-NEXT: error: unknown section referenced: '.unknown2' by YAML section '(index 2)' 32# ERR-NEXT: error: unknown section referenced: '.unknown3' by YAML section '.bar' 33# ERR-NEXT: error: unknown section referenced: '.unknown4' by YAML section '(index 4)' 34 35--- !ELF 36FileHeader: 37 Class: ELFCLASS64 38 Data: ELFDATA2LSB 39 Type: ET_REL 40Sections: 41 - Name: .foo 42 Type: SHT_PROGBITS 43 Link: .unknown1 44 - Type: SHT_PROGBITS 45 Link: .unknown2 46 - Name: .bar 47 Type: SHT_PROGBITS 48 Link: .unknown3 49 - Type: SHT_PROGBITS 50 Link: .unknown4 51 52## Check we link SHT_GROUP to a symbol table by default if it exists. 53## Also, check we can set an arbitrary value for sh_link. 54 55# RUN: yaml2obj --docnum=3 %s -o %t3 56# RUN: llvm-readobj --sections %t3 | FileCheck %s --check-prefix=GROUP-LINK 57 58# GROUP-LINK: Name: .group1 59# GROUP-LINK: Link: 60# GROUP-LINK-SAME: 3 61 62# GROUP-LINK: Name: .group2 63# GROUP-LINK: Link: 64# GROUP-LINK-SAME: 255 65 66--- !ELF 67FileHeader: 68 Class: ELFCLASS64 69 Data: ELFDATA2LSB 70 Type: ET_REL 71Sections: 72 - Name: .group1 73 Type: SHT_GROUP 74 Members: 75 - Name: .group2 76 Type: SHT_GROUP 77 Link: 0xFF 78 Members: 79Symbols: [] 80 81## Check we set SHT_GROUP's link value to 0 when there is no symbol table. 82 83# RUN: yaml2obj --docnum=4 %s -o %t4 84# RUN: llvm-readobj --sections %t4 | FileCheck %s --check-prefix=GROUP-LINK-NOSYMTAB 85 86# GROUP-LINK-NOSYMTAB: Name: .group 87# GROUP-LINK-NOSYMTAB: Link: 88# GROUP-LINK-NOSYMTAB-SAME: 0 89 90--- !ELF 91FileHeader: 92 Class: ELFCLASS64 93 Data: ELFDATA2LSB 94 Type: ET_REL 95Sections: 96 - Name: .group 97 Type: SHT_GROUP 98 Members: 99