1## Check how yaml2obj produces SHT_LLVM_DEPENDENT_LIBRARIES sections. 2 3## Check we can describe SHT_LLVM_DEPENDENT_LIBRARIES using 4## "Libraries", "Size" and "Content" properies. 5 6# RUN: yaml2obj --docnum=1 %s -o %t1 7# RUN: llvm-readobj --sections --section-data %t1 | FileCheck %s --check-prefix=LIBRARIES 8 9# LIBRARIES: Name: .deplibs.lib 10# LIBRARIES-NEXT: Type: SHT_LLVM_DEPENDENT_LIBRARIES (0x6FFF4C04) 11# LIBRARIES-NEXT: Flags [ (0x0) 12# LIBRARIES-NEXT: ] 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.| 22# LIBRARIES-NEXT: ) 23 24# LIBRARIES: Name: .deplibs.content 25# LIBRARIES-NEXT: Type: SHT_LLVM_DEPENDENT_LIBRARIES 26# LIBRARIES-NEXT: Flags [ 27# LIBRARIES-NEXT: ] 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 37# LIBRARIES-NEXT: ) 38 39# LIBRARIES: Name: .deplibs.size 40# LIBRARIES-NEXT: Type: SHT_LLVM_DEPENDENT_LIBRARIES 41# LIBRARIES-NEXT: Flags [ (0x0) 42# LIBRARIES-NEXT: ] 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 | 52# LIBRARIES-NEXT: ) 53 54--- !ELF 55FileHeader: 56 Class: ELFCLASS64 57 Data: ELFDATA2LSB 58 Type: ET_REL 59Sections: 60 - Name: .deplibs.lib 61 Type: SHT_LLVM_DEPENDENT_LIBRARIES 62 Libraries: [ foo, bar, foo ] 63 - Name: .deplibs.content 64 Type: SHT_LLVM_DEPENDENT_LIBRARIES 65 Content: "112233" 66 - Name: .deplibs.size 67 Type: SHT_LLVM_DEPENDENT_LIBRARIES 68 Size: 0x3 69 70## Check we report an error when "Libraries" and "Content"/"Size" keys are used together. 71 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 74 75# LIBS-ERR: error: "Libraries" cannot be used with "Content" or "Size" 76 77--- !ELF 78FileHeader: 79 Class: ELFCLASS64 80 Data: ELFDATA2LSB 81 Type: ET_REL 82Sections: 83 - Name: .deplibs 84 Type: SHT_LLVM_DEPENDENT_LIBRARIES 85 Content: [[CONTENT=<none>]] 86 Size: [[SIZE=<none>]] 87 Libraries: [[LIBS=<none>]] 88 89## Check we create an empty section when none of "Libraries", "Size" or "Content" are specified. 90 91# RUN: yaml2obj --docnum=2 %s -o %t2.empty 92# RUN: llvm-readelf --sections %t2.empty | FileCheck %s --check-prefix=EMPTY 93 94# EMPTY: [Nr] Name Type Address Off Size 95# EMPTY: [ 1] .deplibs LLVM_DEPENDENT_LIBRARIES 0000000000000000 000040 000000 96 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. 99 100# RUN: not yaml2obj --docnum=2 -DSIZE=1 -DCONTENT="'0011'" %s 2>&1 | \ 101# RUN: FileCheck %s --check-prefix=CONTENT-SIZE-ERR 102 103# CONTENT-SIZE-ERR: error: Section size must be greater than or equal to the content size 104 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" 108 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" 112 113# CHECK-CONTENT: Name: .deplibs 114# CHECK-CONTENT: SectionData ( 115# CHECK-CONTENT-NEXT: 0000: [[DATA]] | 116# CHECK-CONTENT-NEXT: ) 117