[llvm-readobj] MachO -- correctly dump section field 'Reserved3'

Before we incorrectly ignored it.

llvm-svn: 246556
This commit is contained in:
Davide Italiano 2015-09-01 16:29:02 +00:00
parent b0ff6437cb
commit 0ca250853c
4 changed files with 19 additions and 0 deletions

View File

@ -22,6 +22,7 @@
// CHECK-NEXT: ]
// CHECK-NEXT: Reserved1:
// CHECK-NEXT: Reserved2:
// CHECK-NEXT: Reserved3:
// CHECK-NEXT: Relocations [
// CHECK-NEXT: Relocation {
// CHECK-NEXT: Offset: 0x60

View File

@ -223,6 +223,7 @@ MACHO-X86-64-NEXT: SomeInstructions (0x4)
MACHO-X86-64-NEXT: ]
MACHO-X86-64-NEXT: Reserved1: 0x0
MACHO-X86-64-NEXT: Reserved2: 0x0
MACHO-X86-64-NEXT: Reserved3: 0x0
MACHO-X86-64-NEXT: Relocations [
MACHO-X86-64-NEXT: 0xE 1 2 1 X86_64_RELOC_BRANCH 0 _SomeOtherFunction
MACHO-X86-64-NEXT: 0x9 1 2 1 X86_64_RELOC_BRANCH 0 _puts
@ -260,6 +261,7 @@ MACHO-X86-64-NEXT: Attributes [ (0x0)
MACHO-X86-64-NEXT: ]
MACHO-X86-64-NEXT: Reserved1: 0x0
MACHO-X86-64-NEXT: Reserved2: 0x0
MACHO-X86-64-NEXT: Reserved3: 0x0
MACHO-X86-64-NEXT: Relocations [
MACHO-X86-64-NEXT: ]
MACHO-X86-64-NEXT: Symbols [
@ -514,6 +516,7 @@ MACHO-PPC64-NEXT: SomeInstructions (0x4)
MACHO-PPC64-NEXT: ]
MACHO-PPC64-NEXT: Reserved1: 0x0
MACHO-PPC64-NEXT: Reserved2: 0x0
MACHO-PPC64-NEXT: Reserved3: 0x0
MACHO-PPC64-NEXT: Relocations [
MACHO-PPC64-NEXT: Relocation {
MACHO-PPC64-NEXT: Offset: 0x24
@ -587,6 +590,7 @@ MACHO-PPC64-NEXT: SomeInstructions (0x4)
MACHO-PPC64-NEXT: ]
MACHO-PPC64-NEXT: Reserved1: 0x0
MACHO-PPC64-NEXT: Reserved2: 0x20
MACHO-PPC64-NEXT: Reserved3: 0x0
MACHO-PPC64-NEXT: Relocations [
MACHO-PPC64-NEXT: Relocation {
MACHO-PPC64-NEXT: Offset: 0x14
@ -639,6 +643,7 @@ MACHO-PPC64-NEXT: Attributes [ (0x0)
MACHO-PPC64-NEXT: ]
MACHO-PPC64-NEXT: Reserved1: 0x0
MACHO-PPC64-NEXT: Reserved2: 0x0
MACHO-PPC64-NEXT: Reserved3: 0x0
MACHO-PPC64-NEXT: Relocations [
MACHO-PPC64-NEXT: ]
MACHO-PPC64-NEXT: Symbols [
@ -672,6 +677,7 @@ MACHO-PPC64-NEXT: Attributes [ (0x0)
MACHO-PPC64-NEXT: ]
MACHO-PPC64-NEXT: Reserved1: 0x1
MACHO-PPC64-NEXT: Reserved2: 0x0
MACHO-PPC64-NEXT: Reserved3: 0x0
MACHO-PPC64-NEXT: Relocations [
MACHO-PPC64-NEXT: ]
MACHO-PPC64-NEXT: Symbols [
@ -695,6 +701,7 @@ MACHO-PPC64-NEXT: Attributes [ (0x0)
MACHO-PPC64-NEXT: ]
MACHO-PPC64-NEXT: Reserved1: 0x2
MACHO-PPC64-NEXT: Reserved2: 0x0
MACHO-PPC64-NEXT: Reserved3: 0x0
MACHO-PPC64-NEXT: Relocations [
MACHO-PPC64-NEXT: Relocation {
MACHO-PPC64-NEXT: Offset: 0x0

View File

@ -172,6 +172,7 @@ MACHO-X86-64-NEXT: SomeInstructions (0x4)
MACHO-X86-64-NEXT: ]
MACHO-X86-64-NEXT: Reserved1: 0x0
MACHO-X86-64-NEXT: Reserved2: 0x0
MACHO-X86-64-NEXT: Reserved3: 0x0
MACHO-X86-64-NEXT: }
MACHO-X86-64-NEXT: Section {
MACHO-X86-64-NEXT: Index: 1
@ -188,6 +189,7 @@ MACHO-X86-64-NEXT: Attributes [ (0x0)
MACHO-X86-64-NEXT: ]
MACHO-X86-64-NEXT: Reserved1: 0x0
MACHO-X86-64-NEXT: Reserved2: 0x0
MACHO-X86-64-NEXT: Reserved3: 0x0
MACHO-X86-64-NEXT: }
MACHO-X86-64-NEXT:]
@ -296,6 +298,7 @@ MACHO-PPC64-NEXT: SomeInstructions (0x4)
MACHO-PPC64-NEXT: ]
MACHO-PPC64-NEXT: Reserved1: 0x0
MACHO-PPC64-NEXT: Reserved2: 0x0
MACHO-PPC64-NEXT: Reserved3: 0x0
MACHO-PPC64-NEXT: }
MACHO-PPC64-NEXT: Section {
MACHO-PPC64-NEXT: Index: 1
@ -314,6 +317,7 @@ MACHO-PPC64-NEXT: SomeInstructions (0x4)
MACHO-PPC64-NEXT: ]
MACHO-PPC64-NEXT: Reserved1: 0x0
MACHO-PPC64-NEXT: Reserved2: 0x20
MACHO-PPC64-NEXT: Reserved3: 0x0
MACHO-PPC64-NEXT: }
MACHO-PPC64-NEXT: Section {
MACHO-PPC64-NEXT: Index: 2
@ -330,6 +334,7 @@ MACHO-PPC64-NEXT: Attributes [ (0x0)
MACHO-PPC64-NEXT: ]
MACHO-PPC64-NEXT: Reserved1: 0x0
MACHO-PPC64-NEXT: Reserved2: 0x0
MACHO-PPC64-NEXT: Reserved3: 0x0
MACHO-PPC64-NEXT: }
MACHO-PPC64-NEXT: Section {
MACHO-PPC64-NEXT: Index: 3
@ -346,6 +351,7 @@ MACHO-PPC64-NEXT: Attributes [ (0x0)
MACHO-PPC64-NEXT: ]
MACHO-PPC64-NEXT: Reserved1: 0x1
MACHO-PPC64-NEXT: Reserved2: 0x0
MACHO-PPC64-NEXT: Reserved3: 0x0
MACHO-PPC64-NEXT: }
MACHO-PPC64-NEXT: Section {
MACHO-PPC64-NEXT: Index: 4
@ -362,6 +368,7 @@ MACHO-PPC64-NEXT: Attributes [ (0x0)
MACHO-PPC64-NEXT: ]
MACHO-PPC64-NEXT: Reserved1: 0x2
MACHO-PPC64-NEXT: Reserved2: 0x0
MACHO-PPC64-NEXT: Reserved3: 0x0
MACHO-PPC64-NEXT: }
MACHO-PPC64-NEXT: ]

View File

@ -260,6 +260,7 @@ namespace {
uint32_t Flags;
uint32_t Reserved1;
uint32_t Reserved2;
uint32_t Reserved3;
};
struct MachOSymbol {
@ -297,6 +298,7 @@ static void getSection(const MachOObjectFile *Obj,
Section.Flags = Sect.flags;
Section.Reserved1 = Sect.reserved1;
Section.Reserved2 = Sect.reserved2;
Section.Reserved3 = Sect.reserved3;
}
@ -402,6 +404,8 @@ void MachODumper::printSections(const MachOObjectFile *Obj) {
makeArrayRef(MachOSectionAttributes));
W.printHex("Reserved1", MOSection.Reserved1);
W.printHex("Reserved2", MOSection.Reserved2);
if (Obj->is64Bit())
W.printHex("Reserved3", MOSection.Reserved3);
if (opts::SectionRelocations) {
ListScope D(W, "Relocations");