[llvm-readobj] MachO -- correctly dump section field 'Reserved3'
authorDavide Italiano <davide@freebsd.org>
Tue, 1 Sep 2015 16:29:02 +0000 (16:29 +0000)
committerDavide Italiano <davide@freebsd.org>
Tue, 1 Sep 2015 16:29:02 +0000 (16:29 +0000)
Before we incorrectly ignored it.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246556 91177308-0d34-0410-b5e6-96231b3b80d8

test/MC/AArch64/arm64-leaf-compact-unwind.s
test/tools/llvm-readobj/sections-ext.test
test/tools/llvm-readobj/sections.test
tools/llvm-readobj/MachODumper.cpp

index a0703f6360db585ecf298c9c86695aa0cc7517fd..2ff7fe82e9be723c131b0bd63e31923368bff57f 100644 (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
index 19b7aa0516d1f89516a2e0b1d39c3cc0fb5ee3b3..70ae0f22a0e40cc25a71a5d9f86aab77bbdf618b 100644 (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
index fe734d77e34b6663e1dbe1230a487ece5c7056ce..54654e7070effa1ff0d2706b005ec65213c82093 100644 (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: ]
 
index e7cda4d84d48d9ab30c2452ab33d99a86a702dc7..7b99a1ac90ee2e0e30964fff0abdbfc4d2fecfd3 100644 (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");