[llvm] e2d7c5b - [yaml2obj][test] Simplify some e_machine EI_CLASS EI_DATA tests

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 7 09:40:03 PST 2020


Author: Fangrui Song
Date: 2020-02-07T09:35:26-08:00
New Revision: e2d7c5b2b6559f311938c0853b46ff21df55938a

URL: https://github.com/llvm/llvm-project/commit/e2d7c5b2b6559f311938c0853b46ff21df55938a
DIFF: https://github.com/llvm/llvm-project/commit/e2d7c5b2b6559f311938c0853b46ff21df55938a.diff

LOG: [yaml2obj][test] Simplify some e_machine EI_CLASS EI_DATA tests

When both little-endian and big-endian are tested, or both 32-bit and 64-bit are tested, use a template like the following with `-D BITS=32 -D ENCODE=LSB`

```
--- !ELF
FileHeader:
 Class:   ELFCLASS[[BITS]]
 Data:    ELFDATA2[[ENCODE]]
 Type:    ET_DYN
 Machine: EM_X86_64
```

Reviewed By: grimar, jhenderson

Differential Revision: https://reviews.llvm.org/D73828

Added: 
    

Modified: 
    llvm/test/tools/llvm-objdump/section-headers.test
    llvm/test/tools/llvm-readobj/ELF/hash-histogram.test
    llvm/test/tools/obj2yaml/relr-section.yaml
    llvm/test/tools/yaml2obj/ELF/class-endianness.yaml
    llvm/test/tools/yaml2obj/ELF/emachine.yaml
    llvm/test/tools/yaml2obj/ELF/reloc-sec-entry-size.yaml
    llvm/test/tools/yaml2obj/ELF/relr-section.yaml
    llvm/test/tools/yaml2obj/ELF/stack-sizes.yaml

Removed: 
    


################################################################################
diff  --git a/llvm/test/tools/llvm-objdump/section-headers.test b/llvm/test/tools/llvm-objdump/section-headers.test
index bff362d89e90..5822459acd79 100644
--- a/llvm/test/tools/llvm-objdump/section-headers.test
+++ b/llvm/test/tools/llvm-objdump/section-headers.test
@@ -107,8 +107,8 @@ Sections:
 ## Check that objdump -h only prints the necessary amount of bytes for
 ## addresses.
 
-# RUN: yaml2obj %s --docnum=4 -o %t-32bit.o
-# RUN: yaml2obj %s --docnum=5 -o %t-64bit.o
+# RUN: yaml2obj %s --docnum=4 -D BITS=32 -o %t-32bit.o
+# RUN: yaml2obj %s --docnum=4 -D BITS=64 -o %t-64bit.o
 
 # RUN: llvm-objdump -h --show-lma %t-32bit.o \
 # RUN:   | FileCheck %s --check-prefix=32 --strict-whitespace
@@ -132,7 +132,7 @@ Sections:
 
 --- !ELF
 FileHeader:
-  Class:   ELFCLASS32
+  Class:   ELFCLASS[[BITS]]
   Data:    ELFDATA2LSB
   Type:    ET_EXEC
   Machine: EM_386
@@ -141,15 +141,3 @@ Sections:
     Type:    SHT_PROGBITS
     Flags:   [SHF_ALLOC, SHF_EXECINSTR]
     Address: 0x400
-
---- !ELF
-FileHeader:
-  Class:   ELFCLASS64
-  Data:    ELFDATA2LSB
-  Type:    ET_EXEC
-  Machine: EM_X86_64
-Sections:
-  - Name:    .foo
-    Type:    SHT_PROGBITS
-    Flags:   [SHF_ALLOC, SHF_EXECINSTR]
-    Address: 0x400

