diff --git a/llvm/test/tools/obj2yaml/relr-section.yaml b/llvm/test/tools/obj2yaml/relr-section.yaml --- a/llvm/test/tools/obj2yaml/relr-section.yaml +++ b/llvm/test/tools/obj2yaml/relr-section.yaml @@ -3,13 +3,13 @@ ## Test we use the "Entries" property when it is possible do ## dump values correctly. -# RUN: yaml2obj --docnum=1 %s -o %t.64le +# RUN: yaml2obj --docnum=1 -D BITS=64 -D ENCODE=LSB %s -o %t.64le # RUN: obj2yaml %t.64le | FileCheck %s --check-prefix=ELF64LE -# RUN: yaml2obj --docnum=2 %s -o %t.32le +# RUN: yaml2obj --docnum=1 -D BITS=32 -D ENCODE=LSB %s -o %t.32le # RUN: obj2yaml %t.32le | FileCheck %s --check-prefix=ELF32LE -# RUN: yaml2obj --docnum=3 %s -o %t.64be +# RUN: yaml2obj --docnum=1 -D BITS=64 -D ENCODE=MSB %s -o %t.64be # RUN: obj2yaml %t.64be | FileCheck %s --check-prefix=ELF64BE -# RUN: yaml2obj --docnum=4 %s -o %t.32be +# RUN: yaml2obj --docnum=1 -D BITS=32 -D ENCODE=MSB %s -o %t.64be # RUN: obj2yaml %t.32be | FileCheck %s --check-prefix=ELF32BE # ELF64LE: Sections: @@ -38,8 +38,8 @@ --- !ELF FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB + Class: ELFCLASS[[BITS]] + Data: ELFDATA2[[ENCODE]] Type: ET_DYN Machine: EM_X86_64 Sections: @@ -47,42 +47,9 @@ Type: SHT_RELR Content: "1122334455667788" ---- !ELF -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_DYN - Machine: EM_386 -Sections: - - Name: .relr.dyn - Type: SHT_RELR - Content: "1122334455667788" - ---- !ELF -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2MSB - Type: ET_DYN - Machine: EM_X86_64 -Sections: - - Name: .relr.dyn - Type: SHT_RELR - Content: "1122334455667788" - ---- !ELF -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2MSB - Type: ET_DYN - Machine: EM_386 -Sections: - - Name: .relr.dyn - Type: SHT_RELR - Content: "1122334455667788" - ## Test we use the "Content" property when a SHT_RELR section is truncated. -# RUN: yaml2obj --docnum=5 %s -o %t.content +# RUN: yaml2obj --docnum=2 %s -o %t.content # RUN: obj2yaml %t.content | FileCheck %s --check-prefix=CONTENT # CONTENT: - Name: .relr.dyn diff --git a/llvm/test/tools/yaml2obj/ELF/class-endianness.yaml b/llvm/test/tools/yaml2obj/ELF/class-endianness.yaml --- a/llvm/test/tools/yaml2obj/ELF/class-endianness.yaml +++ b/llvm/test/tools/yaml2obj/ELF/class-endianness.yaml @@ -1,9 +1,9 @@ ## Check we can produce 32/64 bits outputs with a different endianness. -# RUN: yaml2obj %s --docnum=1 | llvm-readobj --file-headers - | FileCheck %s --check-prefix LE64 -# RUN: yaml2obj %s --docnum=2 | llvm-readobj --file-headers - | FileCheck %s --check-prefix BE64 -# RUN: yaml2obj %s --docnum=3 | llvm-readobj --file-headers - | FileCheck %s --check-prefix LE32 -# RUN: yaml2obj %s --docnum=4 | llvm-readobj --file-headers - | FileCheck %s --check-prefix BE32 +# RUN: yaml2obj -D BITS=32 -D ENCODE=LSB %s | llvm-readobj --file-headers - | FileCheck %s --check-prefix LE32 +# RUN: yaml2obj -D BITS=32 -D ENCODE=MSB %s | llvm-readobj --file-headers - | FileCheck %s --check-prefix BE32 +# RUN: yaml2obj -D BITS=64 -D ENCODE=LSB %s | llvm-readobj --file-headers - | FileCheck %s --check-prefix LE64 +# RUN: yaml2obj -D BITS=64 -D ENCODE=MSB %s | llvm-readobj --file-headers - | FileCheck %s --check-prefix BE64 # LE64: Class: 64-bit (0x2) # LE64-NEXT: DataEncoding: LittleEndian (0x1) @@ -17,30 +17,14 @@ # BE32: Class: 32-bit (0x1) # BE32-NEXT: DataEncoding: BigEndian (0x2) +# RUN: not yaml2obj --docnum=1 -D BITS=16 -D ENCODE=LSB %s 2>&1 | FileCheck --check-prefix=BAD %s +# RUN: not yaml2obj --docnum=1 -D BITS=32 -D ENCODE= %s 2>&1 | FileCheck --check-prefix=BAD %s + +# BAD: error: unknown enumerated scalar + --- !ELF FileHeader: !FileHeader - Class: ELFCLASS64 - Data: ELFDATA2LSB + Class: ELFCLASS[[BITS]] + Data: ELFDATA2[[ENCODE]] Type: ET_EXEC Machine: EM_X86_64 - ---- !ELF -FileHeader: !FileHeader - Class: ELFCLASS64 - Data: ELFDATA2MSB - Type: ET_EXEC - Machine: EM_PPC64 - ---- !ELF -FileHeader: !FileHeader - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_EXEC - Machine: EM_386 - ---- !ELF -FileHeader: !FileHeader - Class: ELFCLASS32 - Data: ELFDATA2MSB - Type: ET_EXEC - Machine: EM_PPC diff --git a/llvm/test/tools/yaml2obj/ELF/reloc-sec-entry-size.yaml b/llvm/test/tools/yaml2obj/ELF/reloc-sec-entry-size.yaml --- a/llvm/test/tools/yaml2obj/ELF/reloc-sec-entry-size.yaml +++ b/llvm/test/tools/yaml2obj/ELF/reloc-sec-entry-size.yaml @@ -1,9 +1,9 @@ ## Test how yaml2obj sets values for sh_entsize fields of relocation sections. -# RUN: yaml2obj --docnum=1 %s -o %t64 +# RUN: yaml2obj -D BITS=64 %s -o %t64 # RUN: llvm-readelf --sections %t64 | FileCheck %s --check-prefix=ELF64 -# RUN: yaml2obj --docnum=2 %s -o %t32 +# RUN: yaml2obj -D BITS=32 %s -o %t32 # RUN: llvm-readelf --sections %t32 | FileCheck %s --check-prefix=ELF32 # ELF64: Name Type Address Off Size ES @@ -24,7 +24,7 @@ --- !ELF FileHeader: - Class: ELFCLASS64 + Class: ELFCLASS[[BITS]] Data: ELFDATA2LSB Type: ET_REL Machine: EM_X86_64 @@ -46,28 +46,3 @@ - Name: .relr.custom Type: SHT_RELR EntSize: 0xFF - ---- !ELF -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_386 -Sections: -## Check default sh_entsizes field values. - - Name: .rela.default - Type: SHT_RELA - - Name: .rel.default - Type: SHT_REL - - Name: .relr.default - Type: SHT_RELR -## Check we can set sh_entsize fields to arbitrary values. - - Name: .rela.custom - Type: SHT_RELA - EntSize: 0xFF - - Name: .rel.custom - Type: SHT_REL - EntSize: 0xFF - - Name: .relr.custom - Type: SHT_RELR - EntSize: 0xFF diff --git a/llvm/test/tools/yaml2obj/ELF/relr-section.yaml b/llvm/test/tools/yaml2obj/ELF/relr-section.yaml --- a/llvm/test/tools/yaml2obj/ELF/relr-section.yaml +++ b/llvm/test/tools/yaml2obj/ELF/relr-section.yaml @@ -1,7 +1,7 @@ ## Test how we create SHT_RELR sections. ## Test that the content of SHT_RELR sections for 64-bit little endian targets is correct. -# RUN: yaml2obj --docnum=1 %s -o %t.le64 +# RUN: yaml2obj --docnum=1 -D ENCODE=LSB %s -o %t.le64 # RUN: llvm-readobj --sections --section-data %t.le64 | FileCheck %s --check-prefix=LE64 # LE64: Name: .relr.dyn @@ -21,22 +21,8 @@ # LE64-NEXT: 0010: 66554433 00000010 AA998877 00000010 # LE64-NEXT: ) ---- !ELF -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - Type: ET_DYN - Machine: EM_X86_64 -Sections: - - Name: .relr.dyn - Type: SHT_RELR -## Set an arbitrary flag to demonstrate flags are set when requested. - Flags: [ SHF_ALLOC ] - Entries: [ 0x00000000AABBCCDD, 0x00000000EEFF1122, - 0x1000000033445566, 0x10000000778899AA ] - ## Test that the content of SHT_RELR sections for 64-bit big endian targets is correct. -# RUN: yaml2obj --docnum=2 %s -o %t.be64 +# RUN: yaml2obj --docnum=1 -D ENCODE=MSB %s -o %t.be64 # RUN: llvm-readobj --sections --section-data %t.be64 | FileCheck %s --check-prefix=BE64 # BE64: Name: .relr.dyn @@ -48,7 +34,7 @@ --- !ELF FileHeader: Class: ELFCLASS64 - Data: ELFDATA2MSB + Data: ELFDATA2[[ENCODE]] Type: ET_DYN Machine: EM_X86_64 Sections: @@ -60,7 +46,7 @@ 0x1000000033445566, 0x10000000778899AA ] ## Test that the content of SHT_RELR sections for 32-bit little endian targets is correct. -# RUN: yaml2obj --docnum=3 %s -o %t.le32 +# RUN: yaml2obj --docnum=2 -D ENCODE=LSB %s -o %t.le32 # RUN: llvm-readobj --sections --section-data %t.le32 | FileCheck %s --check-prefix=LE32 # LE32: Name: .relr.dyn @@ -79,22 +65,8 @@ # LE32-NEXT: 0000: DDCCBBAA BBAAFFEE BBAAFFEE BCAAFFEE # LE32-NEXT: ) ---- !ELF -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_DYN - Machine: EM_386 -Sections: - - Name: .relr.dyn - Type: SHT_RELR -## Set an arbitrary flag to demonstrate flags are set when requested. - Flags: [ SHF_ALLOC ] - Entries: [ 0xAABBCCDD, 0xEEFFAABB, - 0xEEFFAABB, 0xEEFFAABC ] - ## Test that the content of SHT_RELR sections for 32-bit big endian targets is correct. -# RUN: yaml2obj --docnum=4 %s -o %t.be32 +# RUN: yaml2obj --docnum=2 -D ENCODE=MSB %s -o %t.be32 # RUN: llvm-readobj --sections --section-data %t.be32 | FileCheck %s --check-prefix=BE32 # BE32: Name: .relr.dyn @@ -105,7 +77,7 @@ --- !ELF FileHeader: Class: ELFCLASS32 - Data: ELFDATA2MSB + Data: ELFDATA2[[ENCODE]] Type: ET_DYN Machine: EM_386 Sections: @@ -117,7 +89,7 @@ 0xEEFFAABB, 0xEEFFAABC ] ## Test we can use "Content" to describe SHT_RELR section. -# RUN: yaml2obj --docnum=5 %s -o %t.content +# RUN: yaml2obj --docnum=3 %s -o %t.content # RUN: llvm-readobj --sections --section-data %t.content | FileCheck %s --check-prefix=CONTENT # CONTENT: Name: .relr.dyn @@ -137,7 +109,7 @@ Content: "112233" ## Check we are able to set an arbitrary sh_entsize. -# RUN: yaml2obj --docnum=6 %s -o %t.entsize +# RUN: yaml2obj --docnum=4 %s -o %t.entsize # RUN: llvm-readelf --sections %t.entsize | FileCheck %s --check-prefix=ENTSIZE # ENTSIZE: [Nr] Name Type Address Off Size ES @@ -156,7 +128,7 @@ Content: "12" ## Test we can't use 64-bit offsets/bitmaps when creating a 32-bit object. -# RUN: yaml2obj --docnum=7 %s -o %t.nottoolarge +# RUN: yaml2obj --docnum=5 %s -o %t.nottoolarge # RUN: llvm-readobj --sections --section-data %t.nottoolarge | FileCheck %s --check-prefix=NOT-TOO-LARGE # NOT-TOO-LARGE: Name: .relr.dyn @@ -164,7 +136,7 @@ # NOT-TOO-LARGE-NEXT: 0000: FFFFFFFF # NOT-TOO-LARGE-NEXT: ) -# RUN: not yaml2obj --docnum=8 %s 2>&1 | FileCheck %s --check-prefix=TOO-LARGE +# RUN: not yaml2obj --docnum=6 %s 2>&1 | FileCheck %s --check-prefix=TOO-LARGE # TOO-LARGE: error: .relr.dyn: the value is too large for 32-bits: 0x100000000 --- !ELF @@ -190,7 +162,7 @@ Entries: [ 0x0000000100000000 ] ## Test we can't specify "Entries" and "Content" properties at the same time. -# RUN: not yaml2obj --docnum=9 %s 2>&1 | FileCheck %s --check-prefix=BOTH +# RUN: not yaml2obj --docnum=7 %s 2>&1 | FileCheck %s --check-prefix=BOTH # BOTH: error: "Entries" and "Content" can't be used together diff --git a/llvm/test/tools/yaml2obj/ELF/stack-sizes.yaml b/llvm/test/tools/yaml2obj/ELF/stack-sizes.yaml --- a/llvm/test/tools/yaml2obj/ELF/stack-sizes.yaml +++ b/llvm/test/tools/yaml2obj/ELF/stack-sizes.yaml @@ -64,14 +64,14 @@ ## Check we can describe .stack_sizes section using pairs. -# RUN: yaml2obj --docnum=2 %s -o %t2 -# RUN: llvm-readobj --sections --section-data %t2 | FileCheck %s --check-prefix=ENTRIES-LE64-BOTH -# RUN: yaml2obj --docnum=3 %s -o %t3 -# RUN: llvm-readobj --sections --section-data %t3 | FileCheck %s --check-prefix=ENTRIES-BE64-BOTH -# RUN: yaml2obj --docnum=4 %s -o %t4 -# RUN: llvm-readobj --sections --section-data %t4 | FileCheck %s --check-prefix=ENTRIES-LE32-BOTH -# RUN: yaml2obj --docnum=5 %s -o %t5 -# RUN: llvm-readobj --sections --section-data %t5 | FileCheck %s --check-prefix=ENTRIES-BE32-BOTH +# RUN: yaml2obj --docnum=2 -D BITS=64 -D ENCODE=LSB %s -o %t2.le64 +# RUN: llvm-readobj --sections --section-data %t2.le64 | FileCheck %s --check-prefix=ENTRIES-LE64-BOTH +# RUN: yaml2obj --docnum=2 -D BITS=64 -D ENCODE=MSB %s -o %t2.be64 +# RUN: llvm-readobj --sections --section-data %t2.be64 | FileCheck %s --check-prefix=ENTRIES-BE64-BOTH +# RUN: yaml2obj --docnum=2 -D BITS=32 -D ENCODE=LSB %s -o %t2.le32 +# RUN: llvm-readobj --sections --section-data %t2.le32 | FileCheck %s --check-prefix=ENTRIES-LE32-BOTH +# RUN: yaml2obj --docnum=2 -D BITS=32 -D ENCODE=MSB %s -o %t2.be32 +# RUN: llvm-readobj --sections --section-data %t2.be32 | FileCheck %s --check-prefix=ENTRIES-BE32-BOTH # ENTRIES-LE64-BOTH: Name: .stack_sizes # ENTRIES-LE64-BOTH: SectionData ( @@ -93,8 +93,8 @@ --- !ELF FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB + Class: ELFCLASS[[BITS]] + Data: ELFDATA2[[ENCODE]] Type: ET_EXEC Machine: EM_X86_64 Sections: @@ -106,55 +106,10 @@ - Address: 0x30 Size: 0x40 ---- !ELF -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2MSB - Type: ET_EXEC - Machine: EM_X86_64 -Sections: - - Name: .stack_sizes - Type: SHT_PROGBITS - Entries: - - Address: 0x10 - Size: 0x20 - - Address: 0x30 - Size: 0x40 - ---- !ELF -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2LSB - Type: ET_EXEC - Machine: EM_386 -Sections: - - Name: .stack_sizes - Type: SHT_PROGBITS - Entries: - - Address: 0x10 - Size: 0x20 - - Address: 0x30 - Size: 0x40 - ---- !ELF -FileHeader: - Class: ELFCLASS32 - Data: ELFDATA2MSB - Type: ET_EXEC - Machine: EM_386 -Sections: - - Name: .stack_sizes - Type: SHT_PROGBITS - Entries: - - Address: 0x10 - Size: 0x20 - - Address: 0x30 - Size: 0x40 - ## Check we can omit the "Address" tag. In this case the address will be zero. -# RUN: yaml2obj --docnum=6 %s -o %t6 -# RUN: llvm-readobj --sections --section-data %t6 | FileCheck %s --check-prefix=ENTRIES-NOADDR +# RUN: yaml2obj --docnum=3 %s -o %t3 +# RUN: llvm-readobj --sections --section-data %t3 | FileCheck %s --check-prefix=ENTRIES-NOADDR # ENTRIES-NOADDR: Name: .stack_sizes # ENTRIES-NOADDR: SectionData ( @@ -176,7 +131,7 @@ ## Check that "Size" tag is mandatory when we describe .stack_sizes using "Entries". -# RUN: not yaml2obj --docnum=7 %s 2>&1 | FileCheck %s --check-prefix=ENTRIES-NOSIZE +# RUN: not yaml2obj --docnum=4 %s 2>&1 | FileCheck %s --check-prefix=ENTRIES-NOSIZE # ENTRIES-NOSIZE: error: missing required key 'Size' @@ -194,7 +149,7 @@ ## Check we can't use both "Content" and "Entries" tags at the same time. -# RUN: not yaml2obj --docnum=8 %s 2>&1 | FileCheck %s --check-prefix=ENTRIES-AND-CONTENT +# RUN: not yaml2obj --docnum=5 %s 2>&1 | FileCheck %s --check-prefix=ENTRIES-AND-CONTENT # ENTRIES-AND-CONTENT: error: .stack_sizes: Content and Entries cannot be used together @@ -214,7 +169,7 @@ ## Check we must specify either "Content", "Entries" or "Size" tag when describing .stack_sizes. -# RUN: not yaml2obj --docnum=9 %s 2>&1 | FileCheck %s --check-prefix=NO-TAGS +# RUN: not yaml2obj --docnum=6 %s 2>&1 | FileCheck %s --check-prefix=NO-TAGS # NO-TAGS: .stack_sizes: one of Content, Entries and Size must be specified @@ -230,7 +185,7 @@ ## Check we can't use both "Size" and "Entries" tags at the same time. -# RUN: not yaml2obj --docnum=10 %s 2>&1 | FileCheck %s --check-prefix=ENTRIES-AND-SIZE +# RUN: not yaml2obj --docnum=7 %s 2>&1 | FileCheck %s --check-prefix=ENTRIES-AND-SIZE # ENTRIES-AND-SIZE: .stack_sizes: Size and Entries cannot be used together @@ -250,8 +205,8 @@ ## Check we can use only "Size" to create .stack_sizes section. -# RUN: yaml2obj --docnum=11 %s -o %t11 -# RUN: llvm-readobj --sections --section-data %t11 | FileCheck %s --check-prefix=SIZE +# RUN: yaml2obj --docnum=8 %s -o %t8 +# RUN: llvm-readobj --sections --section-data %t8 | FileCheck %s --check-prefix=SIZE # SIZE: Name: .stack_sizes # SIZE: Size: @@ -274,8 +229,8 @@ ## Check we can use "Size" and "Content" together to create .stack_sizes section. -# RUN: yaml2obj --docnum=12 %s -o %t12 -# RUN: llvm-readobj --sections --section-data %t12 | FileCheck %s --check-prefix=SIZE-CONTENT +# RUN: yaml2obj --docnum=9 %s -o %t9 +# RUN: llvm-readobj --sections --section-data %t9 | FileCheck %s --check-prefix=SIZE-CONTENT # SIZE-CONTENT: Name: .stack_sizes # SIZE-CONTENT: Size: @@ -296,7 +251,7 @@ Size: 0x5 Content: "112233" -# RUN: not yaml2obj --docnum=13 %s 2>&1 | FileCheck %s --check-prefix=SIZE-CONTENT-ERR +# RUN: not yaml2obj --docnum=10 %s 2>&1 | FileCheck %s --check-prefix=SIZE-CONTENT-ERR # SIZE-CONTENT-ERR: error: .stack_sizes: Size must be greater than or equal to the content size @@ -314,7 +269,7 @@ ## Check we can describe multiple .stack_sizes sections using unique suffixes. -# RUN: yaml2obj --docnum=14 %s -o %t11 +# RUN: yaml2obj --docnum=11 %s -o %t11 # RUN: llvm-readobj --sections --section-data %t11 | FileCheck %s --check-prefix=UNIQUE # UNIQUE: Name: .stack_sizes