@@ -877,6 +877,20 @@ AppleNamesSectionRef::create(MCCASBuilder &MB,
877
877
return get (B->build ());
878
878
}
879
879
880
+ Expected<AppleTypesSectionRef>
881
+ AppleTypesSectionRef::create (MCCASBuilder &MB,
882
+ ArrayRef<cas::ObjectRef> Fragments) {
883
+ Expected<Builder> B = Builder::startNode (MB.Schema , KindString);
884
+ if (!B)
885
+ return B.takeError ();
886
+
887
+ if (auto E = createGenericDebugSection<AppleTypesSectionRef>(
888
+ MB, Fragments, B->Data , B->Refs ))
889
+ return E;
890
+
891
+ return get (B->build ());
892
+ }
893
+
880
894
Expected<uint64_t > SectionRef::materialize (MCCASReader &Reader,
881
895
raw_ostream *Stream) const {
882
896
// Start a new section for relocations.
@@ -1393,6 +1407,14 @@ AppleNamesSectionRef::materialize(MCCASReader &Reader,
1393
1407
*this );
1394
1408
}
1395
1409
1410
+ Expected<uint64_t >
1411
+ AppleTypesSectionRef::materialize (MCCASReader &Reader,
1412
+ raw_ostream *Stream) const {
1413
+ StringRef Remaining = getData ();
1414
+ return materializeGenericDebugSection<AppleTypesSectionRef>(Reader, Remaining,
1415
+ *this );
1416
+ }
1417
+
1396
1418
Expected<AtomRef> AtomRef::create (MCCASBuilder &MB,
1397
1419
ArrayRef<cas::ObjectRef> Fragments) {
1398
1420
Expected<Builder> B = Builder::startNode (MB.Schema , KindString);
@@ -1729,7 +1751,8 @@ DwarfSectionsCache mccasformats::v1::getDwarfSections(MCAssembler &Asm) {
1729
1751
Asm.getContext ().getObjectFileInfo ()->getDwarfRnglistsSection (),
1730
1752
Asm.getContext ().getObjectFileInfo ()->getDwarfLineStrSection (),
1731
1753
Asm.getContext ().getObjectFileInfo ()->getDwarfDebugNamesSection (),
1732
- Asm.getContext ().getObjectFileInfo ()->getDwarfAccelNamesSection ()};
1754
+ Asm.getContext ().getObjectFileInfo ()->getDwarfAccelNamesSection (),
1755
+ Asm.getContext ().getObjectFileInfo ()->getDwarfAccelTypesSection ()};
1733
1756
}
1734
1757
1735
1758
Error MCCASBuilder::prepare () {
@@ -2690,6 +2713,23 @@ Error MCCASBuilder::createAppleNamesSection() {
2690
2713
return finalizeSection<AppleNamesSectionRef>();
2691
2714
}
2692
2715
2716
+ Error MCCASBuilder::createAppleTypesSection () {
2717
+
2718
+ auto MaybeAppleTypesRef =
2719
+ createGenericDebugRef<AppleTypesRef>(DwarfSections.AppleTypes );
2720
+ if (!MaybeAppleTypesRef)
2721
+ return Error::success ();
2722
+
2723
+ if (!*MaybeAppleTypesRef)
2724
+ return MaybeAppleTypesRef->takeError ();
2725
+
2726
+ startSection (DwarfSections.AppleTypes );
2727
+ addNode (**MaybeAppleTypesRef);
2728
+ if (auto E = createPaddingRef (DwarfSections.AppleTypes ))
2729
+ return E;
2730
+ return finalizeSection<AppleTypesSectionRef>();
2731
+ }
2732
+
2693
2733
static ArrayRef<char > getFragmentContents (const MCFragment &Fragment) {
2694
2734
switch (Fragment.getKind ()) {
2695
2735
#define MCFRAGMENT_NODE_REF (MCFragmentName, MCEnumName, MCEnumIdentifier ) \
@@ -2877,6 +2917,13 @@ Error MCCASBuilder::buildFragments() {
2877
2917
continue ;
2878
2918
}
2879
2919
2920
+ // Handle Debug AppleTypes sections separately.
2921
+ if (&Sec == DwarfSections.AppleTypes ) {
2922
+ if (auto E = createAppleTypesSection ())
2923
+ return E;
2924
+ continue ;
2925
+ }
2926
+
2880
2927
// Start Subsection for one section.
2881
2928
startSection (&Sec);
2882
2929
@@ -3039,7 +3086,8 @@ void MCCASBuilder::startSection(const MCSection *Sec) {
3039
3086
Sec != DwarfSections.Abbrev && Sec != DwarfSections.StrOffsets &&
3040
3087
Sec != DwarfSections.Loclists && Sec != DwarfSections.Ranges &&
3041
3088
Sec != DwarfSections.Rangelists && Sec != DwarfSections.LineStr &&
3042
- Sec != DwarfSections.Names && Sec != DwarfSections.AppleNames )
3089
+ Sec != DwarfSections.Names && Sec != DwarfSections.AppleNames &&
3090
+ Sec != DwarfSections.AppleTypes )
3043
3091
RelMap[R.F ].push_back (R.MRE );
3044
3092
else
3045
3093
// If the fragment is nullptr, it should a section with only relocation
@@ -3258,6 +3306,8 @@ Expected<uint64_t> MCCASReader::materializeGroup(cas::ObjectRef ID) {
3258
3306
return F->materialize (*this );
3259
3307
if (auto F = AppleNamesSectionRef::Cast (*Node))
3260
3308
return F->materialize (*this );
3309
+ if (auto F = AppleTypesSectionRef::Cast (*Node))
3310
+ return F->materialize (*this );
3261
3311
if (auto F = CStringRef::Cast (*Node)) {
3262
3312
auto Size = F->materialize (OS);
3263
3313
if (!Size)
@@ -3338,6 +3388,8 @@ Expected<uint64_t> MCCASReader::materializeSection(cas::ObjectRef ID,
3338
3388
return F->materialize (*Stream);
3339
3389
if (auto F = AppleNamesRef::Cast (*Node))
3340
3390
return F->materialize (*Stream);
3391
+ if (auto F = AppleTypesRef::Cast (*Node))
3392
+ return F->materialize (*Stream);
3341
3393
if (auto F = AddendsRef::Cast (*Node))
3342
3394
// AddendsRef is already handled when materializing Atoms, skip.
3343
3395
return 0 ;
0 commit comments