1## For implicit symbol table sections, `Link` field can also 2## be specified in YAML. Here we test the behavior in different cases. 3 4## Check we are able to set Link = 0 for .symtab explicitly. 5 6# RUN: yaml2obj --docnum=1 %s -o %t1 7# RUN: llvm-readobj %t1 -S | FileCheck %s --check-prefix=CASE1 8 9# CASE1: Name: .symtab 10# CASE1: Link: 11# CASE1-SAME: 0 12 13--- !ELF 14FileHeader: 15 Class: ELFCLASS64 16 Data: ELFDATA2LSB 17 Type: ET_DYN 18Sections: 19 - Name: .symtab 20 Type: SHT_SYMTAB 21 Link: 0 22 23## Check that by default .symtab will be linked with .strtab. 24 25# RUN: yaml2obj --docnum=2 %s -o %t2 26# RUN: llvm-readobj %t2 -S | FileCheck %s --check-prefix=CASE2 27 28# CASE2: .symtab 29# CASE2: Link: 30# CASE2-SAME: 2 31# CASE2: Index: 2 32# CASE2-NEXT: Name: .strtab 33 34--- !ELF 35FileHeader: 36 Class: ELFCLASS64 37 Data: ELFDATA2LSB 38 Type: ET_DYN 39Sections: 40 - Name: .symtab 41 Type: SHT_SYMTAB 42 43## Even if .strtab is defined in YAML, we can explicitly link .symtab 44## to another section. 45 46# RUN: yaml2obj --docnum=3 %s -o %t3 47# RUN: llvm-readobj %t3 -S | FileCheck %s --check-prefix=CASE3 48 49# CASE3: .symtab 50# CASE3: Link: 51# CASE3-SAME: 3 52# CASE3: Index: 3 53# CASE3-NEXT: Name: .foo 54 55--- !ELF 56FileHeader: 57 Class: ELFCLASS64 58 Data: ELFDATA2LSB 59 Type: ET_DYN 60Sections: 61 - Name: .symtab 62 Type: SHT_SYMTAB 63 Link: 3 64 - Name: .strtab 65 Type: SHT_STRTAB 66 - Name: .foo 67 Type: SHT_PROGBITS 68 69## Check we can use a section name as a Link value for .symtab. 70 71# RUN: yaml2obj --docnum=4 %s -o %t4 72# RUN: llvm-readobj %t4 -S | FileCheck %s --check-prefix=CASE4 73 74# CASE4: .symtab 75# CASE4: Link: 76# CASE4-SAME: 2 77# CASE4: Index: 2 78# CASE4-NEXT: Name: .foo 79 80--- !ELF 81FileHeader: 82 Class: ELFCLASS64 83 Data: ELFDATA2LSB 84 Type: ET_DYN 85Sections: 86 - Name: .symtab 87 Type: SHT_SYMTAB 88 Link: .foo 89 - Name: .foo 90 Type: SHT_PROGBITS 91