@@ -863,6 +863,20 @@ DebugNamesSectionRef::create(MCCASBuilder &MB,
863
863
return get (B->build ());
864
864
}
865
865
866
+ Expected<AppleNamesSectionRef>
867
+ AppleNamesSectionRef::create (MCCASBuilder &MB,
868
+ ArrayRef<cas::ObjectRef> Fragments) {
869
+ Expected<Builder> B = Builder::startNode (MB.Schema , KindString);
870
+ if (!B)
871
+ return B.takeError ();
872
+
873
+ if (auto E = createGenericDebugSection<AppleNamesSectionRef>(
874
+ MB, Fragments, B->Data , B->Refs ))
875
+ return E;
876
+
877
+ return get (B->build ());
878
+ }
879
+
866
880
Expected<uint64_t > SectionRef::materialize (MCCASReader &Reader,
867
881
raw_ostream *Stream) const {
868
882
// Start a new section for relocations.
@@ -1371,6 +1385,14 @@ DebugNamesSectionRef::materialize(MCCASReader &Reader,
1371
1385
*this );
1372
1386
}
1373
1387
1388
+ Expected<uint64_t >
1389
+ AppleNamesSectionRef::materialize (MCCASReader &Reader,
1390
+ raw_ostream *Stream) const {
1391
+ StringRef Remaining = getData ();
1392
+ return materializeGenericDebugSection<AppleNamesSectionRef>(Reader, Remaining,
1393
+ *this );
1394
+ }
1395
+
1374
1396
Expected<AtomRef> AtomRef::create (MCCASBuilder &MB,
1375
1397
ArrayRef<cas::ObjectRef> Fragments) {
1376
1398
Expected<Builder> B = Builder::startNode (MB.Schema , KindString);
@@ -1706,7 +1728,8 @@ DwarfSectionsCache mccasformats::v1::getDwarfSections(MCAssembler &Asm) {
1706
1728
Asm.getContext ().getObjectFileInfo ()->getDwarfRangesSection (),
1707
1729
Asm.getContext ().getObjectFileInfo ()->getDwarfRnglistsSection (),
1708
1730
Asm.getContext ().getObjectFileInfo ()->getDwarfLineStrSection (),
1709
- Asm.getContext ().getObjectFileInfo ()->getDwarfDebugNamesSection ()};
1731
+ Asm.getContext ().getObjectFileInfo ()->getDwarfDebugNamesSection (),
1732
+ Asm.getContext ().getObjectFileInfo ()->getDwarfAccelNamesSection ()};
1710
1733
}
1711
1734
1712
1735
Error MCCASBuilder::prepare () {
@@ -2650,6 +2673,23 @@ Error MCCASBuilder::createDebugNamesSection() {
2650
2673
return finalizeSection<DebugNamesSectionRef>();
2651
2674
}
2652
2675
2676
+ Error MCCASBuilder::createAppleNamesSection () {
2677
+
2678
+ auto MaybeAppleNamesRef =
2679
+ createGenericDebugRef<AppleNamesRef>(DwarfSections.AppleNames );
2680
+ if (!MaybeAppleNamesRef)
2681
+ return Error::success ();
2682
+
2683
+ if (!*MaybeAppleNamesRef)
2684
+ return MaybeAppleNamesRef->takeError ();
2685
+
2686
+ startSection (DwarfSections.AppleNames );
2687
+ addNode (**MaybeAppleNamesRef);
2688
+ if (auto E = createPaddingRef (DwarfSections.AppleNames ))
2689
+ return E;
2690
+ return finalizeSection<AppleNamesSectionRef>();
2691
+ }
2692
+
2653
2693
static ArrayRef<char > getFragmentContents (const MCFragment &Fragment) {
2654
2694
switch (Fragment.getKind ()) {
2655
2695
#define MCFRAGMENT_NODE_REF (MCFragmentName, MCEnumName, MCEnumIdentifier ) \
@@ -2830,6 +2870,13 @@ Error MCCASBuilder::buildFragments() {
2830
2870
continue ;
2831
2871
}
2832
2872
2873
+ // Handle Debug AppleNames sections separately.
2874
+ if (&Sec == DwarfSections.AppleNames ) {
2875
+ if (auto E = createAppleNamesSection ())
2876
+ return E;
2877
+ continue ;
2878
+ }
2879
+
2833
2880
// Start Subsection for one section.
2834
2881
startSection (&Sec);
2835
2882
@@ -2992,7 +3039,7 @@ void MCCASBuilder::startSection(const MCSection *Sec) {
2992
3039
Sec != DwarfSections.Abbrev && Sec != DwarfSections.StrOffsets &&
2993
3040
Sec != DwarfSections.Loclists && Sec != DwarfSections.Ranges &&
2994
3041
Sec != DwarfSections.Rangelists && Sec != DwarfSections.LineStr &&
2995
- Sec != DwarfSections.Names )
3042
+ Sec != DwarfSections.Names && Sec != DwarfSections. AppleNames )
2996
3043
RelMap[R.F ].push_back (R.MRE );
2997
3044
else
2998
3045
// If the fragment is nullptr, it should a section with only relocation
@@ -3209,6 +3256,8 @@ Expected<uint64_t> MCCASReader::materializeGroup(cas::ObjectRef ID) {
3209
3256
return F->materialize (*this );
3210
3257
if (auto F = DebugNamesSectionRef::Cast (*Node))
3211
3258
return F->materialize (*this );
3259
+ if (auto F = AppleNamesSectionRef::Cast (*Node))
3260
+ return F->materialize (*this );
3212
3261
if (auto F = CStringRef::Cast (*Node)) {
3213
3262
auto Size = F->materialize (OS);
3214
3263
if (!Size)
@@ -3287,6 +3336,8 @@ Expected<uint64_t> MCCASReader::materializeSection(cas::ObjectRef ID,
3287
3336
return F->materialize (*Stream);
3288
3337
if (auto F = DebugNamesRef::Cast (*Node))
3289
3338
return F->materialize (*Stream);
3339
+ if (auto F = AppleNamesRef::Cast (*Node))
3340
+ return F->materialize (*Stream);
3290
3341
if (auto F = AddendsRef::Cast (*Node))
3291
3342
// AddendsRef is already handled when materializing Atoms, skip.
3292
3343
return 0 ;
0 commit comments