1 ## Check how yaml2obj produces SHT_LLVM_DEPENDENT_LIBRARIES sections.
3 ## Check we can describe SHT_LLVM_DEPENDENT_LIBRARIES using
4 ## "Libraries", "Size" and "Content" properies.
6 # RUN: yaml2obj --docnum=1 %s -o %t1
7 # RUN: llvm-readobj --sections --section-data %t1 | FileCheck %s --check-prefix=LIBRARIES
9 # LIBRARIES: Name: .deplibs.lib
10 # LIBRARIES-NEXT: Type: SHT_LLVM_DEPENDENT_LIBRARIES (0x6FFF4C04)
11 # LIBRARIES-NEXT: Flags [ (0x0)
13 # LIBRARIES-NEXT: Address: 0x0
14 # LIBRARIES-NEXT: Offset: 0x40
15 # LIBRARIES-NEXT: Size: 12
16 # LIBRARIES-NEXT: Link: 0
17 # LIBRARIES-NEXT: Info: 0
18 # LIBRARIES-NEXT: AddressAlignment: 0
19 # LIBRARIES-NEXT: EntrySize: 0
20 # LIBRARIES-NEXT: SectionData (
21 # LIBRARIES-NEXT: 0000: 666F6F00 62617200 666F6F00 |foo.bar.foo.|
24 # LIBRARIES: Name: .deplibs.content
25 # LIBRARIES-NEXT: Type: SHT_LLVM_DEPENDENT_LIBRARIES
26 # LIBRARIES-NEXT: Flags [
28 # LIBRARIES-NEXT: Address: 0x0
29 # LIBRARIES-NEXT: Offset: 0x4C
30 # LIBRARIES-NEXT: Size: 3
31 # LIBRARIES-NEXT: Link: 0
32 # LIBRARIES-NEXT: Info: 0
33 # LIBRARIES-NEXT: AddressAlignment: 0
34 # LIBRARIES-NEXT: EntrySize: 0
35 # LIBRARIES-NEXT: SectionData (
36 # LIBRARIES-NEXT: 0000: 112233
39 # LIBRARIES: Name: .deplibs.size
40 # LIBRARIES-NEXT: Type: SHT_LLVM_DEPENDENT_LIBRARIES
41 # LIBRARIES-NEXT: Flags [ (0x0)
43 # LIBRARIES-NEXT: Address: 0x0
44 # LIBRARIES-NEXT: Offset: 0x4F
45 # LIBRARIES-NEXT: Size: 3
46 # LIBRARIES-NEXT: Link: 0
47 # LIBRARIES-NEXT: Info: 0
48 # LIBRARIES-NEXT: AddressAlignment: 0
49 # LIBRARIES-NEXT: EntrySize: 0
50 # LIBRARIES-NEXT: SectionData (
51 # LIBRARIES-NEXT: 0000: 000000 |
61 Type: SHT_LLVM_DEPENDENT_LIBRARIES
62 Libraries: [ foo, bar, foo ]
63 - Name: .deplibs.content
64 Type: SHT_LLVM_DEPENDENT_LIBRARIES
67 Type: SHT_LLVM_DEPENDENT_LIBRARIES
70 ## Check we report an error when "Libraries" and "Content"/"Size" keys are used together.
72 # RUN: not yaml2obj --docnum=2 -DCONTENT="FF" -DLIBS="[]" %s 2>&1 | FileCheck %s --check-prefix=LIBS-ERR
73 # RUN: not yaml2obj --docnum=2 -DSIZE=0 -DLIBS="[]" %s 2>&1 | FileCheck %s --check-prefix=LIBS-ERR
75 # LIBS-ERR: error: "Libraries" cannot be used with "Content" or "Size"
84 Type: SHT_LLVM_DEPENDENT_LIBRARIES
85 Content: [[CONTENT=<none>]]
87 Libraries: [[LIBS=<none>]]
89 ## Check we create an empty section when none of "Libraries", "Size" or "Content" are specified.
91 # RUN: yaml2obj --docnum=2 %s -o %t2.empty
92 # RUN: llvm-readelf --sections %t2.empty | FileCheck %s --check-prefix=EMPTY
94 # EMPTY: [Nr] Name Type Address Off Size
95 # EMPTY: [ 1] .deplibs LLVM_DEPENDENT_LIBRARIES 0000000000000000 000040 000000
97 ## Check we can use the "Content" key with the "Size" key when the size is greater
98 ## than or equal to the content size.
100 # RUN: not yaml2obj --docnum=2 -DSIZE=1 -DCONTENT="'0011'" %s 2>&1 | \
101 # RUN: FileCheck %s --check-prefix=CONTENT-SIZE-ERR
103 # CONTENT-SIZE-ERR: error: Section size must be greater than or equal to the content size
105 # RUN: yaml2obj --docnum=2 -DSIZE=2 -DCONTENT="'0011'" %s -o %t.cont.size.eq.o
106 # RUN: llvm-readobj --sections --section-data %t.cont.size.eq.o | \
107 # RUN: FileCheck %s --check-prefix=CHECK-CONTENT -DDATA="0011"
109 # RUN: yaml2obj --docnum=2 -DSIZE=3 -DCONTENT="'0011'" %s -o %t.cont.size.gr.o
110 # RUN: llvm-readobj --sections --section-data %t.cont.size.gr.o | \
111 # RUN: FileCheck %s --check-prefix=CHECK-CONTENT -DDATA="001100"
113 # CHECK-CONTENT: Name: .deplibs
114 # CHECK-CONTENT: SectionData (
115 # CHECK-CONTENT-NEXT: 0000: [[DATA]] |
116 # CHECK-CONTENT-NEXT: )