@@ -124,14 +124,14 @@ writeAddressRanges(raw_svector_ostream &Stream,
124
124
const DebugAddressRangesVector &AddressRanges,
125
125
const bool WriteRelativeRanges = false ) {
126
126
for (const DebugAddressRange &Range : AddressRanges) {
127
- support::endian::write (Stream, Range.LowPC , support ::little);
127
+ support::endian::write (Stream, Range.LowPC , llvm::endianness ::little);
128
128
support::endian::write (
129
129
Stream, WriteRelativeRanges ? Range.HighPC - Range.LowPC : Range.HighPC ,
130
- support ::little);
130
+ llvm::endianness ::little);
131
131
}
132
132
// Finish with 0 entries.
133
- support::endian::write (Stream, 0ULL , support ::little);
134
- support::endian::write (Stream, 0ULL , support ::little);
133
+ support::endian::write (Stream, 0ULL , llvm::endianness ::little);
134
+ support::endian::write (Stream, 0ULL , llvm::endianness ::little);
135
135
return AddressRanges.size () * 16 + 16 ;
136
136
}
137
137
@@ -209,13 +209,15 @@ getDWARF5Header(const LocListsRangelistsHeader &Header) {
209
209
getDWARF5RngListLocListHeaderSize () - sizeof (UnitLengthType);
210
210
211
211
support::endian::write (*HeaderStream, Header.UnitLength + HeaderSize,
212
- support::little);
213
- support::endian::write (*HeaderStream, Header.Version , support::little);
214
- support::endian::write (*HeaderStream, Header.AddressSize , support::little);
212
+ llvm::endianness::little);
213
+ support::endian::write (*HeaderStream, Header.Version ,
214
+ llvm::endianness::little);
215
+ support::endian::write (*HeaderStream, Header.AddressSize ,
216
+ llvm::endianness::little);
215
217
support::endian::write (*HeaderStream, Header.SegmentSelector ,
216
- support ::little);
218
+ llvm::endianness ::little);
217
219
support::endian::write (*HeaderStream, Header.OffsetEntryCount ,
218
- support ::little);
220
+ llvm::endianness ::little);
219
221
return HeaderBuffer;
220
222
}
221
223
@@ -254,17 +256,18 @@ static bool emitWithBase(raw_ostream &OS, const DebugVector &Entries,
254
256
}
255
257
256
258
support::endian::write (OS, static_cast <uint8_t >(BaseAddressx),
257
- support ::little);
259
+ llvm::endianness ::little);
258
260
uint32_t BaseIndex = AddrWriter.getIndexFromAddress (Base, CU);
259
261
encodeULEB128 (BaseIndex, OS);
260
262
for (auto &OffsetEntry : Offsets) {
261
263
support::endian::write (OS, static_cast <uint8_t >(OffsetPair),
262
- support ::little);
264
+ llvm::endianness ::little);
263
265
encodeULEB128 (OffsetEntry.StartOffset , OS);
264
266
encodeULEB128 (OffsetEntry.EndOffset , OS);
265
267
Func (OffsetEntry.Index );
266
268
}
267
- support::endian::write (OS, static_cast <uint8_t >(EndOfList), support::little);
269
+ support::endian::write (OS, static_cast <uint8_t >(EndOfList),
270
+ llvm::endianness::little);
268
271
return true ;
269
272
}
270
273
@@ -291,7 +294,7 @@ DebugRangeListsSectionWriter::addRanges(DebugAddressRangesVector &Ranges) {
291
294
const DebugAddressRange &Range = Ranges[I];
292
295
support::endian::write (*CUBodyStream,
293
296
static_cast <uint8_t >(dwarf::DW_RLE_startx_length),
294
- support ::little);
297
+ llvm::endianness ::little);
295
298
uint32_t Index = AddrWriter->getIndexFromAddress (Range.LowPC , *CU);
296
299
encodeULEB128 (Index, *CUBodyStream);
297
300
encodeULEB128 (Range.HighPC - Range.LowPC , *CUBodyStream);
@@ -301,7 +304,7 @@ DebugRangeListsSectionWriter::addRanges(DebugAddressRangesVector &Ranges) {
301
304
if (WrittenStartxLength)
302
305
support::endian::write (*CUBodyStream,
303
306
static_cast <uint8_t >(dwarf::DW_RLE_end_of_list),
304
- support ::little);
307
+ llvm::endianness ::little);
305
308
CurrentOffset = CUBodyBuffer->size ();
306
309
return RangeEntries.size () - 1 ;
307
310
}
@@ -315,7 +318,7 @@ void DebugRangeListsSectionWriter::finalizeSection() {
315
318
const uint32_t SizeOfArraySection = RangeEntries.size () * SizeOfArrayEntry;
316
319
for (uint32_t Offset : RangeEntries)
317
320
support::endian::write (*CUArrayStream, Offset + SizeOfArraySection,
318
- support ::little);
321
+ llvm::endianness ::little);
319
322
320
323
std::unique_ptr<DebugBufferVector> Header = getDWARF5Header (
321
324
{static_cast <uint32_t >(SizeOfArraySection + CUBodyBuffer.get ()->size ()),
@@ -359,17 +362,17 @@ void DebugARangesSectionWriter::writeARangesSection(
359
362
uint32_t Size = 8 + 4 + 2 * sizeof (uint64_t ) * (AddressRanges.size () + 1 );
360
363
361
364
// Header field #1: set size.
362
- support::endian::write (RangesStream, Size, support ::little);
365
+ support::endian::write (RangesStream, Size, llvm::endianness ::little);
363
366
364
367
// Header field #2: version number, 2 as per the specification.
365
368
support::endian::write (RangesStream, static_cast <uint16_t >(2 ),
366
- support ::little);
369
+ llvm::endianness ::little);
367
370
368
371
assert (CUMap.count (Offset) && " Original CU offset is not found in CU Map" );
369
372
// Header field #3: debug info offset of the correspondent compile unit.
370
373
support::endian::write (
371
374
RangesStream, static_cast <uint32_t >(CUMap.find (Offset)->second .Offset ),
372
- support ::little);
375
+ llvm::endianness ::little);
373
376
374
377
// Header field #4: address size.
375
378
// 8 since we only write ELF64 binaries for now.
@@ -380,7 +383,7 @@ void DebugARangesSectionWriter::writeARangesSection(
380
383
381
384
// Padding before address table - 4 bytes in the 64-bit-pointer case.
382
385
support::endian::write (RangesStream, static_cast <uint32_t >(0 ),
383
- support ::little);
386
+ llvm::endianness ::little);
384
387
385
388
writeAddressRanges (RangesStream, AddressRanges, true );
386
389
}
@@ -473,10 +476,10 @@ void DebugAddrWriter::update(DIEBuilder &DIEBlder, DWARFUnit &CU) {
473
476
break ;
474
477
case 4 :
475
478
support::endian::write (*AddressStream, static_cast <uint32_t >(Address),
476
- support ::little);
479
+ llvm::endianness ::little);
477
480
break ;
478
481
case 8 :
479
- support::endian::write (*AddressStream, Address, support ::little);
482
+ support::endian::write (*AddressStream, Address, llvm::endianness ::little);
480
483
break ;
481
484
}
482
485
};
@@ -492,11 +495,12 @@ void DebugAddrWriter::update(DIEBuilder &DIEBlder, DWARFUnit &CU) {
492
495
void DebugAddrWriterDwarf5::update (DIEBuilder &DIEBlder, DWARFUnit &CU) {
493
496
// Need to layout all sections within .debug_addr
494
497
// Within each section sort Address by index.
495
- const endianness Endian =
496
- BC->DwCtx ->isLittleEndian () ? support::little : support::big;
498
+ const endianness Endian = BC->DwCtx ->isLittleEndian ()
499
+ ? llvm::endianness::little
500
+ : llvm::endianness::big;
497
501
const DWARFSection &AddrSec = BC->DwCtx ->getDWARFObj ().getAddrSection ();
498
502
DWARFDataExtractor AddrData (BC->DwCtx ->getDWARFObj (), AddrSec,
499
- Endian == support ::little, 0 );
503
+ Endian == llvm::endianness ::little, 0 );
500
504
DWARFDebugAddrTable AddrTable;
501
505
DIDumpOptions DumpOpts;
502
506
constexpr uint32_t HeaderSize = 8 ;
@@ -594,11 +598,11 @@ void DebugLocWriter::addList(DIEBuilder &DIEBldr, DIE &Die, DIEValue &AttrInfo,
594
598
595
599
for (const DebugLocationEntry &Entry : LocList) {
596
600
support::endian::write (*LocStream, static_cast <uint64_t >(Entry.LowPC ),
597
- support ::little);
601
+ llvm::endianness ::little);
598
602
support::endian::write (*LocStream, static_cast <uint64_t >(Entry.HighPC ),
599
- support ::little);
603
+ llvm::endianness ::little);
600
604
support::endian::write (*LocStream, static_cast <uint16_t >(Entry.Expr .size ()),
601
- support ::little);
605
+ llvm::endianness ::little);
602
606
*LocStream << StringRef (reinterpret_cast <const char *>(Entry.Expr .data ()),
603
607
Entry.Expr .size ());
604
608
LocSectionOffset += 2 * 8 + 2 + Entry.Expr .size ();
@@ -618,15 +622,17 @@ std::unique_ptr<DebugBufferVector> DebugLocWriter::getBuffer() {
618
622
void DebugLocWriter::finalize (DIEBuilder &DIEBldr, DIE &Die) {}
619
623
620
624
static void writeEmptyListDwarf5 (raw_svector_ostream &Stream) {
621
- support::endian::write (Stream, static_cast <uint32_t >(4 ), support::little);
625
+ support::endian::write (Stream, static_cast <uint32_t >(4 ),
626
+ llvm::endianness::little);
622
627
support::endian::write (Stream, static_cast <uint8_t >(dwarf::DW_LLE_start_end),
623
- support ::little);
628
+ llvm::endianness ::little);
624
629
625
630
const char Zeroes[16 ] = {0 };
626
631
Stream << StringRef (Zeroes, 16 );
627
632
encodeULEB128 (0 , Stream);
628
- support::endian::write (
629
- Stream, static_cast <uint8_t >(dwarf::DW_LLE_end_of_list), support::little);
633
+ support::endian::write (Stream,
634
+ static_cast <uint8_t >(dwarf::DW_LLE_end_of_list),
635
+ llvm::endianness::little);
630
636
}
631
637
632
638
static void writeLegacyLocList (DIEValue &AttrInfo,
@@ -645,21 +651,21 @@ static void writeLegacyLocList(DIEValue &AttrInfo,
645
651
for (const DebugLocationEntry &Entry : LocList) {
646
652
support::endian::write (LocStream,
647
653
static_cast <uint8_t >(dwarf::DW_LLE_startx_length),
648
- support ::little);
654
+ llvm::endianness ::little);
649
655
const uint32_t Index = AddrWriter.getIndexFromAddress (Entry.LowPC , CU);
650
656
encodeULEB128 (Index, LocStream);
651
657
652
658
support::endian::write (LocStream,
653
659
static_cast <uint32_t >(Entry.HighPC - Entry.LowPC ),
654
- support ::little);
660
+ llvm::endianness ::little);
655
661
support::endian::write (LocStream, static_cast <uint16_t >(Entry.Expr .size ()),
656
- support ::little);
662
+ llvm::endianness ::little);
657
663
LocStream << StringRef (reinterpret_cast <const char *>(Entry.Expr .data ()),
658
664
Entry.Expr .size ());
659
665
}
660
666
support::endian::write (LocStream,
661
667
static_cast <uint8_t >(dwarf::DW_LLE_end_of_list),
662
- support ::little);
668
+ llvm::endianness ::little);
663
669
replaceLocValbyForm (DIEBldr, Die, AttrInfo, AttrInfo.getForm (), EntryOffset);
664
670
}
665
671
@@ -701,7 +707,7 @@ static void writeDWARF5LocList(uint32_t &NumberOfEntries, DIEValue &AttrInfo,
701
707
const DebugLocationEntry &Entry = LocList[I];
702
708
support::endian::write (LocBodyStream,
703
709
static_cast <uint8_t >(dwarf::DW_LLE_startx_length),
704
- support ::little);
710
+ llvm::endianness ::little);
705
711
const uint32_t Index = AddrWriter.getIndexFromAddress (Entry.LowPC , CU);
706
712
encodeULEB128 (Index, LocBodyStream);
707
713
encodeULEB128 (Entry.HighPC - Entry.LowPC , LocBodyStream);
@@ -713,7 +719,7 @@ static void writeDWARF5LocList(uint32_t &NumberOfEntries, DIEValue &AttrInfo,
713
719
if (WrittenStartxLength)
714
720
support::endian::write (LocBodyStream,
715
721
static_cast <uint8_t >(dwarf::DW_LLE_end_of_list),
716
- support ::little);
722
+ llvm::endianness ::little);
717
723
}
718
724
719
725
void DebugLoclistWriter::addList (DIEBuilder &DIEBldr, DIE &Die,
@@ -753,7 +759,7 @@ void DebugLoclistWriter::finalizeDWARF5(DIEBuilder &DIEBldr, DIE &Die) {
753
759
support::endian::write (
754
760
*LocArrayStream,
755
761
static_cast <uint32_t >(SizeOfArraySection + RelativeOffset),
756
- support ::little);
762
+ llvm::endianness ::little);
757
763
758
764
std::unique_ptr<DebugBufferVector> Header = getDWARF5Header (
759
765
{static_cast <uint32_t >(SizeOfArraySection + LocBodyBuffer.get ()->size ()),
@@ -884,11 +890,11 @@ void DebugStrOffsetsWriter::finalizeSection(DWARFUnit &Unit,
884
890
if (RetVal == ProcessedBaseOffsets.end () || StrOffsetSectionWasModified) {
885
891
// Writing out the header for each section.
886
892
support::endian::write (*StrOffsetsStream, CurrentSectionSize + 4 ,
887
- support ::little);
893
+ llvm::endianness ::little);
888
894
support::endian::write (*StrOffsetsStream, static_cast <uint16_t >(5 ),
889
- support ::little);
895
+ llvm::endianness ::little);
890
896
support::endian::write (*StrOffsetsStream, static_cast <uint16_t >(0 ),
891
- support ::little);
897
+ llvm::endianness ::little);
892
898
893
899
uint64_t BaseOffset = StrOffsetsBuffer->size ();
894
900
ProcessedBaseOffsets[*Val] = BaseOffset;
@@ -897,7 +903,8 @@ void DebugStrOffsetsWriter::finalizeSection(DWARFUnit &Unit,
897
903
StrListBaseAttrInfo.getForm (),
898
904
DIEInteger (BaseOffset));
899
905
for (const auto &Entry : IndexToAddressMap)
900
- support::endian::write (*StrOffsetsStream, Entry.second , support::little);
906
+ support::endian::write (*StrOffsetsStream, Entry.second ,
907
+ llvm::endianness::little);
901
908
} else {
902
909
DIEBldr.replaceValue (&Die, dwarf::DW_AT_str_offsets_base,
903
910
StrListBaseAttrInfo.getForm (),
0 commit comments