82 lines · yaml
1## Test the behavior of the symbol reference section.2 3## Case1: a symbol can reference a section by SectionName or SectionIndex.4# RUN: yaml2obj --docnum=1 %s -o %t15# RUN: llvm-readobj %t1 -s | FileCheck %s --check-prefix=CASE16 7# CASE1: Symbols [8# CASE1-NEXT: Symbol {9# CASE1-NEXT: Index: 010# CASE1-NEXT: Name: 11# CASE1-NEXT: Value: 0x012# CASE1-NEXT: Section: .text13# CASE1-NEXT: Type: 0x014# CASE1-NEXT: StorageClass: C_NULL (0x0)15# CASE1-NEXT: NumberOfAuxEntries: 016# CASE1-NEXT: }17# CASE1-NEXT: Symbol {18# CASE1-NEXT: Index: 119# CASE1-NEXT: Name: 20# CASE1-NEXT: Value: 0x021# CASE1-NEXT: Section: .text22# CASE1-NEXT: Type: 0x023# CASE1-NEXT: StorageClass: C_NULL (0x0)24# CASE1-NEXT: NumberOfAuxEntries: 025# CASE1-NEXT: }26# CASE1-NEXT: ]27 28--- !XCOFF29FileHeader:30 MagicNumber: 0x1DF31Sections:32 - Name: .text33Symbols:34 - Section: .text35 - SectionIndex: 136 37## Case 2: a symbol can reference a section by both SectionName and SectionIndex.38# RUN: yaml2obj --docnum=2 -DSECNAME='.text' -DSECINDEX=1 %s -o %t239# RUN: llvm-readobj %t2 -s | FileCheck %s --check-prefix=CASE240 41# CASE2: Symbols [42# CASE2-NEXT: Symbol {43# CASE2-NEXT: Index: 044# CASE2-NEXT: Name: 45# CASE2-NEXT: Value: 0x046# CASE2-NEXT: Section: .text47# CASE2-NEXT: Type: 0x048# CASE2-NEXT: StorageClass: C_NULL (0x0)49# CASE2-NEXT: NumberOfAuxEntries: 050# CASE2-NEXT: }51# CASE2-NEXT: ]52 53--- !XCOFF54FileHeader:55 MagicNumber: 0x1DF56Sections:57 - Name: .text58Symbols:59 - Section: [[SECNAME=<none>]]60 SectionIndex: [[SECINDEX=<none>]]61 62## Case3: if both Section and SectionIndex are specified, but the two63## values refer to different sections, an error will be reported.64# RUN: not yaml2obj --docnum=2 -DSECNAME='.text' -DSECINDEX=0 %s -o %t3 2>&1 \65# RUN: | FileCheck %s --check-prefix=CASE366 67# CASE3: the SectionName .text and the SectionIndex (0) refer to different sections68 69## Case4: yaml2obj allows the specification of an invalid SectionIndex.70## TODO: the error message should include the symbol name or index.71# RUN: yaml2obj --docnum=2 -DSECINDEX=2 %s -o %t472# RUN: not llvm-readobj %t4 -s 2>&1 | FileCheck %s --check-prefix=CASE473 74# CASE4: the section index (2) is invalid75 76## Case 5: if a symbol references a non-existent section by SectionName,77## an error will be reported.78# RUN: not yaml2obj --docnum=2 -DSECNAME='.data' %s -o %t5 2>&1 \79# RUN: | FileCheck %s --check-prefix=CASE580 81# CASE5: the SectionName .data specified in the symbol does not exist82