diff  --git a/llvm/test/tools/llvm-readobj/ELF/hash-histogram.test b/llvm/test/tools/llvm-readobj/ELF/hash-histogram.test
index 203327ffab76..fd4de9ab9384 100644
--- a/llvm/test/tools/llvm-readobj/ELF/hash-histogram.test
+++ b/llvm/test/tools/llvm-readobj/ELF/hash-histogram.test
@@ -3,10 +3,10 @@
 ## This test case checks how we built a histogram for a GNU hash section.
 ## We check both 32-bit and 64-bit inputs.
 
-# RUN: yaml2obj --docnum=1 %s -o %t1-32.o
+# RUN: yaml2obj --docnum=1 -D BITS=32 %s -o %t1-32.o
 # RUN: llvm-readelf --elf-hash-histogram %t1-32.o | FileCheck %s --check-prefix=GNU-HASH
 
-# RUN: yaml2obj --docnum=2 %s -o %t1-64.o
+# RUN: yaml2obj --docnum=1 -D BITS=64 %s -o %t1-64.o
 # RUN: llvm-readelf --elf-hash-histogram %t1-64.o | FileCheck %s --check-prefix=GNU-HASH
 
 # GNU-HASH:      Histogram for `.gnu.hash' bucket list length (total of 3 buckets)
@@ -18,7 +18,7 @@
 
 --- !ELF
 FileHeader:
-  Class:   ELFCLASS32
+  Class:   ELFCLASS[[BITS]]
   Data:    ELFDATA2LSB
   Type:    ET_DYN
   Machine: EM_386
@@ -51,45 +51,10 @@ ProgramHeaders:
       - Section: .gnu.hash
       - Section: .dynamic
 
---- !ELF
-FileHeader:
-  Class:   ELFCLASS64
-  Data:    ELFDATA2LSB
-  Type:    ET_DYN
-  Machine: EM_X86_64
-Sections:
-  - Name:  .gnu.hash
-    Type:  SHT_GNU_HASH
-    Flags: [ SHF_ALLOC ]
-    Header:
-      SymNdx: 0x1
-      Shift2: 0x0
-    BloomFilter: [ 0x0 ]
-    HashBuckets: [ 0x00000001, 0x00000004, 0x00000000 ]
-    HashValues:  [ 0x0B887388, 0xECD54542, 0x7C92E3BB, 0x1C5871D9 ]
-  - Name:    .dynamic
-    Type:    SHT_DYNAMIC
-    Flags:   [ SHF_WRITE, SHF_ALLOC ]
-    Entries:
-      - Tag:   DT_GNU_HASH
-        Value: 0x0
-      - Tag:   DT_NULL
-        Value: 0x0
-DynamicSymbols:
-  - Name: a
-  - Name: b
-  - Name: c
-  - Name: d
-ProgramHeaders:
-  - Type:  PT_LOAD
-    Sections:
-      - Section: .gnu.hash
-      - Section: .dynamic
-
 ## Show that we report a warning for a hash table which contains an entry of
 ## the bucket array pointing to a cycle.
 
-# RUN: yaml2obj --docnum=3 %s -o %t2.o
+# RUN: yaml2obj --docnum=2 %s -o %t2.o
 # RUN: llvm-readelf --elf-hash-histogram 2>&1 %t2.o | FileCheck -DFILE=%t2.o %s --check-prefix=BROKEN
 
 # BROKEN:       warning: '[[FILE]]': .hash section is invalid: bucket 1: a cycle was detected in the linked chain

diff  --git a/llvm/test/tools/obj2yaml/relr-section.yaml b/llvm/test/tools/obj2yaml/relr-section.yaml
index 42e7c44e0c0c..37ddf2c2e671 100644
--- a/llvm/test/tools/obj2yaml/relr-section.yaml
+++ b/llvm/test/tools/obj2yaml/relr-section.yaml
@@ -3,14 +3,14 @@
 ## Test we use the "Entries" property when it is possible do
 ## dump values correctly.
 
-# RUN: yaml2obj --docnum=1 %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: 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.32be
 # RUN: obj2yaml %t.32be | FileCheck %s --check-prefix=ELF32BE
