llvm.org GIT mirror llvm / 335f1d4
Template the MachO types over the word size. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@179051 91177308-0d34-0410-b5e6-96231b3b80d8 Rafael Espindola 7 years ago
3 changed file(s) with 121 addition(s) and 84 deletion(s). Raw diff Collapse all Expand all
2626 namespace object {
2727
2828 namespace MachOFormat {
29 struct Section {
29 template
30 struct Section;
31
32 template<>
33 struct Section {
3034 char Name[16];
3135 char SegmentName[16];
3236 support::ulittle32_t Address;
4044 support::ulittle32_t Reserved2;
4145 };
4246
43 struct Section64 {
47 template<>
48 struct Section {
4449 char Name[16];
4550 char SegmentName[16];
4651 support::ulittle64_t Address;
6065 support::ulittle32_t Word1;
6166 };
6267
63 struct SymbolTableEntry {
68 template
69 struct SymbolTableEntry;
70
71 template<>
72 struct SymbolTableEntry {
6473 support::ulittle32_t StringIndex;
6574 uint8_t Type;
6675 uint8_t SectionIndex;
6877 support::ulittle32_t Value;
6978 };
7079
71 struct Symbol64TableEntry {
80 template<>
81 struct SymbolTableEntry {
7282 support::ulittle32_t StringIndex;
7383 uint8_t Type;
7484 uint8_t SectionIndex;
90100 support::ulittle32_t StringTableSize;
91101 };
92102
93 struct SegmentLoadCommand {
103 template
104 struct SegmentLoadCommand;
105
106 template<>
107 struct SegmentLoadCommand {
94108 support::ulittle32_t Type;
95109 support::ulittle32_t Size;
96110 char Name[16];
104118 support::ulittle32_t Flags;
105119 };
106120
107 struct Segment64LoadCommand {
121 template<>
122 struct SegmentLoadCommand {
108123 support::ulittle32_t Type;
109124 support::ulittle32_t Size;
110125 char Name[16];
164179 ArrayRef getSectionRawName(DataRefImpl Sec) const;
165180 ArrayRefgetSectionRawFinalSegmentName(DataRefImpl Sec) const;
166181
167 const MachOFormat::Section64 *getSection64(DataRefImpl DRI) const;
168 const MachOFormat::Section *getSection(DataRefImpl DRI) const;
169 const MachOFormat::Symbol64TableEntry *
182 const MachOFormat::Section *getSection64(DataRefImpl DRI) const;
183 const MachOFormat::Section *getSection(DataRefImpl DRI) const;
184 const MachOFormat::SymbolTableEntry *
170185 getSymbol64TableEntry(DataRefImpl DRI) const;
171 const MachOFormat::SymbolTableEntry *
186 const MachOFormat::SymbolTableEntry *
172187 getSymbolTableEntry(DataRefImpl DRI) const;
173188 bool is64Bit() const;
174189 const MachOFormat::LoadCommand *getLoadCommandInfo(unsigned Index) const;
241256
242257 void moveToNextSection(DataRefImpl &DRI) const;
243258
244 const MachOFormat::SymbolTableEntry *
259 const MachOFormat::SymbolTableEntry *
245260 getSymbolTableEntry(DataRefImpl DRI,
246261 const MachOFormat::SymtabLoadCommand *SymtabLoadCmd) const;
247262
248 const MachOFormat::Symbol64TableEntry *
263 const MachOFormat::SymbolTableEntry *
249264 getSymbol64TableEntry(DataRefImpl DRI,
250265 const MachOFormat::SymtabLoadCommand *SymtabLoadCmd) const;
251266
115115 }
116116 }
117117
118 const MachOFormat::SymbolTableEntry *
118 const MachOFormat::SymbolTableEntry *
119119 MachOObjectFile::getSymbolTableEntry(DataRefImpl DRI) const {
120120 const MachOFormat::LoadCommand *Command = getLoadCommandInfo(DRI.d.a);
121121 const MachOFormat::SymtabLoadCommand *SymtabLoadCmd =
124124 return getSymbolTableEntry(DRI, SymtabLoadCmd);
125125 }
126126
127 const MachOFormat::SymbolTableEntry *
127 const MachOFormat::SymbolTableEntry *
128128 MachOObjectFile::getSymbolTableEntry(DataRefImpl DRI,
129129 const MachOFormat::SymtabLoadCommand *SymtabLoadCmd) const {
130130 uint64_t SymbolTableOffset = SymtabLoadCmd->SymbolTableOffset;
131131 unsigned Index = DRI.d.b;
132132 uint64_t Offset = (SymbolTableOffset +
133 Index * sizeof(macho::SymbolTableEntry));
134 StringRef Data = getData(Offset, sizeof(MachOFormat::SymbolTableEntry));
135 return reinterpret_cast(Data.data());
136 }
137
138 const MachOFormat::Symbol64TableEntry*
133 Index * sizeof(MachOFormat::SymbolTableEntry));
134 StringRef Data =
135 getData(Offset, sizeof(MachOFormat::SymbolTableEntry));
136 return
137 reinterpret_cast*>(Data.data());
138 }
139
140 const MachOFormat::SymbolTableEntry*
139141 MachOObjectFile::getSymbol64TableEntry(DataRefImpl DRI) const {
140142 const MachOFormat::LoadCommand *Command = getLoadCommandInfo(DRI.d.a);
141143 const MachOFormat::SymtabLoadCommand *SymtabLoadCmd =
144146 return getSymbol64TableEntry(DRI, SymtabLoadCmd);
145147 }
146148
147 const MachOFormat::Symbol64TableEntry*
149 const MachOFormat::SymbolTableEntry*
148150 MachOObjectFile::getSymbol64TableEntry(DataRefImpl DRI,
149151 const MachOFormat::SymtabLoadCommand *SymtabLoadCmd) const {
150152 uint64_t SymbolTableOffset = SymtabLoadCmd->SymbolTableOffset;
151153 unsigned Index = DRI.d.b;
152154 uint64_t Offset = (SymbolTableOffset +
153 Index * sizeof(macho::Symbol64TableEntry));
154 StringRef Data = getData(Offset, sizeof(MachOFormat::Symbol64TableEntry));
155 return reinterpret_cast(Data.data());
155 Index * sizeof(MachOFormat::SymbolTableEntry));
156 StringRef Data = getData(Offset, sizeof(MachOFormat::SymbolTableEntry));
157 return
158 reinterpret_cast*>(Data.data());
156159 }
157160
158161 error_code MachOObjectFile::getSymbolNext(DataRefImpl DRI,
174177
175178 uint32_t StringIndex;
176179 if (is64Bit()) {
177 const MachOFormat::Symbol64TableEntry *Entry =
180 const MachOFormat::SymbolTableEntry *Entry =
178181 getSymbol64TableEntry(DRI, SymtabLoadCmd);
179182 StringIndex = Entry->StringIndex;
180183 } else {
181 const MachOFormat::SymbolTableEntry *Entry =
184 const MachOFormat::SymbolTableEntry *Entry =
182185 getSymbolTableEntry(DRI, SymtabLoadCmd);
183186 StringIndex = Entry->StringIndex;
184187 }
192195 error_code MachOObjectFile::getSymbolFileOffset(DataRefImpl DRI,
193196 uint64_t &Result) const {
194197 if (is64Bit()) {
195 const MachOFormat::Symbol64TableEntry *Entry = getSymbol64TableEntry(DRI);
198 const MachOFormat::SymbolTableEntry *Entry =
199 getSymbol64TableEntry(DRI);
196200 Result = Entry->Value;
197201 if (Entry->SectionIndex) {
198 const MachOFormat::Section64 *Section =
202 const MachOFormat::Section *Section =
199203 getSection64(Sections[Entry->SectionIndex-1]);
200204 Result += Section->Offset - Section->Address;
201205 }
202206 } else {
203 const MachOFormat::SymbolTableEntry *Entry = getSymbolTableEntry(DRI);
207 const MachOFormat::SymbolTableEntry *Entry =
208 getSymbolTableEntry(DRI);
204209 Result = Entry->Value;
205210 if (Entry->SectionIndex) {
206 const MachOFormat::Section *Section =
211 const MachOFormat::Section *Section =
207212 getSection(Sections[Entry->SectionIndex-1]);
208213 Result += Section->Offset - Section->Address;
209214 }
215220 error_code MachOObjectFile::getSymbolAddress(DataRefImpl DRI,
216221 uint64_t &Result) const {
217222 if (is64Bit()) {
218 const MachOFormat::Symbol64TableEntry *Entry = getSymbol64TableEntry(DRI);
223 const MachOFormat::SymbolTableEntry *Entry =
224 getSymbol64TableEntry(DRI);
219225 Result = Entry->Value;
220226 } else {
221 const MachOFormat::SymbolTableEntry *Entry = getSymbolTableEntry(DRI);
227 const MachOFormat::SymbolTableEntry *Entry =
228 getSymbolTableEntry(DRI);
222229 Result = Entry->Value;
223230 }
224231 return object_error::success;
231238 uint64_t EndOffset = 0;
232239 uint8_t SectionIndex;
233240 if (is64Bit()) {
234 const MachOFormat::Symbol64TableEntry *Entry = getSymbol64TableEntry(DRI);
241 const MachOFormat::SymbolTableEntry *Entry =
242 getSymbol64TableEntry(DRI);
235243 BeginOffset = Entry->Value;
236244 SectionIndex = Entry->SectionIndex;
237245 if (!SectionIndex) {
258266 DRI.d.b++;
259267 }
260268 } else {
261 const MachOFormat::SymbolTableEntry *Entry = getSymbolTableEntry(DRI);
269 const MachOFormat::SymbolTableEntry *Entry =
270 getSymbolTableEntry(DRI);
262271 BeginOffset = Entry->Value;
263272 SectionIndex = Entry->SectionIndex;
264273 if (!SectionIndex) {
299308 char &Result) const {
300309 uint8_t Type, Flags;
301310 if (is64Bit()) {
302 const MachOFormat::Symbol64TableEntry *Entry = getSymbol64TableEntry(DRI);
311 const MachOFormat::SymbolTableEntry *Entry =
312 getSymbol64TableEntry(DRI);
303313 Type = Entry->Type;
304314 Flags = Entry->Flags;
305315 } else {
306 const MachOFormat::SymbolTableEntry *Entry = getSymbolTableEntry(DRI);
316 const MachOFormat::SymbolTableEntry *Entry =
317 getSymbolTableEntry(DRI);
307318 Type = Entry->Type;
308319 Flags = Entry->Flags;
309320 }
333344 uint16_t MachOFlags;
334345 uint8_t MachOType;
335346 if (is64Bit()) {
336 const MachOFormat::Symbol64TableEntry *Entry = getSymbol64TableEntry(DRI);
347 const MachOFormat::SymbolTableEntry *Entry =
348 getSymbol64TableEntry(DRI);
337349 MachOFlags = Entry->Flags;
338350 MachOType = Entry->Type;
339351 } else {
340 const MachOFormat::SymbolTableEntry *Entry = getSymbolTableEntry(DRI);
352 const MachOFormat::SymbolTableEntry *Entry =
353 getSymbolTableEntry(DRI);
341354 MachOFlags = Entry->Flags;
342355 MachOType = Entry->Type;
343356 }
370383 section_iterator &Res) const {
371384 uint8_t index;
372385 if (is64Bit()) {
373 const MachOFormat::Symbol64TableEntry *Entry = getSymbol64TableEntry(Symb);
386 const MachOFormat::SymbolTableEntry *Entry =
387 getSymbol64TableEntry(Symb);
374388 index = Entry->SectionIndex;
375389 } else {
376 const MachOFormat::SymbolTableEntry *Entry = getSymbolTableEntry(Symb);
390 const MachOFormat::SymbolTableEntry *Entry =
391 getSymbolTableEntry(Symb);
377392 index = Entry->SectionIndex;
378393 }
379394
389404 SymbolRef::Type &Res) const {
390405 uint8_t n_type;
391406 if (is64Bit()) {
392 const MachOFormat::Symbol64TableEntry *Entry = getSymbol64TableEntry(Symb);
407 const MachOFormat::SymbolTableEntry *Entry =
408 getSymbol64TableEntry(Symb);
393409 n_type = Entry->Type;
394410 } else {
395 const MachOFormat::SymbolTableEntry *Entry = getSymbolTableEntry(Symb);
411 const MachOFormat::SymbolTableEntry *Entry =
412 getSymbolTableEntry(Symb);
396413 n_type = Entry->Type;
397414 }
398415 Res = SymbolRef::ST_Other;
464481 while (DRI.d.a < LoadCommandCount) {
465482 const MachOFormat::LoadCommand *Command = getLoadCommandInfo(DRI.d.a);
466483 if (Command->Type == macho::LCT_Segment) {
467 const MachOFormat::SegmentLoadCommand *SegmentLoadCmd =
468 reinterpret_cast(Command);
484 const MachOFormat::SegmentLoadCommand *SegmentLoadCmd =
485 reinterpret_cast*>(Command);
469486 if (DRI.d.b < SegmentLoadCmd->NumSections)
470487 return;
471488 } else if (Command->Type == macho::LCT_Segment64) {
472 const MachOFormat::Segment64LoadCommand *Segment64LoadCmd =
473 reinterpret_cast(Command);
474 if (DRI.d.b < Segment64LoadCmd->NumSections)
489 const MachOFormat::SegmentLoadCommand *SegmentLoadCmd =
490 reinterpret_cast*>(Command);
491 if (DRI.d.b < SegmentLoadCmd->NumSections)
475492 return;
476493 }
477494
488505 return object_error::success;
489506 }
490507
491 const MachOFormat::Section *MachOObjectFile::getSection(DataRefImpl DRI) const {
508 const MachOFormat::Section *
509 MachOObjectFile::getSection(DataRefImpl DRI) const {
492510 assert(!is64Bit());
493511 const MachOFormat::LoadCommand *Command = getLoadCommandInfo(DRI.d.a);
494512 uintptr_t CommandAddr = reinterpret_cast(Command);
495513 uintptr_t SectionAddr = CommandAddr + sizeof(macho::SegmentLoadCommand) +
496 DRI.d.b * sizeof(MachOFormat::Section);
497 return reinterpret_cast(SectionAddr);
514 DRI.d.b * sizeof(MachOFormat::Section);
515 return reinterpret_cast*>(SectionAddr);
498516 }
499517
500518 std::size_t MachOObjectFile::getSectionIndex(DataRefImpl Sec) const {
504522 return std::distance(Sections.begin(), loc);
505523 }
506524
507 const MachOFormat::Section64 *
525 const MachOFormat::Section *
508526 MachOObjectFile::getSection64(DataRefImpl DRI) const {
509527 assert(is64Bit());
510528 const MachOFormat::LoadCommand *Command = getLoadCommandInfo(DRI.d.a);
511529 uintptr_t CommandAddr = reinterpret_cast(Command);
512530 uintptr_t SectionAddr = CommandAddr + sizeof(macho::Segment64LoadCommand) +
513 DRI.d.b * sizeof(MachOFormat::Section64);
514 return reinterpret_cast(SectionAddr);
531 DRI.d.b * sizeof(MachOFormat::Section);
532 return reinterpret_cast*>(SectionAddr);
515533 }
516534
517535 static StringRef parseSegmentOrSectionName(const char *P) {
524542
525543 ArrayRef MachOObjectFile::getSectionRawName(DataRefImpl DRI) const {
526544 if (is64Bit()) {
527 const MachOFormat::Section64 *sec = getSection64(DRI);
545 const MachOFormat::Section *sec = getSection64(DRI);
528546 return ArrayRef(sec->Name);
529547 } else {
530 const MachOFormat::Section *sec = getSection(DRI);
548 const MachOFormat::Section *sec = getSection(DRI);
531549 return ArrayRef(sec->Name);
532550 }
533551 }
542560 ArrayRef
543561 MachOObjectFile::getSectionRawFinalSegmentName(DataRefImpl Sec) const {
544562 if (is64Bit()) {
545 const MachOFormat::Section64 *sec = getSection64(Sec);
563 const MachOFormat::Section *sec = getSection64(Sec);
546564 return ArrayRef(sec->SegmentName, 16);
547565 } else {
548 const MachOFormat::Section *sec = getSection(Sec);
566 const MachOFormat::Section *sec = getSection(Sec);
549567 return ArrayRef(sec->SegmentName);
550568 }
551569 }
558576 error_code MachOObjectFile::getSectionAddress(DataRefImpl DRI,
559577 uint64_t &Result) const {
560578 if (is64Bit()) {
561 const MachOFormat::Section64 *Sect = getSection64(DRI);
579 const MachOFormat::Section *Sect = getSection64(DRI);
562580 Result = Sect->Address;
563581 } else {
564 const MachOFormat::Section *Sect = getSection(DRI);
582 const MachOFormat::Section *Sect = getSection(DRI);
565583 Result = Sect->Address;
566584 }
567585 return object_error::success;
570588 error_code MachOObjectFile::getSectionSize(DataRefImpl DRI,
571589 uint64_t &Result) const {
572590 if (is64Bit()) {
573 const MachOFormat::Section64 *Sect = getSection64(DRI);
591 const MachOFormat::Section *Sect = getSection64(DRI);
574592 Result = Sect->Size;
575593 } else {
576 const MachOFormat::Section *Sect = getSection(DRI);
594 const MachOFormat::Section *Sect = getSection(DRI);
577595 Result = Sect->Size;
578596 }
579597 return object_error::success;
582600 error_code MachOObjectFile::getSectionContents(DataRefImpl DRI,
583601 StringRef &Result) const {
584602 if (is64Bit()) {
585 const MachOFormat::Section64 *Sect = getSection64(DRI);
603 const MachOFormat::Section *Sect = getSection64(DRI);
586604 Result = getData(Sect->Offset, Sect->Size);
587605 } else {
588 const MachOFormat::Section *Sect = getSection(DRI);
606 const MachOFormat::Section *Sect = getSection(DRI);
589607 Result = getData(Sect->Offset, Sect->Size);
590608 }
591609 return object_error::success;
594612 error_code MachOObjectFile::getSectionAlignment(DataRefImpl DRI,
595613 uint64_t &Result) const {
596614 if (is64Bit()) {
597 const MachOFormat::Section64 *Sect = getSection64(DRI);
615 const MachOFormat::Section *Sect = getSection64(DRI);
598616 Result = uint64_t(1) << Sect->Align;
599617 } else {
600 const MachOFormat::Section *Sect = getSection(DRI);
618 const MachOFormat::Section *Sect = getSection(DRI);
601619 Result = uint64_t(1) << Sect->Align;
602620 }
603621 return object_error::success;
606624 error_code MachOObjectFile::isSectionText(DataRefImpl DRI,
607625 bool &Result) const {
608626 if (is64Bit()) {
609 const MachOFormat::Section64 *Sect = getSection64(DRI);
627 const MachOFormat::Section *Sect = getSection64(DRI);
610628 Result = Sect->Flags & macho::SF_PureInstructions;
611629 } else {
612 const MachOFormat::Section *Sect = getSection(DRI);
630 const MachOFormat::Section *Sect = getSection(DRI);
613631 Result = Sect->Flags & macho::SF_PureInstructions;
614632 }
615633 return object_error::success;
646664 error_code MachOObjectFile::isSectionZeroInit(DataRefImpl DRI,
647665 bool &Result) const {
648666 if (is64Bit()) {
649 const MachOFormat::Section64 *Sect = getSection64(DRI);
667 const MachOFormat::Section *Sect = getSection64(DRI);
650668 unsigned SectionType = Sect->Flags & MachO::SectionFlagMaskSectionType;
651669 Result = (SectionType == MachO::SectionTypeZeroFill ||
652670 SectionType == MachO::SectionTypeZeroFillLarge);
653671 } else {
654 const MachOFormat::Section *Sect = getSection(DRI);
672 const MachOFormat::Section *Sect = getSection(DRI);
655673 unsigned SectionType = Sect->Flags & MachO::SectionFlagMaskSectionType;
656674 Result = (SectionType == MachO::SectionTypeZeroFill ||
657675 SectionType == MachO::SectionTypeZeroFillLarge);
687705 SectEnd += SectBegin;
688706
689707 if (is64Bit()) {
690 const MachOFormat::Symbol64TableEntry *Entry = getSymbol64TableEntry(Symb);
708 const MachOFormat::SymbolTableEntry *Entry =
709 getSymbol64TableEntry(Symb);
691710 uint64_t SymAddr= Entry->Value;
692711 Result = (SymAddr >= SectBegin) && (SymAddr < SectEnd);
693712 } else {
694 const MachOFormat::SymbolTableEntry *Entry = getSymbolTableEntry(Symb);
713 const MachOFormat::SymbolTableEntry *Entry =
714 getSymbolTableEntry(Symb);
695715 uint64_t SymAddr= Entry->Value;
696716 Result = (SymAddr >= SectBegin) && (SymAddr < SectEnd);
697717 }
704724 ret.d.b = getSectionIndex(Sec);
705725 return relocation_iterator(RelocationRef(ret, this));
706726 }
727
707728 relocation_iterator MachOObjectFile::getSectionRelEnd(DataRefImpl Sec) const {
708729 uint32_t last_reloc;
709730 if (is64Bit()) {
710 const MachOFormat::Section64 *Sect = getSection64(Sec);
731 const MachOFormat::Section *Sect = getSection64(Sec);
711732 last_reloc = Sect->NumRelocationTableEntries;
712733 } else {
713 const MachOFormat::Section *Sect = getSection(Sec);
734 const MachOFormat::Section *Sect = getSection(Sec);
714735 last_reloc = Sect->NumRelocationTableEntries;
715736 }
716737 DataRefImpl ret;
737758 MachOObjectFile::getRelocation(DataRefImpl Rel) const {
738759 uint32_t relOffset;
739760 if (is64Bit()) {
740 const MachOFormat::Section64 *Sect = getSection64(Sections[Rel.d.b]);
761 const MachOFormat::Section *Sect = getSection64(Sections[Rel.d.b]);
741762 relOffset = Sect->RelocationTableOffset;
742763 } else {
743 const MachOFormat::Section *Sect = getSection(Sections[Rel.d.b]);
764 const MachOFormat::Section *Sect = getSection(Sections[Rel.d.b]);
744765 relOffset = Sect->RelocationTableOffset;
745766 }
746767 uint64_t Offset = relOffset + Rel.d.a * sizeof(MachOFormat::RelocationEntry);
758779 uint64_t &Res) const {
759780 const uint8_t* sectAddress = 0;
760781 if (is64Bit()) {
761 const MachOFormat::Section64 *Sect = getSection64(Sections[Rel.d.b]);
782 const MachOFormat::Section *Sect = getSection64(Sections[Rel.d.b]);
762783 sectAddress += Sect->Address;
763784 } else {
764 const MachOFormat::Section *Sect = getSection(Sections[Rel.d.b]);
785 const MachOFormat::Section *Sect = getSection(Sections[Rel.d.b]);
765786 sectAddress += Sect->Address;
766787 }
767788 const MachOFormat::RelocationEntry *RE = getRelocation(Rel);
925946 if (!isExtern) {
926947 const uint8_t* sectAddress = base();
927948 if (is64Bit()) {
928 const MachOFormat::Section64 *Sect = getSection64(Sections[Rel.d.b]);
949 const MachOFormat::Section *Sect = getSection64(Sections[Rel.d.b]);
929950 sectAddress += Sect->Offset;
930951 } else {
931 const MachOFormat::Section *Sect = getSection(Sections[Rel.d.b]);
952 const MachOFormat::Section *Sect = getSection(Sections[Rel.d.b]);
932953 sectAddress += Sect->Offset;
933954 }
934955 Res = reinterpret_cast(sectAddress);
160160 DataRefImpl DRI,
161161 MachOSection &Section) {
162162 if (Obj->is64Bit()) {
163 const MachOFormat::Section64 *Sect = Obj->getSection64(DRI);
163 const MachOFormat::Section *Sect = Obj->getSection64(DRI);
164164
165165 Section.Address = Sect->Address;
166166 Section.Size = Sect->Size;
172172 Section.Reserved1 = Sect->Reserved1;
173173 Section.Reserved2 = Sect->Reserved2;
174174 } else {
175 const MachOFormat::Section *Sect = Obj->getSection(DRI);
175 const MachOFormat::Section *Sect = Obj->getSection(DRI);
176176
177177 Section.Address = Sect->Address;
178178 Section.Size = Sect->Size;
190190 DataRefImpl DRI,
191191 MachOSymbol &Symbol) {
192192 if (Obj->is64Bit()) {
193 const MachOFormat::Symbol64TableEntry *Entry =
194 Obj->getSymbol64TableEntry( DRI);
193 const MachOFormat::SymbolTableEntry *Entry =
194 Obj->getSymbol64TableEntry(DRI);
195195 Symbol.StringIndex = Entry->StringIndex;
196196 Symbol.Type = Entry->Type;
197197 Symbol.SectionIndex = Entry->SectionIndex;
198198 Symbol.Flags = Entry->Flags;
199199 Symbol.Value = Entry->Value;
200200 } else {
201 const MachOFormat::SymbolTableEntry *Entry = Obj->getSymbolTableEntry(DRI);
201 const MachOFormat::SymbolTableEntry *Entry =
202 Obj->getSymbolTableEntry(DRI);
202203 Symbol.StringIndex = Entry->StringIndex;
203204 Symbol.Type = Entry->Type;
204205 Symbol.SectionIndex = Entry->SectionIndex;