1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139
|
## Check we are able to produce a valid SHT_LLVM_LINKER_OPTIONS
## section from its description.
## Check we can use "Options", "Size" and "Content" alone to describe the data.
# RUN: yaml2obj --docnum=1 %s -o %t1
# RUN: llvm-readobj --string-dump .linker-options1 --sections --section-data %t1 \
# RUN: | FileCheck %s --check-prefix=OPTIONS
# OPTIONS: Name: .linker-options1
# OPTIONS-NEXT: Type: SHT_LLVM_LINKER_OPTIONS
# OPTIONS-NEXT: Flags [
# OPTIONS-NEXT: ]
# OPTIONS-NEXT: Address: 0x0
# OPTIONS-NEXT: Offset: 0x40
# OPTIONS-NEXT: Size: 34
# OPTIONS-NEXT: Link: 0
# OPTIONS-NEXT: Info: 0
# OPTIONS-NEXT: AddressAlignment: 0
# OPTIONS-NEXT: EntrySize: 0
# OPTIONS: Name: .linker-options2
# OPTIONS-NEXT: Type: SHT_LLVM_LINKER_OPTIONS
# OPTIONS: SectionData (
# OPTIONS-NEXT: 0000: 00112233 |
# OPTIONS-NEXT: )
# OPTIONS: Name: .linker-options3
# OPTIONS-NEXT: Type: SHT_LLVM_LINKER_OPTIONS
# OPTIONS: SectionData (
# OPTIONS-NEXT: 0000: 00000000 |
# OPTIONS-NEXT: )
# OPTIONS: String dump of section '.linker-options1':
# OPTIONS-NEXT: [ 0] option 0
# OPTIONS-NEXT: [ 9] value 0
# OPTIONS-NEXT: [ 11] option 1
# OPTIONS-NEXT: [ 1a] value 1
--- !ELF
FileHeader:
Class: ELFCLASS64
Data: ELFDATA2LSB
Type: ET_REL
Sections:
- Name: .linker-options1
Type: SHT_LLVM_LINKER_OPTIONS
Options:
- Name: option 0
Value: value 0
- Name: option 1
Value: value 1
- Name: .linker-options2
Type: SHT_LLVM_LINKER_OPTIONS
Content: "00112233"
- Name: .linker-options3
Type: SHT_LLVM_LINKER_OPTIONS
Size: 4
## Check that "Value" and "Name" fields are mandatory when using "Options" key.
# RUN: not yaml2obj --docnum=2 %s 2>&1 | FileCheck %s --check-prefix=NOVALUE
# RUN: not yaml2obj --docnum=3 %s 2>&1 | FileCheck %s --check-prefix=NONAME
# NOVALUE: error: missing required key 'Value'
# NONAME: error: missing required key 'Name'
--- !ELF
FileHeader:
Class: ELFCLASS64
Data: ELFDATA2LSB
Type: ET_REL
Sections:
- Name: .linker-options
Type: SHT_LLVM_LINKER_OPTIONS
Options:
- Name: name
--- !ELF
FileHeader:
Class: ELFCLASS64
Data: ELFDATA2LSB
Type: ET_REL
Sections:
- Name: .linker-options
Type: SHT_LLVM_LINKER_OPTIONS
Options:
- Value: value
## Check we can't use "Options" or "Size" keys together with the "Content" key.
# RUN: not yaml2obj %s -DOPTIONS="[]" -DCONTENT="''" --docnum=4 2>&1 | \
# RUN: FileCheck %s --check-prefix=TOGETHER
# RUN: not yaml2obj %s -DOPTIONS="[]" -DSIZE="0" --docnum=4 2>&1 | \
# RUN: FileCheck %s --check-prefix=TOGETHER
# TOGETHER: error: "Options" cannot be used with "Content" or "Size"
--- !ELF
FileHeader:
Class: ELFCLASS64
Data: ELFDATA2LSB
Type: ET_REL
Sections:
- Name: .linker-options
Type: SHT_LLVM_LINKER_OPTIONS
Options: [[OPTIONS=<none>]]
Content: [[CONTENT=<none>]]
Size: [[SIZE=<none>]]
## Check we can omit "Options", "Content" and "Size" keys. This produces an empty section.
# RUN: yaml2obj %s --docnum=4 2>&1 -o %t5
# RUN: llvm-readelf --sections %t5 | FileCheck %s --check-prefix=NONE
# NONE: [Nr] Name Type Address Off Size
# NONE: [ 1] .linker-options LLVM_LINKER_OPTIONS 0000000000000000 000040 000000
## Check we can use the "Content" key with the "Size" key when the size is greater
## than or equal to the content size.
# RUN: not yaml2obj --docnum=4 -DSIZE=1 -DCONTENT="'0011'" %s 2>&1 | \
# RUN: FileCheck %s --check-prefix=CONTENT-SIZE-ERR
# CONTENT-SIZE-ERR: error: Section size must be greater than or equal to the content size
# RUN: yaml2obj --docnum=4 -DSIZE=2 -DCONTENT="'0011'" %s -o %t.cont.size.eq.o
# RUN: llvm-readobj --sections --section-data %t.cont.size.eq.o | \
# RUN: FileCheck %s --check-prefix=CHECK-CONTENT -DDATA="0011"
# CHECK-CONTENT: Name: .linker-options (1)
# CHECK-CONTENT: SectionData (
# CHECK-CONTENT-NEXT: 0000: [[DATA]] |
# CHECK-CONTENT-NEXT: )
# RUN: yaml2obj --docnum=4 -DSIZE=3 -DCONTENT="'0011'" %s -o %t.cont.size.gr.o
# RUN: llvm-readobj --sections --section-data %t.cont.size.gr.o | \
# RUN: FileCheck %s --check-prefix=CHECK-CONTENT -DDATA="001100"
|