[llvm] 64225ae - [llvm-readobj][test] - Cleanup the many-sections.s test case.

Georgii Rymar via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 26 05:57:27 PST 2019


Author: Georgii Rymar
Date: 2019-11-26T16:56:48+03:00
New Revision: 64225aea8f9ea92bd4189acceead272f498981b8

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

LOG: [llvm-readobj][test] - Cleanup the many-sections.s test case.

It removes 2 precompiled binaries used which are now
can be crafted with the use of yaml2obj.

Differential revision: https://reviews.llvm.org/D70711

Added: 
    

Modified: 
    llvm/test/tools/llvm-readobj/many-sections.s

Removed: 
    llvm/test/tools/llvm-readobj/Inputs/many-sections-stripped.elf-x86_64
    llvm/test/tools/llvm-readobj/Inputs/many-sections.elf-x86_64


################################################################################
diff  --git a/llvm/test/tools/llvm-readobj/Inputs/many-sections-stripped.elf-x86_64 b/llvm/test/tools/llvm-readobj/Inputs/many-sections-stripped.elf-x86_64
deleted file mode 100644
index a589dc5d6a9c..000000000000
Binary files a/llvm/test/tools/llvm-readobj/Inputs/many-sections-stripped.elf-x86_64 and /dev/null 
diff er

diff  --git a/llvm/test/tools/llvm-readobj/Inputs/many-sections.elf-x86_64 b/llvm/test/tools/llvm-readobj/Inputs/many-sections.elf-x86_64
deleted file mode 100644
index 1abb98a01b84..000000000000
Binary files a/llvm/test/tools/llvm-readobj/Inputs/many-sections.elf-x86_64 and /dev/null 
diff er

diff  --git a/llvm/test/tools/llvm-readobj/many-sections.s b/llvm/test/tools/llvm-readobj/many-sections.s
index b2050c74eec2..ae7ce34706ca 100644
--- a/llvm/test/tools/llvm-readobj/many-sections.s
+++ b/llvm/test/tools/llvm-readobj/many-sections.s
@@ -1,37 +1,57 @@
-## many-sections.elf-x86_64 is a file that was generated to simulate
-## an object with more than ~65k sections. When an ELF object
-## has SHN_LORESERVE (0xff00) or more sections, its e_shnum field
+## Here we simulate an object with more than ~65k sections and check how we dump it.
+## When an ELF object has SHN_LORESERVE (0xff00) or more sections, its e_shnum field
 ## should be zero and sh_size of the section header at index 0 is used
 ## to store the value. If the section name string table section index is
 ## greater than or equal to SHN_LORESERVE, then e_shstrndx field
 ## should have the value of SHN_XINDEX and sh_link of the section header
 ## at index 0 is used to store the value.
-##
-## many-sections.elf-x86_64 has few sections to save disk
-## space, but its e_shnum, e_shstrndx, sh_size and sh_link fields are set
-## according to the above description, so that we can test the dumper.
-
-# RUN: llvm-readelf --file-headers -S %p/Inputs/many-sections.elf-x86_64 | \
-# RUN:   FileCheck %s --check-prefix=GNU1
-# GNU1: Number of section headers:         0 (5)
-# GNU1: Section header string table index: 65535 (3)
-# GNU1: There are 5 section headers, starting at offset 0xb8
-
-# RUN: llvm-readobj --file-headers %p/Inputs/many-sections.elf-x86_64 | \
-# RUN:   FileCheck %s --check-prefix=LLVM1
-# LLVM1: SectionHeaderCount: 0 (5)
-# LLVM1: StringTableSectionIndex: 65535 (3)
-
-## many-sections-stripped.elf-x86_64 is many-sections.elf-x86_64 with
-## e_shoff field set to zero, but not e_shstrndx, to show that
-## this corrupt case is handled correctly.
-
-# RUN: llvm-readelf --file-headers %p/Inputs/many-sections-stripped.elf-x86_64 | \
-# RUN:   FileCheck %s --check-prefix=GNU2
+
+# RUN: yaml2obj --docnum=1 %s -o %t1
+# RUN: llvm-readelf --file-headers -S %t1 | FileCheck %s --check-prefix=GNU1
+# GNU1: Number of section headers:         0 (3)
+# GNU1: Section header string table index: 65535 (2)
+# GNU1: There are 3 section headers, starting at offset 0x58
+
+# RUN: llvm-readobj --file-headers %t1 | FileCheck %s --check-prefix=LLVM1
+# LLVM1: SectionHeaderCount: 0 (3)
+# LLVM1: StringTableSectionIndex: 65535 (2)
+
+--- !ELF
+FileHeader:
+  Class:    ELFCLASS64
+  Data:     ELFDATA2LSB
+  Type:     ET_REL
+  Machine:  EM_X86_64
+  SHNum:    0
+  SHStrNdx: 0xffff ## SHN_XINDEX
+Sections:
+  - Type: SHT_NULL
+    Link: .shstrtab
+    Size: 0x3
+
+## Another case is when e_shoff field set to zero, but not e_shstrndx.
+## We want to show that this corrupt case is handled correctly.
+
+# RUN: yaml2obj --docnum=2 %s -o %t2
+
+# RUN: llvm-readelf --file-headers %t2 | FileCheck %s --check-prefix=GNU2
 # GNU2: Number of section headers:         0
 # GNU2: Section header string table index: 65535 (corrupt: out of range)
 
-# RUN: llvm-readobj --file-headers %p/Inputs/many-sections-stripped.elf-x86_64 | \
-# RUN:   FileCheck %s --check-prefix=LLVM2
+# RUN: llvm-readobj --file-headers %t2 | FileCheck %s --check-prefix=LLVM2
 # LLVM2: SectionHeaderCount: 0
 # LLVM2: StringTableSectionIndex: 65535 (corrupt: out of range)
+
+--- !ELF
+FileHeader:
+  Class:    ELFCLASS64
+  Data:     ELFDATA2LSB
+  Type:     ET_REL
+  Machine:  EM_X86_64
+  SHOff:    0
+  SHNum:    0
+  SHStrNdx: 0xffff ## SHN_XINDEX
+Sections:
+  - Type: SHT_NULL
+    Link: .shstrtab
+    Size: 0x3


        


More information about the llvm-commits mailing list