[llvm] 423af54 - [llvm-objdump][test] dos2unix some files
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 28 00:58:19 PDT 2022
Author: Fangrui Song
Date: 2022-03-28T00:58:14-07:00
New Revision: 423af54cbef7b90199e01162dcea6d3e62539e8c
URL: https://github.com/llvm/llvm-project/commit/423af54cbef7b90199e01162dcea6d3e62539e8c
DIFF: https://github.com/llvm/llvm-project/commit/423af54cbef7b90199e01162dcea6d3e62539e8c.diff
LOG: [llvm-objdump][test] dos2unix some files
Added:
Modified:
llvm/test/tools/llvm-objdump/ELF/private-headers.test
llvm/test/tools/llvm-objdump/ELF/program-headers.test
Removed:
################################################################################
diff --git a/llvm/test/tools/llvm-objdump/ELF/private-headers.test b/llvm/test/tools/llvm-objdump/ELF/private-headers.test
index bf18f5810c571..eefdc8440385c 100644
--- a/llvm/test/tools/llvm-objdump/ELF/private-headers.test
+++ b/llvm/test/tools/llvm-objdump/ELF/private-headers.test
@@ -1,65 +1,65 @@
-## Check that with ELF input --private-headers outputs the program header,
-## dynamic section and version definitions.
-# RUN: yaml2obj %s -o %t
-# RUN: llvm-objdump --private-headers %t | FileCheck %s
-
-# CHECK: Program Header:
-# CHECK-NEXT: LOAD off 0x00000000000000b0 vaddr 0x0000000000001000 paddr 0x0000000000001000 align 2**0
-# CHECK-NEXT: filesz 0x000000000000003d memsz 0x000000000000003d flags ---
-# CHECK-NEXT: DYNAMIC off 0x00000000000000cd vaddr 0x000000000000101d paddr 0x000000000000101d align 2**0
-# CHECK-NEXT: filesz 0x0000000000000020 memsz 0x0000000000000020 flags ---
-# CHECK: Dynamic Section:
-# CHECK-NEXT: NEEDED bar
-# CHECK: Version definitions:
-# CHECK-NEXT: 1 0x01 0x075bcd15 foo
-# CHECK-NEXT: 2 0x02 0x3ade68b1 VERSION_1
-# CHECK-NEXT: VERSION_2
-
---- !ELF
-FileHeader:
- Class: ELFCLASS64
- Data: ELFDATA2LSB
- Type: ET_EXEC
- Machine: EM_X86_64
-Sections:
- - Name: .dynstr
- Type: SHT_STRTAB
- Address: 0x1000
- Content: "0062617200666F6F0056455253494F4E5F320056455253494F4E5F3100"
- # Content is: bar, foo, VERSION_2, VERSION_1
- - Name: .dynamic
- Type: SHT_DYNAMIC
- Flags: [ SHF_ALLOC ]
- Entries:
- - Tag: DT_NEEDED
- Value: 0x1
- - Tag: DT_NULL
- Value: 0x0
- - Name: .gnu.version_d
- Type: SHT_GNU_verdef
- Entries:
- - Version: 1
- Flags: 1
- VersionNdx: 1
- Hash: 123456789
- Names:
- - foo
- - Version: 1
- Flags: 2
- VersionNdx: 2
- Hash: 987654321
- Names:
- - VERSION_1
- - VERSION_2
-ProgramHeaders:
- - Type: PT_LOAD
- VAddr: 0x1000
- FirstSec: .dynstr
- LastSec: .dynamic
- - Type: PT_DYNAMIC
- VAddr: 0x101D
- FirstSec: .dynamic
- LastSec: .dynamic
-DynamicSymbols:
- - Name: bar
- Binding: STB_GLOBAL
+## Check that with ELF input --private-headers outputs the program header,
+## dynamic section and version definitions.
+# RUN: yaml2obj %s -o %t
+# RUN: llvm-objdump --private-headers %t | FileCheck %s
+
+# CHECK: Program Header:
+# CHECK-NEXT: LOAD off 0x00000000000000b0 vaddr 0x0000000000001000 paddr 0x0000000000001000 align 2**0
+# CHECK-NEXT: filesz 0x000000000000003d memsz 0x000000000000003d flags ---
+# CHECK-NEXT: DYNAMIC off 0x00000000000000cd vaddr 0x000000000000101d paddr 0x000000000000101d align 2**0
+# CHECK-NEXT: filesz 0x0000000000000020 memsz 0x0000000000000020 flags ---
+# CHECK: Dynamic Section:
+# CHECK-NEXT: NEEDED bar
+# CHECK: Version definitions:
+# CHECK-NEXT: 1 0x01 0x075bcd15 foo
+# CHECK-NEXT: 2 0x02 0x3ade68b1 VERSION_1
+# CHECK-NEXT: VERSION_2
+
+--- !ELF
+FileHeader:
+ Class: ELFCLASS64
+ Data: ELFDATA2LSB
+ Type: ET_EXEC
+ Machine: EM_X86_64
+Sections:
+ - Name: .dynstr
+ Type: SHT_STRTAB
+ Address: 0x1000
+ Content: "0062617200666F6F0056455253494F4E5F320056455253494F4E5F3100"
+ # Content is: bar, foo, VERSION_2, VERSION_1
+ - Name: .dynamic
+ Type: SHT_DYNAMIC
+ Flags: [ SHF_ALLOC ]
+ Entries:
+ - Tag: DT_NEEDED
+ Value: 0x1
+ - Tag: DT_NULL
+ Value: 0x0
+ - Name: .gnu.version_d
+ Type: SHT_GNU_verdef
+ Entries:
+ - Version: 1
+ Flags: 1
+ VersionNdx: 1
+ Hash: 123456789
+ Names:
+ - foo
+ - Version: 1
+ Flags: 2
+ VersionNdx: 2
+ Hash: 987654321
+ Names:
+ - VERSION_1
+ - VERSION_2
+ProgramHeaders:
+ - Type: PT_LOAD
+ VAddr: 0x1000
+ FirstSec: .dynstr
+ LastSec: .dynamic
+ - Type: PT_DYNAMIC
+ VAddr: 0x101D
+ FirstSec: .dynamic
+ LastSec: .dynamic
+DynamicSymbols:
+ - Name: bar
+ Binding: STB_GLOBAL
diff --git a/llvm/test/tools/llvm-objdump/ELF/program-headers.test b/llvm/test/tools/llvm-objdump/ELF/program-headers.test
index 4c61e974d6db5..1e11334d7172f 100644
--- a/llvm/test/tools/llvm-objdump/ELF/program-headers.test
+++ b/llvm/test/tools/llvm-objdump/ELF/program-headers.test
@@ -1,324 +1,324 @@
-## Check that program headers are output correctly
-
-# RUN: yaml2obj --docnum=1 -DBITS=32 -DMACHINE=EM_386 %s -o %t32.elf
-# RUN: llvm-objdump --private-headers %t32.elf | FileCheck %s --check-prefixes=ELF32
-
-# ELF32: Program Header:
-# ELF32-NEXT: PHDR off 0x00000314 vaddr 0x00001000 paddr 0x00001000 align 2**0
-# ELF32-NEXT: filesz 0x00000003 memsz 0x00000003 flags -w-
-# ELF32-NEXT: PHDR off 0x00000317 vaddr 0x00002000 paddr 0x00002000 align 2**0
-# ELF32-NEXT: filesz 0x00000007 memsz 0x00000007 flags --x
-# ELF32-NEXT: UNKNOWN off 0x00000317 vaddr 0x00002000 paddr 0x00002000 align 2**0
-# ELF32-NEXT: filesz 0x00000007 memsz 0x00000007 flags --x
-# ELF32-NEXT: DYNAMIC off 0x00000324 vaddr 0x00006000 paddr 0x00006000 align 2**0
-# ELF32-NEXT: filesz 0x00000010 memsz 0x00000010 flags rwx
-# ELF32-NEXT: INTERP off 0x0000031e vaddr 0x00003000 paddr 0x00003000 align 2**0
-# ELF32-NEXT: filesz 0x00000004 memsz 0x00000004 flags rw-
-# ELF32-NEXT: NOTE off 0x00000314 vaddr 0x00001000 paddr 0x00001000 align 2**0
-# ELF32-NEXT: filesz 0x00000003 memsz 0x00000003 flags ---
-# ELF32-NEXT: UNKNOWN off 0x00000314 vaddr 0x00001000 paddr 0x00001000 align 2**0
-# ELF32-NEXT: filesz 0x00000001 memsz 0x00000001 flags ---
-# ELF32-NEXT: TLS off 0x00000322 vaddr 0x00004000 paddr 0x00004000 align 2**0
-# ELF32-NEXT: filesz 0x00000001 memsz 0x00000001 flags ---
-# ELF32-NEXT: UNKNOWN off 0x00000314 vaddr 0x00001000 paddr 0x00001000 align 2**0
-# ELF32-NEXT: filesz 0x00000003 memsz 0x00000003 flags ---
-# ELF32-NEXT:EH_FRAME off 0x00000314 vaddr 0x00001000 paddr 0x00001000 align 2**0
-# ELF32-NEXT: filesz 0x00000003 memsz 0x00000003 flags ---
-# ELF32-NEXT: UNKNOWN off 0x00000314 vaddr 0x00001000 paddr 0x00001000 align 2**0
-# ELF32-NEXT: filesz 0x00000003 memsz 0x00000003 flags ---
-# ELF32-NEXT: STACK off 0x00000314 vaddr 0x00001000 paddr 0x00001000 align 2**0
-# ELF32-NEXT: filesz 0x00000003 memsz 0x00000003 flags ---
-# ELF32-NEXT: RELRO off 0x00000314 vaddr 0x00001000 paddr 0x00001000 align 2**0
-# ELF32-NEXT: filesz 0x00000003 memsz 0x00000003 flags ---
-# ELF32-NEXT:PROPERTY off 0x00000314 vaddr 0x00001000 paddr 0x00001000 align 2**0
-# ELF32-NEXT: filesz 0x00000003 memsz 0x00000003 flags ---
-# ELF32-NEXT: OPENBSD_RANDOMIZE off 0x00000314 vaddr 0x00001000 paddr 0x00001000 align 2**0
-# ELF32-NEXT: filesz 0x00000003 memsz 0x00000003 flags ---
-# ELF32-NEXT: OPENBSD_WXNEEDED off 0x00000314 vaddr 0x00001000 paddr 0x00001000 align 2**0
-# ELF32-NEXT: filesz 0x00000003 memsz 0x00000003 flags ---
-# ELF32-NEXT: OPENBSD_BOOTDATA off 0x00000314 vaddr 0x00001000 paddr 0x00001000 align 2**0
-# ELF32-NEXT: filesz 0x00000003 memsz 0x00000003 flags ---
-# ELF32-NEXT: UNKNOWN off 0x00000314 vaddr 0x00001000 paddr 0x00001000 align 2**0
-# ELF32-NEXT: filesz 0x00000003 memsz 0x00000003 flags ---
-# ELF32-NEXT: UNKNOWN off 0x00000314 vaddr 0x00001000 paddr 0x00001000 align 2**0
-# ELF32-NEXT: filesz 0x00000003 memsz 0x00000003 flags ---
-# ELF32-NEXT: UNKNOWN off 0x00000314 vaddr 0x00001000 paddr 0x00001000 align 2**0
-# ELF32-NEXT: filesz 0x00000003 memsz 0x00000003 flags ---
-# ELF32-NEXT: UNKNOWN off 0x00000314 vaddr 0x00001000 paddr 0x00001000 align 2**0
-# ELF32-NEXT: filesz 0x00000003 memsz 0x00000003 flags ---
-# ELF32-NEXT: UNKNOWN off 0x00000314 vaddr 0x00001000 paddr 0x00001000 align 2**0
-# ELF32-NEXT: filesz 0x00000003 memsz 0x00000003 flags ---
-# ELF32-NEXT: UNKNOWN off 0x00000314 vaddr 0x00001000 paddr 0x00001000 align 2**0
-# ELF32-NEXT: filesz 0x00000003 memsz 0x00000003 flags ---
-# ELF32-EMPTY:
-
-# RUN: yaml2obj --docnum=1 -DBITS=64 -DMACHINE=EM_X86_64 %s -o %t64.elf
-# RUN: llvm-objdump --private-headers %t64.elf | FileCheck %s --check-prefixes=ELF64
-
-# ELF64: Program Header:
-# ELF64-NEXT: PHDR off 0x0000000000000548 vaddr 0x0000000000001000 paddr 0x0000000000001000 align 2**0
-# ELF64-NEXT: filesz 0x0000000000000003 memsz 0x0000000000000003 flags -w-
-# ELF64-NEXT: PHDR off 0x000000000000054b vaddr 0x0000000000002000 paddr 0x0000000000002000 align 2**0
-# ELF64-NEXT: filesz 0x0000000000000007 memsz 0x0000000000000007 flags --x
-# ELF64-NEXT: UNKNOWN off 0x000000000000054b vaddr 0x0000000000002000 paddr 0x0000000000002000 align 2**0
-# ELF64-NEXT: filesz 0x0000000000000007 memsz 0x0000000000000007 flags --x
-# ELF64-NEXT: DYNAMIC off 0x0000000000000558 vaddr 0x0000000000006000 paddr 0x0000000000006000 align 2**0
-# ELF64-NEXT: filesz 0x0000000000000020 memsz 0x0000000000000020 flags rwx
-# ELF64-NEXT: INTERP off 0x0000000000000552 vaddr 0x0000000000003000 paddr 0x0000000000003000 align 2**0
-# ELF64-NEXT: filesz 0x0000000000000004 memsz 0x0000000000000004 flags rw-
-# ELF64-NEXT: NOTE off 0x0000000000000548 vaddr 0x0000000000001000 paddr 0x0000000000001000 align 2**0
-# ELF64-NEXT: filesz 0x0000000000000003 memsz 0x0000000000000003 flags ---
-# ELF64-NEXT: UNKNOWN off 0x0000000000000548 vaddr 0x0000000000001000 paddr 0x0000000000001000 align 2**0
-# ELF64-NEXT: filesz 0x0000000000000001 memsz 0x0000000000000001 flags ---
-# ELF64-NEXT: TLS off 0x0000000000000556 vaddr 0x0000000000004000 paddr 0x0000000000004000 align 2**0
-# ELF64-NEXT: filesz 0x0000000000000001 memsz 0x0000000000000001 flags ---
-# ELF64-NEXT: UNKNOWN off 0x0000000000000548 vaddr 0x0000000000001000 paddr 0x0000000000001000 align 2**0
-# ELF64-NEXT: filesz 0x0000000000000003 memsz 0x0000000000000003 flags ---
-# ELF64-NEXT:EH_FRAME off 0x0000000000000548 vaddr 0x0000000000001000 paddr 0x0000000000001000 align 2**0
-# ELF64-NEXT: filesz 0x0000000000000003 memsz 0x0000000000000003 flags ---
-# ELF64-NEXT: UNKNOWN off 0x0000000000000548 vaddr 0x0000000000001000 paddr 0x0000000000001000 align 2**0
-# ELF64-NEXT: filesz 0x0000000000000003 memsz 0x0000000000000003 flags ---
-# ELF64-NEXT: STACK off 0x0000000000000548 vaddr 0x0000000000001000 paddr 0x0000000000001000 align 2**0
-# ELF64-NEXT: filesz 0x0000000000000003 memsz 0x0000000000000003 flags ---
-# ELF64-NEXT: RELRO off 0x0000000000000548 vaddr 0x0000000000001000 paddr 0x0000000000001000 align 2**0
-# ELF64-NEXT: filesz 0x0000000000000003 memsz 0x0000000000000003 flags ---
-# ELF64-NEXT: PROPERTY off 0x0000000000000548 vaddr 0x0000000000001000 paddr 0x0000000000001000 align 2**0
-# ELF64-NEXT: filesz 0x0000000000000003 memsz 0x0000000000000003 flags ---
-# ELF64-NEXT: OPENBSD_RANDOMIZE off 0x0000000000000548 vaddr 0x0000000000001000 paddr 0x0000000000001000 align 2**0
-# ELF64-NEXT: filesz 0x0000000000000003 memsz 0x0000000000000003 flags ---
-# ELF64-NEXT: OPENBSD_WXNEEDED off 0x0000000000000548 vaddr 0x0000000000001000 paddr 0x0000000000001000 align 2**0
-# ELF64-NEXT: filesz 0x0000000000000003 memsz 0x0000000000000003 flags ---
-# ELF64-NEXT: OPENBSD_BOOTDATA off 0x0000000000000548 vaddr 0x0000000000001000 paddr 0x0000000000001000 align 2**0
-# ELF64-NEXT: filesz 0x0000000000000003 memsz 0x0000000000000003 flags ---
-# ELF64-NEXT: UNKNOWN off 0x0000000000000548 vaddr 0x0000000000001000 paddr 0x0000000000001000 align 2**0
-# ELF64-NEXT: filesz 0x0000000000000003 memsz 0x0000000000000003 flags ---
-# ELF64-NEXT: UNKNOWN off 0x0000000000000548 vaddr 0x0000000000001000 paddr 0x0000000000001000 align 2**0
-# ELF64-NEXT: filesz 0x0000000000000003 memsz 0x0000000000000003 flags ---
-# ELF64-NEXT: UNKNOWN off 0x0000000000000548 vaddr 0x0000000000001000 paddr 0x0000000000001000 align 2**0
-# ELF64-NEXT: filesz 0x0000000000000003 memsz 0x0000000000000003 flags ---
-# ELF64-NEXT: UNKNOWN off 0x0000000000000548 vaddr 0x0000000000001000 paddr 0x0000000000001000 align 2**0
-# ELF64-NEXT: filesz 0x0000000000000003 memsz 0x0000000000000003 flags ---
-# ELF64-NEXT: UNKNOWN off 0x0000000000000548 vaddr 0x0000000000001000 paddr 0x0000000000001000 align 2**0
-# ELF64-NEXT: filesz 0x0000000000000003 memsz 0x0000000000000003 flags ---
-# ELF64-NEXT: UNKNOWN off 0x0000000000000548 vaddr 0x0000000000001000 paddr 0x0000000000001000 align 2**0
-# ELF64-NEXT: filesz 0x0000000000000003 memsz 0x0000000000000003 flags ---
-# ELF64-EMPTY:
-
---- !ELF
-FileHeader:
- Class: ELFCLASS[[BITS]]
- Data: ELFDATA2LSB
- Type: ET_EXEC
- Machine: [[MACHINE]]
-Sections:
- - Name: .foo.begin
- Type: SHT_PROGBITS
- Flags: [ SHF_ALLOC ]
- Address: 0x1000
- Size: 0x1
- - Name: .foo.end
- Type: SHT_PROGBITS
- Flags: [ SHF_ALLOC ]
- Size: 0x2
- - Name: .bar.begin
- Type: SHT_PROGBITS
- Flags: [ SHF_ALLOC ]
- Address: 0x2000
- Size: 0x3
- - Name: .bar.end
- Type: SHT_PROGBITS
- Flags: [ SHF_ALLOC ]
- Size: 0x4
- - Name: .interp
- Type: SHT_PROGBITS
- Flags: [ SHF_ALLOC ]
- Address: 0x3000
- Content: "41424300" ## "ABC"
- - Name: .tls
- Type: SHT_PROGBITS
- Flags: [ SHF_ALLOC, SHF_TLS ]
- Address: 0x4000
- Size: 0x1
- - Name: .unused
- Type: SHT_PROGBITS
- Flags: [ SHF_ALLOC, SHF_TLS ]
- Address: 0x5000
- Size: 0x1
- - Name: .dynamic
- Type: SHT_DYNAMIC
- Flags: [ SHF_ALLOC ]
- Address: 0x6000
- Entries:
- - Tag: DT_NEEDED
- Value: 0x1
- - Tag: DT_NULL
- Value: 0x0
-ProgramHeaders:
-## Case 1: an arbitrary segment with sections.
- - Type: PT_PHDR
- Flags: [ PF_W ]
- VAddr: 0x1000
- FirstSec: .foo.begin
- LastSec: .foo.end
-## Case 2: another segment with
diff erent sections.
- - Type: PT_PHDR
- Flags: [ PF_X ]
- VAddr: 0x2000
- FirstSec: .bar.begin
- LastSec: .bar.end
-## Case 3: the PT_NULL segment.
- - Type: PT_NULL
- Flags: [ PF_X ]
- VAddr: 0x2000
- FirstSec: .bar.begin
- LastSec: .bar.end
-## Case 4: the PT_DYNAMIC segment.
- - Type: PT_DYNAMIC
- Flags: [ PF_R, PF_W, PF_X ]
- VAddr: 0x6000
- FirstSec: .dynamic
- LastSec: .dynamic
-## Case 5: the PT_INTERP segment.
- - Type: PT_INTERP
- Flags: [ PF_R, PF_W ]
- VAddr: 0x3000
- FirstSec: .interp
- LastSec: .interp
-## Case 6: the PT_NOTE segment.
- - Type: PT_NOTE
- VAddr: 0x1000
- FirstSec: .foo.begin
- LastSec: .foo.end
-## Case 7: the PT_SHLIB segment.
- - Type: PT_SHLIB
- VAddr: 0x1000
- FirstSec: .foo.begin
- LastSec: .foo.begin
-## Case 8: the PT_TLS segment.
- - Type: PT_TLS
- VAddr: 0x4000
- FirstSec: .tls
- LastSec: .tls
-## Case 9: the PT_LOOS segment.
- - Type: 0x60000000 ## PT_LOOS
- VAddr: 0x1000
- FirstSec: .foo.begin
- LastSec: .foo.end
-## Case 10: the PT_GNU_EH_FRAME segment.
- - Type: PT_GNU_EH_FRAME
- VAddr: 0x1000
- FirstSec: .foo.begin
- LastSec: .foo.end
-## Case 11: the PT_SUNW_UNWIND segment.
- - Type: 0x6464e550 ## PT_SUNW_UNWIND
- VAddr: 0x1000
- FirstSec: .foo.begin
- LastSec: .foo.end
-## Case 12: the PT_GNU_STACK segment.
- - Type: PT_GNU_STACK
- VAddr: 0x1000
- FirstSec: .foo.begin
- LastSec: .foo.end
-## Case 13: the PT_GNU_RELRO segment.
- - Type: PT_GNU_RELRO
- VAddr: 0x1000
- FirstSec: .foo.begin
- LastSec: .foo.end
-## Case 14: the PT_GNU_PROPERTY segment.
- - Type: PT_GNU_PROPERTY
- VAddr: 0x1000
- FirstSec: .foo.begin
- LastSec: .foo.end
-## Case 15: the PT_OPENBSD_RANDOMIZE segment.
- - Type: 0x65a3dbe6 ## PT_OPENBSD_RANDOMIZE
- VAddr: 0x1000
- FirstSec: .foo.begin
- LastSec: .foo.end
-## Case 16: the PT_OPENBSD_WXNEEDED segment.
- - Type: 0x65a3dbe7 ## PT_OPENBSD_WXNEEDED
- VAddr: 0x1000
- FirstSec: .foo.begin
- LastSec: .foo.end
-## Case 17: the PT_OPENBSD_BOOTDATA segment.
- - Type: 0x65a41be6 ## PT_OPENBSD_BOOTDATA
- VAddr: 0x1000
- FirstSec: .foo.begin
- LastSec: .foo.end
-## Case 18: the PT_HIOS segment.
- - Type: 0x6fffffff ## PT_HIOS
- VAddr: 0x1000
- FirstSec: .foo.begin
- LastSec: .foo.end
-## Case 19: the PT_LOPROC/PT_ARM_ARCHEXT/PT_MIPS_REGINFO segment.
- - Type: 0x70000000 ## PT_LOPROC/PT_ARM_ARCHEXT/PT_MIPS_REGINFO
- VAddr: 0x1000
- FirstSec: .foo.begin
- LastSec: .foo.end
-## Case 20: the PT_ARM_EXIDX/PT_MIPS_RTPROC segment.
- - Type: 0x70000001 ## PT_ARM_EXIDX, PT_MIPS_RTPROC
- VAddr: 0x1000
- FirstSec: .foo.begin
- LastSec: .foo.end
-## Case 20: the PT_MIPS_OPTIONS segment.
- - Type: 0x70000002 ## PT_MIPS_OPTIONS
- VAddr: 0x1000
- FirstSec: .foo.begin
- LastSec: .foo.end
-## Case 21: the PT_MIPS_ABIFLAGS segment.
- - Type: 0x70000003 ## PT_MIPS_ABIFLAGS
- VAddr: 0x1000
- FirstSec: .foo.begin
- LastSec: .foo.end
-## Case 22: the PT_HIPROC segment.
- - Type: 0x7fffffff ## PT_HIPROC
- VAddr: 0x1000
- FirstSec: .foo.begin
- LastSec: .foo.end
-
-## Check we report an error / warning when we are unable to read program headers.
-## Case A: the e_phentsize field is invalid.
-# RUN: yaml2obj --docnum=2 -DPHENTSIZE=1 %s -o %t.phdr.err
-# RUN: not llvm-objdump --private-headers %t.phdr.err 2>&1 | \
-# RUN: FileCheck %s -DFILE=%t.phdr.err --check-prefix=PHENTSIZE
-
-# PHENTSIZE: Program Header:
-# PHENTSIZE-NEXT: warning: '[[FILE]]': unable to read program headers: invalid e_phentsize: 1
-# PHENTSIZE-NEXT: error: '[[FILE]]': invalid e_phentsize: 1
-
---- !ELF
-FileHeader:
- Class: ELFCLASS64
- Data: ELFDATA2LSB
- Type: ET_EXEC
- EPhEntSize: [[PHENTSIZE=<none>]]
- EPhOff: [[PHOFF=<none>]]
-Sections:
- - Name: .foo
- Type: SHT_PROGBITS
-ProgramHeaders:
- - Type: PT_PHDR
- FirstSec: .foo
- LastSec: .foo
-
-## Case B: the value of the e_phoff field is invalid.
-
-## Check that we do not report a warning when the program header table ends right before the end of the file.
-## 0x160 + size of headers (56) == file size.
-# RUN: yaml2obj --docnum=2 -DPHOFF=0x160 %s -o %t.phdr.no.err2
-# RUN: llvm-objdump %t.phdr.no.err2 --private-headers 2>&1 | FileCheck %s --implicit-check-not=warning:
-
-## Check we report a warning / error when e_phoff goes 1 byte past the end of the file.
-# RUN: yaml2obj --docnum=2 -DPHOFF=0x161 %s -o %t.phdr.err2
-# RUN: not llvm-objdump --private-headers %t.phdr.err2 2>&1 | \
-# RUN: FileCheck %s -DFILE=%t.phdr.err2 --check-prefix=PHOFF -DOFF=0x161
-
-# PHOFF: Program Header:
-# PHOFF-NEXT: warning: '[[FILE]]': unable to read program headers: program headers are longer than binary of size 408: e_phoff = [[OFF]], e_phnum = 1, e_phentsize = 56
-# PHOFF-NEXT: error: '[[FILE]]': program headers are longer than binary of size 408: e_phoff = [[OFF]], e_phnum = 1, e_phentsize = 56
-
-
-## Check we report a warning / error when the value of e_phoff is so large that
-## e_phoff + e_phnum * e_phentsize > UINT64_MAX.
-# RUN: yaml2obj --docnum=2 -DPHOFF=0xffffffffffffffff %s -o %t.phdr.err3
-# RUN: not llvm-objdump --private-headers %t.phdr.err3 2>&1 | \
-# RUN: FileCheck %s -DFILE=%t.phdr.err3 --check-prefix=PHOFF -DOFF=0xffffffffffffffff
+## Check that program headers are output correctly
+
+# RUN: yaml2obj --docnum=1 -DBITS=32 -DMACHINE=EM_386 %s -o %t32.elf
+# RUN: llvm-objdump --private-headers %t32.elf | FileCheck %s --check-prefixes=ELF32
+
+# ELF32: Program Header:
+# ELF32-NEXT: PHDR off 0x00000314 vaddr 0x00001000 paddr 0x00001000 align 2**0
+# ELF32-NEXT: filesz 0x00000003 memsz 0x00000003 flags -w-
+# ELF32-NEXT: PHDR off 0x00000317 vaddr 0x00002000 paddr 0x00002000 align 2**0
+# ELF32-NEXT: filesz 0x00000007 memsz 0x00000007 flags --x
+# ELF32-NEXT: UNKNOWN off 0x00000317 vaddr 0x00002000 paddr 0x00002000 align 2**0
+# ELF32-NEXT: filesz 0x00000007 memsz 0x00000007 flags --x
+# ELF32-NEXT: DYNAMIC off 0x00000324 vaddr 0x00006000 paddr 0x00006000 align 2**0
+# ELF32-NEXT: filesz 0x00000010 memsz 0x00000010 flags rwx
+# ELF32-NEXT: INTERP off 0x0000031e vaddr 0x00003000 paddr 0x00003000 align 2**0
+# ELF32-NEXT: filesz 0x00000004 memsz 0x00000004 flags rw-
+# ELF32-NEXT: NOTE off 0x00000314 vaddr 0x00001000 paddr 0x00001000 align 2**0
+# ELF32-NEXT: filesz 0x00000003 memsz 0x00000003 flags ---
+# ELF32-NEXT: UNKNOWN off 0x00000314 vaddr 0x00001000 paddr 0x00001000 align 2**0
+# ELF32-NEXT: filesz 0x00000001 memsz 0x00000001 flags ---
+# ELF32-NEXT: TLS off 0x00000322 vaddr 0x00004000 paddr 0x00004000 align 2**0
+# ELF32-NEXT: filesz 0x00000001 memsz 0x00000001 flags ---
+# ELF32-NEXT: UNKNOWN off 0x00000314 vaddr 0x00001000 paddr 0x00001000 align 2**0
+# ELF32-NEXT: filesz 0x00000003 memsz 0x00000003 flags ---
+# ELF32-NEXT:EH_FRAME off 0x00000314 vaddr 0x00001000 paddr 0x00001000 align 2**0
+# ELF32-NEXT: filesz 0x00000003 memsz 0x00000003 flags ---
+# ELF32-NEXT: UNKNOWN off 0x00000314 vaddr 0x00001000 paddr 0x00001000 align 2**0
+# ELF32-NEXT: filesz 0x00000003 memsz 0x00000003 flags ---
+# ELF32-NEXT: STACK off 0x00000314 vaddr 0x00001000 paddr 0x00001000 align 2**0
+# ELF32-NEXT: filesz 0x00000003 memsz 0x00000003 flags ---
+# ELF32-NEXT: RELRO off 0x00000314 vaddr 0x00001000 paddr 0x00001000 align 2**0
+# ELF32-NEXT: filesz 0x00000003 memsz 0x00000003 flags ---
+# ELF32-NEXT:PROPERTY off 0x00000314 vaddr 0x00001000 paddr 0x00001000 align 2**0
+# ELF32-NEXT: filesz 0x00000003 memsz 0x00000003 flags ---
+# ELF32-NEXT: OPENBSD_RANDOMIZE off 0x00000314 vaddr 0x00001000 paddr 0x00001000 align 2**0
+# ELF32-NEXT: filesz 0x00000003 memsz 0x00000003 flags ---
+# ELF32-NEXT: OPENBSD_WXNEEDED off 0x00000314 vaddr 0x00001000 paddr 0x00001000 align 2**0
+# ELF32-NEXT: filesz 0x00000003 memsz 0x00000003 flags ---
+# ELF32-NEXT: OPENBSD_BOOTDATA off 0x00000314 vaddr 0x00001000 paddr 0x00001000 align 2**0
+# ELF32-NEXT: filesz 0x00000003 memsz 0x00000003 flags ---
+# ELF32-NEXT: UNKNOWN off 0x00000314 vaddr 0x00001000 paddr 0x00001000 align 2**0
+# ELF32-NEXT: filesz 0x00000003 memsz 0x00000003 flags ---
+# ELF32-NEXT: UNKNOWN off 0x00000314 vaddr 0x00001000 paddr 0x00001000 align 2**0
+# ELF32-NEXT: filesz 0x00000003 memsz 0x00000003 flags ---
+# ELF32-NEXT: UNKNOWN off 0x00000314 vaddr 0x00001000 paddr 0x00001000 align 2**0
+# ELF32-NEXT: filesz 0x00000003 memsz 0x00000003 flags ---
+# ELF32-NEXT: UNKNOWN off 0x00000314 vaddr 0x00001000 paddr 0x00001000 align 2**0
+# ELF32-NEXT: filesz 0x00000003 memsz 0x00000003 flags ---
+# ELF32-NEXT: UNKNOWN off 0x00000314 vaddr 0x00001000 paddr 0x00001000 align 2**0
+# ELF32-NEXT: filesz 0x00000003 memsz 0x00000003 flags ---
+# ELF32-NEXT: UNKNOWN off 0x00000314 vaddr 0x00001000 paddr 0x00001000 align 2**0
+# ELF32-NEXT: filesz 0x00000003 memsz 0x00000003 flags ---
+# ELF32-EMPTY:
+
+# RUN: yaml2obj --docnum=1 -DBITS=64 -DMACHINE=EM_X86_64 %s -o %t64.elf
+# RUN: llvm-objdump --private-headers %t64.elf | FileCheck %s --check-prefixes=ELF64
+
+# ELF64: Program Header:
+# ELF64-NEXT: PHDR off 0x0000000000000548 vaddr 0x0000000000001000 paddr 0x0000000000001000 align 2**0
+# ELF64-NEXT: filesz 0x0000000000000003 memsz 0x0000000000000003 flags -w-
+# ELF64-NEXT: PHDR off 0x000000000000054b vaddr 0x0000000000002000 paddr 0x0000000000002000 align 2**0
+# ELF64-NEXT: filesz 0x0000000000000007 memsz 0x0000000000000007 flags --x
+# ELF64-NEXT: UNKNOWN off 0x000000000000054b vaddr 0x0000000000002000 paddr 0x0000000000002000 align 2**0
+# ELF64-NEXT: filesz 0x0000000000000007 memsz 0x0000000000000007 flags --x
+# ELF64-NEXT: DYNAMIC off 0x0000000000000558 vaddr 0x0000000000006000 paddr 0x0000000000006000 align 2**0
+# ELF64-NEXT: filesz 0x0000000000000020 memsz 0x0000000000000020 flags rwx
+# ELF64-NEXT: INTERP off 0x0000000000000552 vaddr 0x0000000000003000 paddr 0x0000000000003000 align 2**0
+# ELF64-NEXT: filesz 0x0000000000000004 memsz 0x0000000000000004 flags rw-
+# ELF64-NEXT: NOTE off 0x0000000000000548 vaddr 0x0000000000001000 paddr 0x0000000000001000 align 2**0
+# ELF64-NEXT: filesz 0x0000000000000003 memsz 0x0000000000000003 flags ---
+# ELF64-NEXT: UNKNOWN off 0x0000000000000548 vaddr 0x0000000000001000 paddr 0x0000000000001000 align 2**0
+# ELF64-NEXT: filesz 0x0000000000000001 memsz 0x0000000000000001 flags ---
+# ELF64-NEXT: TLS off 0x0000000000000556 vaddr 0x0000000000004000 paddr 0x0000000000004000 align 2**0
+# ELF64-NEXT: filesz 0x0000000000000001 memsz 0x0000000000000001 flags ---
+# ELF64-NEXT: UNKNOWN off 0x0000000000000548 vaddr 0x0000000000001000 paddr 0x0000000000001000 align 2**0
+# ELF64-NEXT: filesz 0x0000000000000003 memsz 0x0000000000000003 flags ---
+# ELF64-NEXT:EH_FRAME off 0x0000000000000548 vaddr 0x0000000000001000 paddr 0x0000000000001000 align 2**0
+# ELF64-NEXT: filesz 0x0000000000000003 memsz 0x0000000000000003 flags ---
+# ELF64-NEXT: UNKNOWN off 0x0000000000000548 vaddr 0x0000000000001000 paddr 0x0000000000001000 align 2**0
+# ELF64-NEXT: filesz 0x0000000000000003 memsz 0x0000000000000003 flags ---
+# ELF64-NEXT: STACK off 0x0000000000000548 vaddr 0x0000000000001000 paddr 0x0000000000001000 align 2**0
+# ELF64-NEXT: filesz 0x0000000000000003 memsz 0x0000000000000003 flags ---
+# ELF64-NEXT: RELRO off 0x0000000000000548 vaddr 0x0000000000001000 paddr 0x0000000000001000 align 2**0
+# ELF64-NEXT: filesz 0x0000000000000003 memsz 0x0000000000000003 flags ---
+# ELF64-NEXT: PROPERTY off 0x0000000000000548 vaddr 0x0000000000001000 paddr 0x0000000000001000 align 2**0
+# ELF64-NEXT: filesz 0x0000000000000003 memsz 0x0000000000000003 flags ---
+# ELF64-NEXT: OPENBSD_RANDOMIZE off 0x0000000000000548 vaddr 0x0000000000001000 paddr 0x0000000000001000 align 2**0
+# ELF64-NEXT: filesz 0x0000000000000003 memsz 0x0000000000000003 flags ---
+# ELF64-NEXT: OPENBSD_WXNEEDED off 0x0000000000000548 vaddr 0x0000000000001000 paddr 0x0000000000001000 align 2**0
+# ELF64-NEXT: filesz 0x0000000000000003 memsz 0x0000000000000003 flags ---
+# ELF64-NEXT: OPENBSD_BOOTDATA off 0x0000000000000548 vaddr 0x0000000000001000 paddr 0x0000000000001000 align 2**0
+# ELF64-NEXT: filesz 0x0000000000000003 memsz 0x0000000000000003 flags ---
+# ELF64-NEXT: UNKNOWN off 0x0000000000000548 vaddr 0x0000000000001000 paddr 0x0000000000001000 align 2**0
+# ELF64-NEXT: filesz 0x0000000000000003 memsz 0x0000000000000003 flags ---
+# ELF64-NEXT: UNKNOWN off 0x0000000000000548 vaddr 0x0000000000001000 paddr 0x0000000000001000 align 2**0
+# ELF64-NEXT: filesz 0x0000000000000003 memsz 0x0000000000000003 flags ---
+# ELF64-NEXT: UNKNOWN off 0x0000000000000548 vaddr 0x0000000000001000 paddr 0x0000000000001000 align 2**0
+# ELF64-NEXT: filesz 0x0000000000000003 memsz 0x0000000000000003 flags ---
+# ELF64-NEXT: UNKNOWN off 0x0000000000000548 vaddr 0x0000000000001000 paddr 0x0000000000001000 align 2**0
+# ELF64-NEXT: filesz 0x0000000000000003 memsz 0x0000000000000003 flags ---
+# ELF64-NEXT: UNKNOWN off 0x0000000000000548 vaddr 0x0000000000001000 paddr 0x0000000000001000 align 2**0
+# ELF64-NEXT: filesz 0x0000000000000003 memsz 0x0000000000000003 flags ---
+# ELF64-NEXT: UNKNOWN off 0x0000000000000548 vaddr 0x0000000000001000 paddr 0x0000000000001000 align 2**0
+# ELF64-NEXT: filesz 0x0000000000000003 memsz 0x0000000000000003 flags ---
+# ELF64-EMPTY:
+
+--- !ELF
+FileHeader:
+ Class: ELFCLASS[[BITS]]
+ Data: ELFDATA2LSB
+ Type: ET_EXEC
+ Machine: [[MACHINE]]
+Sections:
+ - Name: .foo.begin
+ Type: SHT_PROGBITS
+ Flags: [ SHF_ALLOC ]
+ Address: 0x1000
+ Size: 0x1
+ - Name: .foo.end
+ Type: SHT_PROGBITS
+ Flags: [ SHF_ALLOC ]
+ Size: 0x2
+ - Name: .bar.begin
+ Type: SHT_PROGBITS
+ Flags: [ SHF_ALLOC ]
+ Address: 0x2000
+ Size: 0x3
+ - Name: .bar.end
+ Type: SHT_PROGBITS
+ Flags: [ SHF_ALLOC ]
+ Size: 0x4
+ - Name: .interp
+ Type: SHT_PROGBITS
+ Flags: [ SHF_ALLOC ]
+ Address: 0x3000
+ Content: "41424300" ## "ABC"
+ - Name: .tls
+ Type: SHT_PROGBITS
+ Flags: [ SHF_ALLOC, SHF_TLS ]
+ Address: 0x4000
+ Size: 0x1
+ - Name: .unused
+ Type: SHT_PROGBITS
+ Flags: [ SHF_ALLOC, SHF_TLS ]
+ Address: 0x5000
+ Size: 0x1
+ - Name: .dynamic
+ Type: SHT_DYNAMIC
+ Flags: [ SHF_ALLOC ]
+ Address: 0x6000
+ Entries:
+ - Tag: DT_NEEDED
+ Value: 0x1
+ - Tag: DT_NULL
+ Value: 0x0
+ProgramHeaders:
+## Case 1: an arbitrary segment with sections.
+ - Type: PT_PHDR
+ Flags: [ PF_W ]
+ VAddr: 0x1000
+ FirstSec: .foo.begin
+ LastSec: .foo.end
+## Case 2: another segment with
diff erent sections.
+ - Type: PT_PHDR
+ Flags: [ PF_X ]
+ VAddr: 0x2000
+ FirstSec: .bar.begin
+ LastSec: .bar.end
+## Case 3: the PT_NULL segment.
+ - Type: PT_NULL
+ Flags: [ PF_X ]
+ VAddr: 0x2000
+ FirstSec: .bar.begin
+ LastSec: .bar.end
+## Case 4: the PT_DYNAMIC segment.
+ - Type: PT_DYNAMIC
+ Flags: [ PF_R, PF_W, PF_X ]
+ VAddr: 0x6000
+ FirstSec: .dynamic
+ LastSec: .dynamic
+## Case 5: the PT_INTERP segment.
+ - Type: PT_INTERP
+ Flags: [ PF_R, PF_W ]
+ VAddr: 0x3000
+ FirstSec: .interp
+ LastSec: .interp
+## Case 6: the PT_NOTE segment.
+ - Type: PT_NOTE
+ VAddr: 0x1000
+ FirstSec: .foo.begin
+ LastSec: .foo.end
+## Case 7: the PT_SHLIB segment.
+ - Type: PT_SHLIB
+ VAddr: 0x1000
+ FirstSec: .foo.begin
+ LastSec: .foo.begin
+## Case 8: the PT_TLS segment.
+ - Type: PT_TLS
+ VAddr: 0x4000
+ FirstSec: .tls
+ LastSec: .tls
+## Case 9: the PT_LOOS segment.
+ - Type: 0x60000000 ## PT_LOOS
+ VAddr: 0x1000
+ FirstSec: .foo.begin
+ LastSec: .foo.end
+## Case 10: the PT_GNU_EH_FRAME segment.
+ - Type: PT_GNU_EH_FRAME
+ VAddr: 0x1000
+ FirstSec: .foo.begin
+ LastSec: .foo.end
+## Case 11: the PT_SUNW_UNWIND segment.
+ - Type: 0x6464e550 ## PT_SUNW_UNWIND
+ VAddr: 0x1000
+ FirstSec: .foo.begin
+ LastSec: .foo.end
+## Case 12: the PT_GNU_STACK segment.
+ - Type: PT_GNU_STACK
+ VAddr: 0x1000
+ FirstSec: .foo.begin
+ LastSec: .foo.end
+## Case 13: the PT_GNU_RELRO segment.
+ - Type: PT_GNU_RELRO
+ VAddr: 0x1000
+ FirstSec: .foo.begin
+ LastSec: .foo.end
+## Case 14: the PT_GNU_PROPERTY segment.
+ - Type: PT_GNU_PROPERTY
+ VAddr: 0x1000
+ FirstSec: .foo.begin
+ LastSec: .foo.end
+## Case 15: the PT_OPENBSD_RANDOMIZE segment.
+ - Type: 0x65a3dbe6 ## PT_OPENBSD_RANDOMIZE
+ VAddr: 0x1000
+ FirstSec: .foo.begin
+ LastSec: .foo.end
+## Case 16: the PT_OPENBSD_WXNEEDED segment.
+ - Type: 0x65a3dbe7 ## PT_OPENBSD_WXNEEDED
+ VAddr: 0x1000
+ FirstSec: .foo.begin
+ LastSec: .foo.end
+## Case 17: the PT_OPENBSD_BOOTDATA segment.
+ - Type: 0x65a41be6 ## PT_OPENBSD_BOOTDATA
+ VAddr: 0x1000
+ FirstSec: .foo.begin
+ LastSec: .foo.end
+## Case 18: the PT_HIOS segment.
+ - Type: 0x6fffffff ## PT_HIOS
+ VAddr: 0x1000
+ FirstSec: .foo.begin
+ LastSec: .foo.end
+## Case 19: the PT_LOPROC/PT_ARM_ARCHEXT/PT_MIPS_REGINFO segment.
+ - Type: 0x70000000 ## PT_LOPROC/PT_ARM_ARCHEXT/PT_MIPS_REGINFO
+ VAddr: 0x1000
+ FirstSec: .foo.begin
+ LastSec: .foo.end
+## Case 20: the PT_ARM_EXIDX/PT_MIPS_RTPROC segment.
+ - Type: 0x70000001 ## PT_ARM_EXIDX, PT_MIPS_RTPROC
+ VAddr: 0x1000
+ FirstSec: .foo.begin
+ LastSec: .foo.end
+## Case 20: the PT_MIPS_OPTIONS segment.
+ - Type: 0x70000002 ## PT_MIPS_OPTIONS
+ VAddr: 0x1000
+ FirstSec: .foo.begin
+ LastSec: .foo.end
+## Case 21: the PT_MIPS_ABIFLAGS segment.
+ - Type: 0x70000003 ## PT_MIPS_ABIFLAGS
+ VAddr: 0x1000
+ FirstSec: .foo.begin
+ LastSec: .foo.end
+## Case 22: the PT_HIPROC segment.
+ - Type: 0x7fffffff ## PT_HIPROC
+ VAddr: 0x1000
+ FirstSec: .foo.begin
+ LastSec: .foo.end
+
+## Check we report an error / warning when we are unable to read program headers.
+## Case A: the e_phentsize field is invalid.
+# RUN: yaml2obj --docnum=2 -DPHENTSIZE=1 %s -o %t.phdr.err
+# RUN: not llvm-objdump --private-headers %t.phdr.err 2>&1 | \
+# RUN: FileCheck %s -DFILE=%t.phdr.err --check-prefix=PHENTSIZE
+
+# PHENTSIZE: Program Header:
+# PHENTSIZE-NEXT: warning: '[[FILE]]': unable to read program headers: invalid e_phentsize: 1
+# PHENTSIZE-NEXT: error: '[[FILE]]': invalid e_phentsize: 1
+
+--- !ELF
+FileHeader:
+ Class: ELFCLASS64
+ Data: ELFDATA2LSB
+ Type: ET_EXEC
+ EPhEntSize: [[PHENTSIZE=<none>]]
+ EPhOff: [[PHOFF=<none>]]
+Sections:
+ - Name: .foo
+ Type: SHT_PROGBITS
+ProgramHeaders:
+ - Type: PT_PHDR
+ FirstSec: .foo
+ LastSec: .foo
+
+## Case B: the value of the e_phoff field is invalid.
+
+## Check that we do not report a warning when the program header table ends right before the end of the file.
+## 0x160 + size of headers (56) == file size.
+# RUN: yaml2obj --docnum=2 -DPHOFF=0x160 %s -o %t.phdr.no.err2
+# RUN: llvm-objdump %t.phdr.no.err2 --private-headers 2>&1 | FileCheck %s --implicit-check-not=warning:
+
+## Check we report a warning / error when e_phoff goes 1 byte past the end of the file.
+# RUN: yaml2obj --docnum=2 -DPHOFF=0x161 %s -o %t.phdr.err2
+# RUN: not llvm-objdump --private-headers %t.phdr.err2 2>&1 | \
+# RUN: FileCheck %s -DFILE=%t.phdr.err2 --check-prefix=PHOFF -DOFF=0x161
+
+# PHOFF: Program Header:
+# PHOFF-NEXT: warning: '[[FILE]]': unable to read program headers: program headers are longer than binary of size 408: e_phoff = [[OFF]], e_phnum = 1, e_phentsize = 56
+# PHOFF-NEXT: error: '[[FILE]]': program headers are longer than binary of size 408: e_phoff = [[OFF]], e_phnum = 1, e_phentsize = 56
+
+
+## Check we report a warning / error when the value of e_phoff is so large that
+## e_phoff + e_phnum * e_phentsize > UINT64_MAX.
+# RUN: yaml2obj --docnum=2 -DPHOFF=0xffffffffffffffff %s -o %t.phdr.err3
+# RUN: not llvm-objdump --private-headers %t.phdr.err3 2>&1 | \
+# RUN: FileCheck %s -DFILE=%t.phdr.err3 --check-prefix=PHOFF -DOFF=0xffffffffffffffff
More information about the llvm-commits
mailing list