[llvm] r362377 - [llvm-readobj] - Convert gnu-sections.test to use YAML.
George Rimar via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 3 02:58:42 PDT 2019
Author: grimar
Date: Mon Jun 3 02:58:41 2019
New Revision: 362377
URL: http://llvm.org/viewvc/llvm-project?rev=362377&view=rev
Log:
[llvm-readobj] - Convert gnu-sections.test to use YAML.
gnu-sections.test currently use relocs.obj.elf-x86_64 and
relocs.obj.elf-i386 precompiled objects as an inputs.
These inputs actually initially were introduced to test the
dump of relocations and have almost nothing common with dumping
sections.
Patch converts the test to use yaml2obj. That allows to remove
relocs.obj.elf-i386 binary.
(relocs.obj.elf-x86_64 is still used by another test and can't be removed atm).
Differential revision: https://reviews.llvm.org/D62659
Removed:
llvm/trunk/test/tools/llvm-readobj/Inputs/relocs.obj.elf-i386
Modified:
llvm/trunk/test/tools/llvm-readobj/gnu-sections.test
Removed: llvm/trunk/test/tools/llvm-readobj/Inputs/relocs.obj.elf-i386
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-readobj/Inputs/relocs.obj.elf-i386?rev=362376&view=auto
==============================================================================
Binary files llvm/trunk/test/tools/llvm-readobj/Inputs/relocs.obj.elf-i386 (original) and llvm/trunk/test/tools/llvm-readobj/Inputs/relocs.obj.elf-i386 (removed) differ
Modified: llvm/trunk/test/tools/llvm-readobj/gnu-sections.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-readobj/gnu-sections.test?rev=362377&r1=362376&r2=362377&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-readobj/gnu-sections.test (original)
+++ llvm/trunk/test/tools/llvm-readobj/gnu-sections.test Mon Jun 3 02:58:41 2019
@@ -1,43 +1,115 @@
-RUN: llvm-readelf -S %p/Inputs/relocs.obj.elf-i386 \
-RUN: | FileCheck %s -check-prefix ELF32
-RUN: llvm-readelf -S %p/Inputs/relocs.obj.elf-x86_64 \
-RUN: | FileCheck %s -check-prefix ELF64
-RUN: llvm-readobj --wide --sections \
-RUN: %p/Inputs/relocs.obj.elf-x86_64 --elf-output-style=GNU \
-RUN: | FileCheck %s -check-prefix ELF64
-RUN: llvm-readobj -W --sections \
-RUN: %p/Inputs/relocs.obj.elf-x86_64 --elf-output-style=GNU \
-RUN: | FileCheck %s -check-prefix ELF64
-RUN: llvm-readelf -W -S %p/Inputs/relocs.obj.elf-x86_64 \
-RUN: | FileCheck %s -check-prefix ELF64
-
-ELF32: Section Headers:
-ELF32-NEXT: [Nr] Name Type Address Off Size ES Flg Lk Inf Al
-ELF32-NEXT: [ 0] NULL 00000000 000000 000000 00 0 0 0
-ELF32-NEXT: [ 1] .text PROGBITS 00000000 000034 0000f6 00 AX 0 0 4
-ELF32-NEXT: [ 2] .rel.text REL 00000000 000318 000148 08 6 1 4
-ELF32-NEXT: [ 3] .data PROGBITS 00000000 00012c 000000 00 WA 0 0 4
-ELF32-NEXT: [ 4] .bss NOBITS 00000000 00012c 000000 00 WA 0 0 4
-ELF32-NEXT: [ 5] .shstrtab STRTAB 00000000 00012c 000030 00 0 0 1
-ELF32-NEXT: [ 6] .symtab SYMTAB 00000000 00029c 000060 10 7 4 4
-ELF32-NEXT: [ 7] .strtab STRTAB 00000000 0002fc 00001b 00 0 0 1
-ELF32-NEXT: Key to Flags:
-ELF32-NEXT: W (write), A (alloc), X (execute), M (merge), S (strings), l (large)
-ELF32-NEXT: I (info), L (link order), G (group), T (TLS), E (exclude), x (unknown)
-ELF32-NEXT: O (extra OS processing required) o (OS specific), p (processor specific)
-
-ELF64: There are 8 section headers, starting at offset 0x180:
-ELF64: Section Headers:
-ELF64-NEXT: [Nr] Name Type Address Off Size ES Flg Lk Inf Al
-ELF64-NEXT: [ 0] NULL 0000000000000000 000000 000000 00 0 0 0
-ELF64-NEXT: [ 1] .text PROGBITS 0000000000000000 000040 00010a 00 AX 0 0 4
-ELF64-NEXT: [ 2] .rela.text RELA 0000000000000000 000430 000390 18 6 1 8
-ELF64-NEXT: [ 3] .data PROGBITS 0000000000000000 00014c 000000 00 WA 0 0 4
-ELF64-NEXT: [ 4] .bss NOBITS 0000000000000000 00014c 000000 00 WA 0 0 4
-ELF64-NEXT: [ 5] .shstrtab STRTAB 0000000000000000 00014c 000031 00 0 0 1
-ELF64-NEXT: [ 6] .symtab SYMTAB 0000000000000000 000380 000090 18 7 4 8
-ELF64-NEXT: [ 7] .strtab STRTAB 0000000000000000 000410 00001b 00 0 0 1
-ELF64-NEXT: Key to Flags:
-ELF64-NEXT: W (write), A (alloc), X (execute), M (merge), S (strings), l (large)
-ELF64-NEXT: I (info), L (link order), G (group), T (TLS), E (exclude), x (unknown)
-ELF64-NEXT: O (extra OS processing required) o (OS specific), p (processor specific)
+# RUN: yaml2obj --docnum=1 %s -o %t-i386.o
+# RUN: llvm-readelf -S %t-i386.o | FileCheck %s -check-prefix ELF32
+
+# ELF32: There are 8 section headers, starting at offset 0x34:
+# ELF32-EMPTY:
+# ELF32-NEXT: Section Headers:
+# ELF32-NEXT: [Nr] Name Type Address Off Size ES Flg Lk Inf Al
+# ELF32-NEXT: [ 0] NULL 00000000 000000 000000 00 0 0 0
+# ELF32-NEXT: [ 1] .text PROGBITS 00000000 000174 000001 00 AX 0 0 4
+# ELF32-NEXT: [ 2] .rel.text REL 00000000 000178 000000 08 5 1 4
+# ELF32-NEXT: [ 3] .data PROGBITS 00000000 000178 000000 00 WA 0 0 4
+# ELF32-NEXT: [ 4] .bss NOBITS 00000000 000178 000000 00 WA 0 0 4
+# ELF32-NEXT: [ 5] .symtab SYMTAB 00000000 000178 000020 10 6 2 8
+# ELF32-NEXT: [ 6] .strtab STRTAB 00000000 000198 000007 00 0 0 1
+# ELF32-NEXT: [ 7] .shstrtab STRTAB 00000000 00019f 000030 00 0 0 1
+# ELF32-NEXT: Key to Flags:
+# ELF32-NEXT: W (write), A (alloc), X (execute), M (merge), S (strings), l (large)
+# ELF32-NEXT: I (info), L (link order), G (group), T (TLS), E (exclude), x (unknown)
+# ELF32-NEXT: O (extra OS processing required) o (OS specific), p (processor specific)
+
+--- !ELF
+FileHeader:
+ Class: ELFCLASS32
+ Data: ELFDATA2LSB
+ OSABI: ELFOSABI_GNU
+ Type: ET_REL
+ Machine: EM_386
+Sections:
+ - Name: .text
+ Type: SHT_PROGBITS
+ Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
+ AddressAlign: 0x0000000000000004
+ Content: 00
+ - Name: .rel.text
+ Type: SHT_REL
+ Link: .symtab
+ AddressAlign: 0x0000000000000004
+ EntSize: 0x0000000000000008
+ Info: .text
+ Relocations:
+ - Name: .data
+ Type: SHT_PROGBITS
+ Flags: [ SHF_WRITE, SHF_ALLOC ]
+ AddressAlign: 0x0000000000000004
+ Content: ''
+ - Name: .bss
+ Type: SHT_NOBITS
+ Flags: [ SHF_WRITE, SHF_ALLOC ]
+ AddressAlign: 0x0000000000000004
+Symbols:
+ - Name: .text
+ Type: STT_SECTION
+ Section: .text
+
+# RUN: yaml2obj --docnum=2 %s -o %t-x64.o
+# RUN: llvm-readelf -S %t-x64.o | FileCheck %s -check-prefix ELF64
+
+## Check that --wide is the same as -W and ignored and also
+## that --section is the same as -S.
+# RUN: llvm-readobj --wide --sections %t-x64.o --elf-output-style=GNU \
+# RUN: | FileCheck %s -check-prefix ELF64
+# RUN: llvm-readobj -W --sections %t-x64.o --elf-output-style=GNU \
+# RUN: | FileCheck %s -check-prefix ELF64
+# RUN: llvm-readelf -W -S %t-x64.o | FileCheck %s -check-prefix ELF64
+
+# ELF64: There are 8 section headers, starting at offset 0x40:
+# ELF64-EMPTY:
+# ELF64-NEXT: Section Headers:
+# ELF64-NEXT: [Nr] Name Type Address Off Size ES Flg Lk Inf Al
+# ELF64-NEXT: [ 0] NULL 0000000000000000 000000 000000 00 0 0 0
+# ELF64-NEXT: [ 1] .text PROGBITS 0000000000000000 000240 000001 00 AX 0 0 4
+# ELF64-NEXT: [ 2] .rela.text RELA 0000000000000000 000248 000000 18 5 1 8
+# ELF64-NEXT: [ 3] .data PROGBITS 0000000000000000 000248 000000 00 WA 0 0 4
+# ELF64-NEXT: [ 4] .bss NOBITS 0000000000000000 000248 000000 00 WA 0 0 4
+# ELF64-NEXT: [ 5] .symtab SYMTAB 0000000000000000 000248 000030 18 6 2 8
+# ELF64-NEXT: [ 6] .strtab STRTAB 0000000000000000 000278 000007 00 0 0 1
+# ELF64-NEXT: [ 7] .shstrtab STRTAB 0000000000000000 00027f 000031 00 0 0 1
+# ELF64-NEXT: Key to Flags:
+# ELF64-NEXT: W (write), A (alloc), X (execute), M (merge), S (strings), l (large)
+# ELF64-NEXT: I (info), L (link order), G (group), T (TLS), E (exclude), x (unknown)
+# ELF64-NEXT: O (extra OS processing required) o (OS specific), p (processor specific)
+
+--- !ELF
+FileHeader:
+ Class: ELFCLASS64
+ Data: ELFDATA2LSB
+ OSABI: ELFOSABI_GNU
+ Type: ET_REL
+ Machine: EM_X86_64
+Sections:
+ - Name: .text
+ Type: SHT_PROGBITS
+ Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
+ AddressAlign: 0x0000000000000004
+ Content: 00
+ - Name: .rela.text
+ Type: SHT_RELA
+ Link: .symtab
+ AddressAlign: 0x0000000000000008
+ EntSize: 0x0000000000000018
+ Info: .text
+ Relocations:
+ - Name: .data
+ Type: SHT_PROGBITS
+ Flags: [ SHF_WRITE, SHF_ALLOC ]
+ AddressAlign: 0x0000000000000004
+ Content: ''
+ - Name: .bss
+ Type: SHT_NOBITS
+ Flags: [ SHF_WRITE, SHF_ALLOC ]
+ AddressAlign: 0x0000000000000004
+Symbols:
+ - Name: .text
+ Type: STT_SECTION
+ Section: .text
More information about the llvm-commits
mailing list