RUN: lld -flavor gnu -target hexagon -static -emit-yaml %p/Inputs/branch-test.hexagon %p/Inputs/target-test.hexagon | FileCheck %s -check-prefix hexagon-yaml
RUN: lld -flavor gnu -target hexagon -e target -o %t1 %p/Inputs/branch-test.hexagon %p/Inputs/target-test.hexagon
-RUN: elf-dump %t1 | FileCheck -check-prefix=hexagon-elfdump %s
+RUN: llvm-readobj -h %t1 | FileCheck -check-prefix=hexagon-readobj %s
hexagon-yaml: - name: back
hexagon-yaml: scope: global
hexagon-yaml: target: back
-hexagon-elfdump: ('e_indent[EI_CLASS]', 0x01)
-hexagon-elfdump: ('e_indent[EI_DATA]', 0x01)
-hexagon-elfdump: ('e_indent[EI_VERSION]', 0x01)
-hexagon-elfdump: ('e_indent[EI_OSABI]', 0x00)
-hexagon-elfdump: ('e_indent[EI_ABIVERSION]', 0x00)
-hexagon-elfdump: ('e_type', 0x0002)
-hexagon-elfdump: ('e_machine', 0x00a4)
+hexagon-readobj: ElfHeader {
+hexagon-readobj: Ident {
+hexagon-readobj: Class: 32-bit (0x1)
+hexagon-readobj: DataEncoding: LittleEndian (0x1)
+hexagon-readobj: FileVersion: 1
+hexagon-readobj: OS/ABI: SystemV (0x0)
+hexagon-readobj: ABIVersion: 0
+hexagon-readobj: }
+hexagon-readobj: Type: Executable (0x2)
+hexagon-readobj: Machine: EM_HEXAGON (0xA4)
RUN: lld -flavor gnu -target i386-linux -o %t1 -e main %p/Inputs/phdr.i386 \
-RUN: | elf-dump %t1 | FileCheck -check-prefix=ED %s
+RUN: && llvm-readobj -program-headers %t1 | FileCheck -check-prefix=I386 %s
RUN: lld -flavor gnu -target x86_64-linux -o %t1 -e _start %p/Inputs/relocs.x86-64 -static \
RUN: && llvm-objdump -p %t1 | FileCheck %s -check-prefix=X86_64
-ED: # Program Header 0
-ED: (('p_type', 0x00000006)
-ED: ('p_flags', 0x00000005)
-ED: ('p_offset', 0x00000034)
-ED: ('p_vaddr', 0x00000034)
-ED: ('p_paddr', 0x00000034)
-ED: ('p_filesz', 0x000000c0)
-ED: ('p_memsz', 0x000000c0)
-ED: ('p_align', 0x00000008)
-ED: ),
-ED: # Program Header 1
-ED: (('p_type', 0x00000003)
-ED: ('p_flags', 0x00000004)
-ED: ('p_offset', 0x000000f4)
-ED: ('p_vaddr', 0x000000f4)
-ED: ('p_paddr', 0x000000f4)
-ED: ('p_filesz', 0x0000001c)
-ED: ('p_memsz', 0x0000001c)
-ED: ('p_align', 0x00000001)
-ED: ),
-ED: # Program Header 2
-ED: (('p_type', 0x00000001)
-ED: ('p_flags', 0x00000005)
-ED: ('p_offset', 0x00000000)
-ED: ('p_vaddr', 0x00000000)
-ED: ('p_paddr', 0x00000000)
-ED: ('p_filesz', 0x00000214)
-ED: ('p_memsz', 0x00000214)
-ED: ('p_align', 0x00001000)
-ED: ),
-ED: # Program Header 3
-ED: (('p_type', 0x00000001)
-ED: ('p_flags', 0x00000006)
-ED: ('p_offset', 0x00001000)
-ED: ('p_vaddr', 0x00001000)
-ED: ('p_paddr', 0x00001000)
-ED: ('p_filesz', 0x00000104)
-ED: ('p_memsz', 0x00000004)
-ED: ('p_align', 0x00001000)
-ED: ),
-ED: # Program Header 4
-ED: (('p_type', 0x00000001)
-ED: ('p_flags', 0x00000006)
-ED: ('p_offset', 0x00004000)
-ED: ('p_vaddr', 0x00004000)
-ED: ('p_paddr', 0x00004000)
-ED: ('p_filesz', 0x00000004)
-ED: ('p_memsz', 0x00004008)
-ED: ('p_align', 0x00001000)
-ED: ),
-ED: # Program Header 5
-ED: (('p_type', 0x00000002)
-ED: ('p_flags', 0x00000004)
-ED: ('p_offset', 0x000001e4)
-ED: ('p_vaddr', 0x000001e4)
-ED: ('p_paddr', 0x000001e4)
-ED: ('p_filesz', 0x00000030)
-ED: ('p_memsz', 0x00000030)
-ED: ('p_align', 0x00000004)
-ED: ),
+I386: ProgramHeaders [
+I386-NEXT: ProgramHeader {
+I386-NEXT: Type: PT_PHDR (0x6)
+I386-NEXT: Offset: 0x34
+I386-NEXT: VirtualAddress: 0x34
+I386-NEXT: PhysicalAddress: 0x34
+I386-NEXT: FileSize: 192
+I386-NEXT: MemSize: 192
+I386-NEXT: Flags [ (0x5)
+I386-NEXT: PF_R (0x4)
+I386-NEXT: PF_X (0x1)
+I386-NEXT: ]
+I386-NEXT: Alignment: 8
+I386-NEXT: }
+I386-NEXT: ProgramHeader {
+I386-NEXT: Type: PT_INTERP (0x3)
+I386-NEXT: Offset: 0xF4
+I386-NEXT: VirtualAddress: 0xF4
+I386-NEXT: PhysicalAddress: 0xF4
+I386-NEXT: FileSize: 28
+I386-NEXT: MemSize: 28
+I386-NEXT: Flags [ (0x4)
+I386-NEXT: PF_R (0x4)
+I386-NEXT: ]
+I386-NEXT: Alignment: 1
+I386-NEXT: }
+I386-NEXT: ProgramHeader {
+I386-NEXT: Type: PT_LOAD (0x1)
+I386-NEXT: Offset: 0x0
+I386-NEXT: VirtualAddress: 0x0
+I386-NEXT: PhysicalAddress: 0x0
+I386-NEXT: FileSize: 532
+I386-NEXT: MemSize: 532
+I386-NEXT: Flags [ (0x5)
+I386-NEXT: PF_R (0x4)
+I386-NEXT: PF_X (0x1)
+I386-NEXT: ]
+I386-NEXT: Alignment: 4096
+I386-NEXT: }
+I386-NEXT: ProgramHeader {
+I386-NEXT: Type: PT_LOAD (0x1)
+I386-NEXT: Offset: 0x1000
+I386-NEXT: VirtualAddress: 0x1000
+I386-NEXT: PhysicalAddress: 0x1000
+I386-NEXT: FileSize: 260
+I386-NEXT: MemSize: 4
+I386-NEXT: Flags [ (0x6)
+I386-NEXT: PF_R (0x4)
+I386-NEXT: PF_W (0x2)
+I386-NEXT: ]
+I386-NEXT: Alignment: 4096
+I386-NEXT: }
+I386-NEXT: ProgramHeader {
+I386-NEXT: Type: PT_LOAD (0x1)
+I386-NEXT: Offset: 0x4000
+I386-NEXT: VirtualAddress: 0x4000
+I386-NEXT: PhysicalAddress: 0x4000
+I386-NEXT: FileSize: 4
+I386-NEXT: MemSize: 16392
+I386-NEXT: Flags [ (0x6)
+I386-NEXT: PF_R (0x4)
+I386-NEXT: PF_W (0x2)
+I386-NEXT: ]
+I386-NEXT: Alignment: 4096
+I386-NEXT: }
+I386-NEXT: ProgramHeader {
+I386-NEXT: Type: PT_DYNAMIC (0x2)
+I386-NEXT: Offset: 0x1E4
+I386-NEXT: VirtualAddress: 0x1E4
+I386-NEXT: PhysicalAddress: 0x1E4
+I386-NEXT: FileSize: 48
+I386-NEXT: MemSize: 48
+I386-NEXT: Flags [ (0x4)
+I386-NEXT: PF_R (0x4)
+I386-NEXT: ]
+I386-NEXT: Alignment: 4
+I386-NEXT: }
X86_64: LOAD off 0x0000000000000000
X86_64: LOAD off 0x0000000000001000