1 ## Test the behavior of the symbol reference section.
3 ## Case1: a symbol can reference a section by SectionName or SectionIndex.
4 # RUN: yaml2obj --docnum=1 %s -o %t1
5 # RUN: llvm-readobj %t1 -s | FileCheck %s --check-prefix=CASE1
11 # CASE1-NEXT: Value: 0x0
12 # CASE1-NEXT: Section: .text
13 # CASE1-NEXT: Type: 0x0
14 # CASE1-NEXT: StorageClass: C_NULL (0x0)
15 # CASE1-NEXT: NumberOfAuxEntries: 0
17 # CASE1-NEXT: Symbol {
18 # CASE1-NEXT: Index: 1
20 # CASE1-NEXT: Value: 0x0
21 # CASE1-NEXT: Section: .text
22 # CASE1-NEXT: Type: 0x0
23 # CASE1-NEXT: StorageClass: C_NULL (0x0)
24 # CASE1-NEXT: NumberOfAuxEntries: 0
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 %t2
39 # RUN: llvm-readobj %t2 -s | FileCheck %s --check-prefix=CASE2
42 # CASE2-NEXT: Symbol {
43 # CASE2-NEXT: Index: 0
45 # CASE2-NEXT: Value: 0x0
46 # CASE2-NEXT: Section: .text
47 # CASE2-NEXT: Type: 0x0
48 # CASE2-NEXT: StorageClass: C_NULL (0x0)
49 # CASE2-NEXT: NumberOfAuxEntries: 0
59 - Section: [[SECNAME=<none>]]
60 SectionIndex: [[SECINDEX=<none>]]
62 ## Case3: if both Section and SectionIndex are specified, but the two
63 ## 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=CASE3
67 # CASE3: the SectionName .text and the SectionIndex (0) refer to different sections
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 %t4
72 # RUN: not llvm-readobj %t4 -s 2>&1 | FileCheck %s --check-prefix=CASE4
74 # CASE4: the section index (2) is invalid
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=CASE5
81 # CASE5: the SectionName .data specified in the symbol does not exist