+# 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=1 -D BITS=64 -D ENCODE=MSB %s -o %t.64be
+# RUN: obj2yaml %t.64be | FileCheck %s --check-prefix=ELF64BE
 
 # ELF64LE:      Sections:
 # ELF64LE-NEXT:   - Name:    .relr.dyn
@@ -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 @@ Sections:
     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
index f18ffc4c9948..fde9d7639d0a 100644
--- a/llvm/test/tools/yaml2obj/ELF/class-endianness.yaml
+++ b/llvm/test/tools/yaml2obj/ELF/class-endianness.yaml
@@ -1,9 +1,13 @@
 ## Check we can produce 32/64 bits outputs with a 
diff erent 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=64 -D ENCODE=LSB %s | llvm-readobj --file-headers - | \
+# RUN:   FileCheck %s --check-prefix=LE64
+# RUN: yaml2obj -D BITS=64 -D ENCODE=MSB %s | llvm-readobj --file-headers - | \
+# RUN:   FileCheck %s --check-prefix=BE64
+# RUN: yaml2obj -D BITS=32 -D ENCODE=LSB %s | llvm-readobj --file-headers - | \
+# RUN:   FileCheck %s --check-prefix=LE32
+# RUN: yaml2obj -D BITS=32 -D ENCODE=MSB %s | llvm-readobj --file-headers - | \
+# RUN:   FileCheck %s --check-prefix=BE32
 
 # LE64:      Class: 64-bit (0x2)
 # LE64-NEXT: DataEncoding: LittleEndian (0x1)
@@ -17,30 +21,14 @@
 # BE32:      Class: 32-bit (0x1)
 # BE32-NEXT: DataEncoding: BigEndian (0x2)
 
---- !ELF
-FileHeader: !FileHeader
-  Class: ELFCLASS64
-  Data: ELFDATA2LSB
-  Type: ET_EXEC
-  Machine: EM_X86_64
-
---- !ELF
-FileHeader: !FileHeader
-  Class: ELFCLASS64
-  Data: ELFDATA2MSB
-  Type: ET_EXEC
-  Machine: EM_PPC64
+# 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
 
---- !ELF
-FileHeader: !FileHeader
-  Class: ELFCLASS32
-  Data: ELFDATA2LSB
-  Type: ET_EXEC
-  Machine: EM_386
+# BAD: error: unknown enumerated scalar
 
 --- !ELF
 FileHeader: !FileHeader
-  Class: ELFCLASS32
-  Data: ELFDATA2MSB
+  Class: ELFCLASS[[BITS]]
+  Data: ELFDATA2[[ENCODE]]
   Type: ET_EXEC
-  Machine: EM_PPC
+  Machine: EM_X86_64

diff  --git a/llvm/test/tools/yaml2obj/ELF/emachine.yaml b/llvm/test/tools/yaml2obj/ELF/emachine.yaml
index 206be42c7dc5..fe981df396d9 100644
--- a/llvm/test/tools/yaml2obj/ELF/emachine.yaml
+++ b/llvm/test/tools/yaml2obj/ELF/emachine.yaml
@@ -2,7 +2,7 @@
 
 ## Test we can use an arbitrary value.
 
-# RUN: yaml2obj --docnum=1 %s -o %t1
+# RUN: yaml2obj -D MACHINE=0x1234 %s -o %t1
 # RUN: llvm-readelf %t1 --file-headers | FileCheck %s --check-prefix=UNKNOWN
 
 # UNKNOWN: Machine: 1234
@@ -12,44 +12,23 @@ FileHeader:
   Class:   ELFCLASS64
   Data:    ELFDATA2MSB
   Type:    ET_REL
-  Machine: 0x1234
+  Machine: [[MACHINE]]
 
 ## Test we can't use a number that doesn't fit into 2 bytes.
 
