mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-14 11:32:34 +00:00
76e70f340c
ELF with support for: - File headers - Section headers + data - Relocations - Symbols - Unwind data (only COFF/Win64) The output format follows a few rules: - Values are almost always output one per line (as elf-dump/coff-dump already do). - Many values are translated to something readable (like enum names), with the raw value in parentheses. - Hex numbers are output in uppercase, prefixed with "0x". - Flags are sorted alphabetically. - Lists and groups are always delimited. Example output: ---------- snip ---------- Sections [ Section { Index: 1 Name: .text (5) Type: SHT_PROGBITS (0x1) Flags [ (0x6) SHF_ALLOC (0x2) SHF_EXECINSTR (0x4) ] Address: 0x0 Offset: 0x40 Size: 33 Link: 0 Info: 0 AddressAlignment: 16 EntrySize: 0 Relocations [ 0x6 R_386_32 .rodata.str1.1 0x0 0xB R_386_PC32 puts 0x0 0x12 R_386_32 .rodata.str1.1 0x0 0x17 R_386_PC32 puts 0x0 ] SectionData ( 0000: 83EC04C7 04240000 0000E8FC FFFFFFC7 |.....$..........| 0010: 04240600 0000E8FC FFFFFF31 C083C404 |.$.........1....| 0020: C3 |.| ) } ] ---------- snip ---------- Relocations and symbols can be output standalone or together with the section header as displayed in the example. This feature set supports all tests in test/MC/COFF and test/MC/ELF (and I suspect all additional tests using elf-dump), making elf-dump and coff-dump deprecated. Patch by Nico Rieck! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@178679 91177308-0d34-0410-b5e6-96231b3b80d8
101 lines
3.3 KiB
Plaintext
101 lines
3.3 KiB
Plaintext
RUN: llvm-readobj -h %p/Inputs/trivial.obj.coff-i386 \
|
|
RUN: | FileCheck %s -check-prefix COFF32
|
|
RUN: llvm-readobj -h %p/Inputs/trivial.obj.coff-x86-64 \
|
|
RUN: | FileCheck %s -check-prefix COFF64
|
|
RUN: llvm-readobj -h %p/Inputs/trivial.obj.elf-i386 \
|
|
RUN: | FileCheck %s -check-prefix ELF32
|
|
RUN: llvm-readobj -h %p/Inputs/trivial.obj.elf-x86-64 \
|
|
RUN: | FileCheck %s -check-prefix ELF64
|
|
|
|
COFF32: File: {{(.*[/\\])?}}trivial.obj.coff-i386
|
|
COFF32-NEXT: Format: COFF-i386
|
|
COFF32-NEXT: Arch: i386
|
|
COFF32-NEXT: AddressSize: 32bit
|
|
COFF32-NEXT: ImageFileHeader {
|
|
COFF32-NEXT: Machine: IMAGE_FILE_MACHINE_I386 (0x14C)
|
|
COFF32-NEXT: SectionCount: 2
|
|
COFF32-NEXT: TimeDateStamp: 2013-03-20 17:56:46 (0x5149F85E)
|
|
COFF32-NEXT: PointerToSymbolTable: 0xA5
|
|
COFF32-NEXT: SymbolCount: 7
|
|
COFF32-NEXT: OptionalHeaderSize: 0
|
|
COFF32-NEXT: Characteristics [ (0x0)
|
|
COFF32-NEXT: ]
|
|
COFF32-NEXT: }
|
|
|
|
COFF64: File: {{(.*[/\\])?}}trivial.obj.coff-x86-64
|
|
COFF64-NEXT: Format: COFF-x86-64
|
|
COFF64-NEXT: Arch: x86_64
|
|
COFF64-NEXT: AddressSize: 64bit
|
|
COFF64-NEXT: ImageFileHeader {
|
|
COFF64-NEXT: Machine: IMAGE_FILE_MACHINE_AMD64 (0x8664)
|
|
COFF64-NEXT: SectionCount: 2
|
|
COFF64-NEXT: TimeDateStamp: 2013-03-20 17:56:46 (0x5149F85E)
|
|
COFF64-NEXT: PointerToSymbolTable: 0xAB
|
|
COFF64-NEXT: SymbolCount: 7
|
|
COFF64-NEXT: OptionalHeaderSize: 0
|
|
COFF64-NEXT: Characteristics [ (0x0)
|
|
COFF64-NEXT: ]
|
|
COFF64-NEXT: }
|
|
|
|
ELF32: File: {{(.*[/\\])?}}trivial.obj.elf-i386
|
|
ELF32-NEXT: Format: ELF32-i386
|
|
ELF32-NEXT: Arch: i386
|
|
ELF32-NEXT: AddressSize: 32bit
|
|
ELF32-NEXT: LoadName:
|
|
ELF32-NEXT: ElfHeader {
|
|
ELF32-NEXT: Ident {
|
|
ELF32-NEXT: Magic: (7F 45 4C 46)
|
|
ELF32-NEXT: Class: 32-bit (0x1)
|
|
ELF32-NEXT: DataEncoding: LittleEndian (0x1)
|
|
ELF32-NEXT: FileVersion: 1
|
|
ELF32-NEXT: OS/ABI: GNU/Linux (0x3)
|
|
ELF32-NEXT: ABIVersion: 0
|
|
ELF32-NEXT: Unused: (00 00 00 00 00 00 00)
|
|
ELF32-NEXT: }
|
|
ELF32-NEXT: Type: Relocatable (0x1)
|
|
ELF32-NEXT: Machine: EM_386 (0x3)
|
|
ELF32-NEXT: Version: 1
|
|
ELF32-NEXT: Entry: 0x0
|
|
ELF32-NEXT: ProgramHeaderOffset: 0x0
|
|
ELF32-NEXT: SectionHeaderOffset: 0xC8
|
|
ELF32-NEXT: Flags [ (0x0)
|
|
ELF32-NEXT: ]
|
|
ELF32-NEXT: HeaderSize: 52
|
|
ELF32-NEXT: ProgramHeaderEntrySize: 0
|
|
ELF32-NEXT: ProgramHeaderCount: 0
|
|
ELF32-NEXT: SectionHeaderEntrySize: 40
|
|
ELF32-NEXT: SectionHeaderCount: 10
|
|
ELF32-NEXT: StringTableSectionIndex: 7
|
|
ELF32-NEXT: }
|
|
|
|
ELF64: File: {{(.*[/\\])?}}trivial.obj.elf-x86-64
|
|
ELF64-NEXT: Format: ELF64-x86-64
|
|
ELF64-NEXT: Arch: x86_64
|
|
ELF64-NEXT: AddressSize: 64bit
|
|
ELF64-NEXT: LoadName:
|
|
ELF64-NEXT: ElfHeader {
|
|
ELF64-NEXT: Ident {
|
|
ELF64-NEXT: Magic: (7F 45 4C 46)
|
|
ELF64-NEXT: Class: 64-bit (0x2)
|
|
ELF64-NEXT: DataEncoding: LittleEndian (0x1)
|
|
ELF64-NEXT: FileVersion: 1
|
|
ELF64-NEXT: OS/ABI: GNU/Linux (0x3)
|
|
ELF64-NEXT: ABIVersion: 0
|
|
ELF64-NEXT: Unused: (00 00 00 00 00 00 00)
|
|
ELF64-NEXT: }
|
|
ELF64-NEXT: Type: Relocatable (0x1)
|
|
ELF64-NEXT: Machine: EM_X86_64 (0x3E)
|
|
ELF64-NEXT: Version: 1
|
|
ELF64-NEXT: Entry: 0x0
|
|
ELF64-NEXT: ProgramHeaderOffset: 0x0
|
|
ELF64-NEXT: SectionHeaderOffset: 0xB8
|
|
ELF64-NEXT: Flags [ (0x0)
|
|
ELF64-NEXT: ]
|
|
ELF64-NEXT: HeaderSize: 64
|
|
ELF64-NEXT: ProgramHeaderEntrySize: 0
|
|
ELF64-NEXT: ProgramHeaderCount: 0
|
|
ELF64-NEXT: SectionHeaderEntrySize: 64
|
|
ELF64-NEXT: SectionHeaderCount: 10
|
|
ELF64-NEXT: StringTableSectionIndex: 7
|
|
ELF64-NEXT: }
|