Skip to content

Commit 0ca2508

Browse files
committed
[llvm-readobj] MachO -- correctly dump section field 'Reserved3'
Before we incorrectly ignored it. llvm-svn: 246556
1 parent b0ff643 commit 0ca2508

File tree

4 files changed

+19
-0
lines changed

4 files changed

+19
-0
lines changed

llvm/test/MC/AArch64/arm64-leaf-compact-unwind.s

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
// CHECK-NEXT: ]
2323
// CHECK-NEXT: Reserved1:
2424
// CHECK-NEXT: Reserved2:
25+
// CHECK-NEXT: Reserved3:
2526
// CHECK-NEXT: Relocations [
2627
// CHECK-NEXT: Relocation {
2728
// CHECK-NEXT: Offset: 0x60

llvm/test/tools/llvm-readobj/sections-ext.test

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,7 @@ MACHO-X86-64-NEXT: SomeInstructions (0x4)
223223
MACHO-X86-64-NEXT: ]
224224
MACHO-X86-64-NEXT: Reserved1: 0x0
225225
MACHO-X86-64-NEXT: Reserved2: 0x0
226+
MACHO-X86-64-NEXT: Reserved3: 0x0
226227
MACHO-X86-64-NEXT: Relocations [
227228
MACHO-X86-64-NEXT: 0xE 1 2 1 X86_64_RELOC_BRANCH 0 _SomeOtherFunction
228229
MACHO-X86-64-NEXT: 0x9 1 2 1 X86_64_RELOC_BRANCH 0 _puts
@@ -260,6 +261,7 @@ MACHO-X86-64-NEXT: Attributes [ (0x0)
260261
MACHO-X86-64-NEXT: ]
261262
MACHO-X86-64-NEXT: Reserved1: 0x0
262263
MACHO-X86-64-NEXT: Reserved2: 0x0
264+
MACHO-X86-64-NEXT: Reserved3: 0x0
263265
MACHO-X86-64-NEXT: Relocations [
264266
MACHO-X86-64-NEXT: ]
265267
MACHO-X86-64-NEXT: Symbols [
@@ -514,6 +516,7 @@ MACHO-PPC64-NEXT: SomeInstructions (0x4)
514516
MACHO-PPC64-NEXT: ]
515517
MACHO-PPC64-NEXT: Reserved1: 0x0
516518
MACHO-PPC64-NEXT: Reserved2: 0x0
519+
MACHO-PPC64-NEXT: Reserved3: 0x0
517520
MACHO-PPC64-NEXT: Relocations [
518521
MACHO-PPC64-NEXT: Relocation {
519522
MACHO-PPC64-NEXT: Offset: 0x24
@@ -587,6 +590,7 @@ MACHO-PPC64-NEXT: SomeInstructions (0x4)
587590
MACHO-PPC64-NEXT: ]
588591
MACHO-PPC64-NEXT: Reserved1: 0x0
589592
MACHO-PPC64-NEXT: Reserved2: 0x20
593+
MACHO-PPC64-NEXT: Reserved3: 0x0
590594
MACHO-PPC64-NEXT: Relocations [
591595
MACHO-PPC64-NEXT: Relocation {
592596
MACHO-PPC64-NEXT: Offset: 0x14
@@ -639,6 +643,7 @@ MACHO-PPC64-NEXT: Attributes [ (0x0)
639643
MACHO-PPC64-NEXT: ]
640644
MACHO-PPC64-NEXT: Reserved1: 0x0
641645
MACHO-PPC64-NEXT: Reserved2: 0x0
646+
MACHO-PPC64-NEXT: Reserved3: 0x0
642647
MACHO-PPC64-NEXT: Relocations [
643648
MACHO-PPC64-NEXT: ]
644649
MACHO-PPC64-NEXT: Symbols [
@@ -672,6 +677,7 @@ MACHO-PPC64-NEXT: Attributes [ (0x0)
672677
MACHO-PPC64-NEXT: ]
673678
MACHO-PPC64-NEXT: Reserved1: 0x1
674679
MACHO-PPC64-NEXT: Reserved2: 0x0
680+
MACHO-PPC64-NEXT: Reserved3: 0x0
675681
MACHO-PPC64-NEXT: Relocations [
676682
MACHO-PPC64-NEXT: ]
677683
MACHO-PPC64-NEXT: Symbols [
@@ -695,6 +701,7 @@ MACHO-PPC64-NEXT: Attributes [ (0x0)
695701
MACHO-PPC64-NEXT: ]
696702
MACHO-PPC64-NEXT: Reserved1: 0x2
697703
MACHO-PPC64-NEXT: Reserved2: 0x0
704+
MACHO-PPC64-NEXT: Reserved3: 0x0
698705
MACHO-PPC64-NEXT: Relocations [
699706
MACHO-PPC64-NEXT: Relocation {
700707
MACHO-PPC64-NEXT: Offset: 0x0

llvm/test/tools/llvm-readobj/sections.test

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,7 @@ MACHO-X86-64-NEXT: SomeInstructions (0x4)
172172
MACHO-X86-64-NEXT: ]
173173
MACHO-X86-64-NEXT: Reserved1: 0x0
174174
MACHO-X86-64-NEXT: Reserved2: 0x0
175+
MACHO-X86-64-NEXT: Reserved3: 0x0
175176
MACHO-X86-64-NEXT: }
176177
MACHO-X86-64-NEXT: Section {
177178
MACHO-X86-64-NEXT: Index: 1
@@ -188,6 +189,7 @@ MACHO-X86-64-NEXT: Attributes [ (0x0)
188189
MACHO-X86-64-NEXT: ]
189190
MACHO-X86-64-NEXT: Reserved1: 0x0
190191
MACHO-X86-64-NEXT: Reserved2: 0x0
192+
MACHO-X86-64-NEXT: Reserved3: 0x0
191193
MACHO-X86-64-NEXT: }
192194
MACHO-X86-64-NEXT:]
193195

@@ -296,6 +298,7 @@ MACHO-PPC64-NEXT: SomeInstructions (0x4)
296298
MACHO-PPC64-NEXT: ]
297299
MACHO-PPC64-NEXT: Reserved1: 0x0
298300
MACHO-PPC64-NEXT: Reserved2: 0x0
301+
MACHO-PPC64-NEXT: Reserved3: 0x0
299302
MACHO-PPC64-NEXT: }
300303
MACHO-PPC64-NEXT: Section {
301304
MACHO-PPC64-NEXT: Index: 1
@@ -314,6 +317,7 @@ MACHO-PPC64-NEXT: SomeInstructions (0x4)
314317
MACHO-PPC64-NEXT: ]
315318
MACHO-PPC64-NEXT: Reserved1: 0x0
316319
MACHO-PPC64-NEXT: Reserved2: 0x20
320+
MACHO-PPC64-NEXT: Reserved3: 0x0
317321
MACHO-PPC64-NEXT: }
318322
MACHO-PPC64-NEXT: Section {
319323
MACHO-PPC64-NEXT: Index: 2
@@ -330,6 +334,7 @@ MACHO-PPC64-NEXT: Attributes [ (0x0)
330334
MACHO-PPC64-NEXT: ]
331335
MACHO-PPC64-NEXT: Reserved1: 0x0
332336
MACHO-PPC64-NEXT: Reserved2: 0x0
337+
MACHO-PPC64-NEXT: Reserved3: 0x0
333338
MACHO-PPC64-NEXT: }
334339
MACHO-PPC64-NEXT: Section {
335340
MACHO-PPC64-NEXT: Index: 3
@@ -346,6 +351,7 @@ MACHO-PPC64-NEXT: Attributes [ (0x0)
346351
MACHO-PPC64-NEXT: ]
347352
MACHO-PPC64-NEXT: Reserved1: 0x1
348353
MACHO-PPC64-NEXT: Reserved2: 0x0
354+
MACHO-PPC64-NEXT: Reserved3: 0x0
349355
MACHO-PPC64-NEXT: }
350356
MACHO-PPC64-NEXT: Section {
351357
MACHO-PPC64-NEXT: Index: 4
@@ -362,6 +368,7 @@ MACHO-PPC64-NEXT: Attributes [ (0x0)
362368
MACHO-PPC64-NEXT: ]
363369
MACHO-PPC64-NEXT: Reserved1: 0x2
364370
MACHO-PPC64-NEXT: Reserved2: 0x0
371+
MACHO-PPC64-NEXT: Reserved3: 0x0
365372
MACHO-PPC64-NEXT: }
366373
MACHO-PPC64-NEXT: ]
367374

llvm/tools/llvm-readobj/MachODumper.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,7 @@ namespace {
260260
uint32_t Flags;
261261
uint32_t Reserved1;
262262
uint32_t Reserved2;
263+
uint32_t Reserved3;
263264
};
264265

265266
struct MachOSymbol {
@@ -297,6 +298,7 @@ static void getSection(const MachOObjectFile *Obj,
297298
Section.Flags = Sect.flags;
298299
Section.Reserved1 = Sect.reserved1;
299300
Section.Reserved2 = Sect.reserved2;
301+
Section.Reserved3 = Sect.reserved3;
300302
}
301303

302304

@@ -402,6 +404,8 @@ void MachODumper::printSections(const MachOObjectFile *Obj) {
402404
makeArrayRef(MachOSectionAttributes));
403405
W.printHex("Reserved1", MOSection.Reserved1);
404406
W.printHex("Reserved2", MOSection.Reserved2);
407+
if (Obj->is64Bit())
408+
W.printHex("Reserved3", MOSection.Reserved3);
405409

406410
if (opts::SectionRelocations) {
407411
ListScope D(W, "Relocations");

0 commit comments

Comments
 (0)