-# RUN: not yaml2obj --docnum=2 %s 2>&1 | FileCheck %s --check-prefix=ERR
+# RUN: not yaml2obj -D MACHINE=0x12345 %s 2>&1 | FileCheck %s --check-prefix=ERR
 
 # ERR: error: out of range hex16 number
 
---- !ELF
-FileHeader:
-  Class:   ELFCLASS64
-  Data:    ELFDATA2MSB
-  Type:    ET_REL
-  Machine: 0x12345
-
 ## Test we can use a known named constant.
 
-# RUN: yaml2obj --docnum=3 %s -o %t3
+# RUN: yaml2obj -D MACHINE=EM_NONE %s -o %t3
 # RUN: llvm-readelf %t3 --file-headers | FileCheck %s --check-prefix=NONE
 
 # NONE: Machine: None
 
---- !ELF
-FileHeader:
-  Class:   ELFCLASS64
-  Data:    ELFDATA2MSB
-  Type:    ET_REL
-  Machine: EM_NONE
-
 ## Test we can't use an unknown string constant.
 
-# RUN: not yaml2obj --docnum=4 %s 2>&1 | FileCheck %s --check-prefix=ERR2
+# RUN: not yaml2obj -D MACHINE=EM_UNKNOWN_FOO %s 2>&1 | FileCheck %s --check-prefix=ERR2
 
 # ERR2: error: invalid hex16 number
-
---- !ELF
-FileHeader:
-  Class:   ELFCLASS64
-  Data:    ELFDATA2MSB
-  Type:    ET_REL
-  Machine: EM_UNKNOWN_FOO

diff  --git a/llvm/test/tools/yaml2obj/ELF/reloc-sec-entry-size.yaml b/llvm/test/tools/yaml2obj/ELF/reloc-sec-entry-size.yaml
index 0a4089a969fa..f25c53f66092 100644
--- 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 @@ Sections:
   - 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
index 8cd27c5d26ac..b6f4e397b724 100644
--- 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 @@ Sections:
 --- !ELF
 FileHeader:
   Class:   ELFCLASS64
-  Data:    ELFDATA2MSB
+  Data:    ELFDATA2[[ENCODE]]
   Type:    ET_DYN
   Machine: EM_X86_64
 Sections:
@@ -60,7 +46,7 @@ Sections:
                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 @@ Sections:
 # 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 @@ Sections:
 --- !ELF
 FileHeader:
   Class:   ELFCLASS32
-  Data:    ELFDATA2MSB
+  Data:    ELFDATA2[[ENCODE]]
   Type:    ET_DYN
   Machine: EM_386
 Sections:
@@ -117,7 +89,7 @@ Sections:
                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 @@ Sections:
     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 @@ Sections:
     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 @@ Sections:
 # 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 @@ Sections:
     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
index e05a3def6a43..12a88bda7034 100644
--- a/llvm/test/tools/yaml2obj/ELF/stack-sizes.yaml
+++ b/llvm/test/tools/yaml2obj/ELF/stack-sizes.yaml
@@ -64,14 +64,14 @@ Sections:
 
 ## Check we can describe .stack_sizes section using <address, size> 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 @@ Sections:
 
 --- !ELF
 FileHeader:
-  Class:   ELFCLASS64
-  Data:    ELFDATA2LSB
+  Class:   ELFCLASS[[BITS]]
+  Data:    ELFDATA2[[ENCODE]]
   Type:    ET_EXEC
   Machine: EM_X86_64
 Sections:
@@ -106,55 +106,10 @@ Sections:
       - 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 @@ Sections:
 
 ## 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 @@ Sections:
 
 ## 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 @@ Sections:
 
 ## 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 @@ Sections:
 
 ## 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 @@ Sections:
 
 ## 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 @@ Sections:
 
 ## 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 @@ Sections:
     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 @@ Sections:
 
 ## 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


        


More information about the llvm-commits mailing list