mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-13 04:30:23 +00:00
[Mips] Teach llvm-readobj to print MIPS-specific ELF program headers.
The patch reviewed by Michael Spencer. http://llvm-reviews.chandlerc.com/D1846 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@192093 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
e778f82a1e
commit
c84c742edd
BIN
test/Object/Inputs/program-headers.mips
Executable file
BIN
test/Object/Inputs/program-headers.mips
Executable file
Binary file not shown.
@ -2,6 +2,8 @@ RUN: llvm-readobj -program-headers %p/../../Object/Inputs/program-headers.elf-i3
|
|||||||
RUN: | FileCheck %s -check-prefix ELF-I386
|
RUN: | FileCheck %s -check-prefix ELF-I386
|
||||||
RUN: llvm-readobj -program-headers %p/../../Object/Inputs/program-headers.elf-x86-64 \
|
RUN: llvm-readobj -program-headers %p/../../Object/Inputs/program-headers.elf-x86-64 \
|
||||||
RUN: | FileCheck %s -check-prefix ELF-X86-64
|
RUN: | FileCheck %s -check-prefix ELF-X86-64
|
||||||
|
RUN: llvm-readobj -program-headers %p/../../Object/Inputs/program-headers.mips \
|
||||||
|
RUN: | FileCheck %s -check-prefix ELF-MIPS
|
||||||
|
|
||||||
ELF-I386: ProgramHeaders [
|
ELF-I386: ProgramHeaders [
|
||||||
ELF-I386-NEXT: ProgramHeader {
|
ELF-I386-NEXT: ProgramHeader {
|
||||||
@ -72,3 +74,31 @@ ELF-X86-64-NEXT: ]
|
|||||||
ELF-X86-64-NEXT: Alignment: 8
|
ELF-X86-64-NEXT: Alignment: 8
|
||||||
ELF-X86-64-NEXT: }
|
ELF-X86-64-NEXT: }
|
||||||
ELF-X86-64-NEXT: ]
|
ELF-X86-64-NEXT: ]
|
||||||
|
|
||||||
|
ELF-MIPS: ProgramHeaders [
|
||||||
|
ELF-MIPS-NEXT: ProgramHeader {
|
||||||
|
ELF-MIPS-NEXT: Type: PT_MIPS_REGINFO (0x70000000)
|
||||||
|
ELF-MIPS-NEXT: Offset: 0x74
|
||||||
|
ELF-MIPS-NEXT: VirtualAddress: 0x400074
|
||||||
|
ELF-MIPS-NEXT: PhysicalAddress: 0x400074
|
||||||
|
ELF-MIPS-NEXT: FileSize: 24
|
||||||
|
ELF-MIPS-NEXT: MemSize: 24
|
||||||
|
ELF-MIPS-NEXT: Flags [ (0x4)
|
||||||
|
ELF-MIPS-NEXT: PF_R (0x4)
|
||||||
|
ELF-MIPS-NEXT: ]
|
||||||
|
ELF-MIPS-NEXT: Alignment: 4
|
||||||
|
ELF-MIPS-NEXT: }
|
||||||
|
ELF-MIPS-NEXT: ProgramHeader {
|
||||||
|
ELF-MIPS-NEXT: Type: PT_LOAD (0x1)
|
||||||
|
ELF-MIPS-NEXT: Offset: 0x0
|
||||||
|
ELF-MIPS-NEXT: VirtualAddress: 0x400000
|
||||||
|
ELF-MIPS-NEXT: PhysicalAddress: 0x400000
|
||||||
|
ELF-MIPS-NEXT: FileSize: 160
|
||||||
|
ELF-MIPS-NEXT: MemSize: 160
|
||||||
|
ELF-MIPS-NEXT: Flags [ (0x5)
|
||||||
|
ELF-MIPS-NEXT: PF_R (0x4)
|
||||||
|
ELF-MIPS-NEXT: PF_X (0x1)
|
||||||
|
ELF-MIPS-NEXT: ]
|
||||||
|
ELF-MIPS-NEXT: Alignment: 65536
|
||||||
|
ELF-MIPS-NEXT: }
|
||||||
|
ELF-MIPS-NEXT: ]
|
||||||
|
@ -391,26 +391,41 @@ static const EnumEntry<unsigned> ElfSectionFlags[] = {
|
|||||||
LLVM_READOBJ_ENUM_ENT(ELF, SHF_MIPS_NOSTRIP )
|
LLVM_READOBJ_ENUM_ENT(ELF, SHF_MIPS_NOSTRIP )
|
||||||
};
|
};
|
||||||
|
|
||||||
static const EnumEntry<unsigned> ElfSegmentTypes[] = {
|
static const char *getElfSegmentType(unsigned Arch, unsigned Type) {
|
||||||
LLVM_READOBJ_ENUM_ENT(ELF, PT_NULL ),
|
// Check potentially overlapped processor-specific
|
||||||
LLVM_READOBJ_ENUM_ENT(ELF, PT_LOAD ),
|
// program header type.
|
||||||
LLVM_READOBJ_ENUM_ENT(ELF, PT_DYNAMIC),
|
switch (Arch) {
|
||||||
LLVM_READOBJ_ENUM_ENT(ELF, PT_INTERP ),
|
case ELF::EM_ARM:
|
||||||
LLVM_READOBJ_ENUM_ENT(ELF, PT_NOTE ),
|
switch (Type) {
|
||||||
LLVM_READOBJ_ENUM_ENT(ELF, PT_SHLIB ),
|
LLVM_READOBJ_ENUM_CASE(ELF, PT_ARM_EXIDX);
|
||||||
LLVM_READOBJ_ENUM_ENT(ELF, PT_PHDR ),
|
}
|
||||||
LLVM_READOBJ_ENUM_ENT(ELF, PT_TLS ),
|
case ELF::EM_MIPS:
|
||||||
|
case ELF::EM_MIPS_RS3_LE:
|
||||||
|
switch (Type) {
|
||||||
|
LLVM_READOBJ_ENUM_CASE(ELF, PT_MIPS_REGINFO);
|
||||||
|
LLVM_READOBJ_ENUM_CASE(ELF, PT_MIPS_RTPROC);
|
||||||
|
LLVM_READOBJ_ENUM_CASE(ELF, PT_MIPS_OPTIONS);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
LLVM_READOBJ_ENUM_ENT(ELF, PT_GNU_EH_FRAME),
|
switch (Type) {
|
||||||
LLVM_READOBJ_ENUM_ENT(ELF, PT_SUNW_EH_FRAME),
|
LLVM_READOBJ_ENUM_CASE(ELF, PT_NULL );
|
||||||
LLVM_READOBJ_ENUM_ENT(ELF, PT_SUNW_UNWIND),
|
LLVM_READOBJ_ENUM_CASE(ELF, PT_LOAD );
|
||||||
|
LLVM_READOBJ_ENUM_CASE(ELF, PT_DYNAMIC);
|
||||||
|
LLVM_READOBJ_ENUM_CASE(ELF, PT_INTERP );
|
||||||
|
LLVM_READOBJ_ENUM_CASE(ELF, PT_NOTE );
|
||||||
|
LLVM_READOBJ_ENUM_CASE(ELF, PT_SHLIB );
|
||||||
|
LLVM_READOBJ_ENUM_CASE(ELF, PT_PHDR );
|
||||||
|
LLVM_READOBJ_ENUM_CASE(ELF, PT_TLS );
|
||||||
|
|
||||||
LLVM_READOBJ_ENUM_ENT(ELF, PT_GNU_STACK),
|
LLVM_READOBJ_ENUM_CASE(ELF, PT_GNU_EH_FRAME);
|
||||||
LLVM_READOBJ_ENUM_ENT(ELF, PT_GNU_RELRO),
|
LLVM_READOBJ_ENUM_CASE(ELF, PT_SUNW_UNWIND);
|
||||||
|
|
||||||
LLVM_READOBJ_ENUM_ENT(ELF, PT_ARM_EXIDX),
|
LLVM_READOBJ_ENUM_CASE(ELF, PT_GNU_STACK);
|
||||||
LLVM_READOBJ_ENUM_ENT(ELF, PT_ARM_UNWIND)
|
LLVM_READOBJ_ENUM_CASE(ELF, PT_GNU_RELRO);
|
||||||
};
|
default: return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static const EnumEntry<unsigned> ElfSegmentFlags[] = {
|
static const EnumEntry<unsigned> ElfSegmentFlags[] = {
|
||||||
LLVM_READOBJ_ENUM_ENT(ELF, PF_X),
|
LLVM_READOBJ_ENUM_ENT(ELF, PF_X),
|
||||||
@ -790,7 +805,9 @@ void ELFDumper<ELFT>::printProgramHeaders() {
|
|||||||
PE = Obj->end_program_headers();
|
PE = Obj->end_program_headers();
|
||||||
PI != PE; ++PI) {
|
PI != PE; ++PI) {
|
||||||
DictScope P(W, "ProgramHeader");
|
DictScope P(W, "ProgramHeader");
|
||||||
W.printEnum ("Type", PI->p_type, makeArrayRef(ElfSegmentTypes));
|
W.printHex ("Type",
|
||||||
|
getElfSegmentType(Obj->getHeader()->e_machine, PI->p_type),
|
||||||
|
PI->p_type);
|
||||||
W.printHex ("Offset", PI->p_offset);
|
W.printHex ("Offset", PI->p_offset);
|
||||||
W.printHex ("VirtualAddress", PI->p_vaddr);
|
W.printHex ("VirtualAddress", PI->p_vaddr);
|
||||||
W.printHex ("PhysicalAddress", PI->p_paddr);
|
W.printHex ("PhysicalAddress", PI->p_paddr);
|
||||||
|
Loading…
Reference in New Issue
Block a user