Skip to content

Commit 5bd269a

Browse files
cmticeMaskRay
authored andcommitted
[lld][ELF] Implement merged .debug_names section.
Replace "ELFT::TargetEndianness" with "ELFT::Endianness"
1 parent afc5767 commit 5bd269a

File tree

1 file changed

+16
-20
lines changed

1 file changed

+16
-20
lines changed

lld/ELF/SyntheticSections.cpp

Lines changed: 16 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2770,25 +2770,22 @@ template <class ELFT> void DebugNamesSection<ELFT>::writeTo(uint8_t *buf) {
27702770
// Write out bytes for merged section.
27712771

27722772
// Write the header.
2773-
endian::write32<ELFT::TargetEndianness>(buf + 0, mergedHdr.UnitLength);
2774-
endian::write16<ELFT::TargetEndianness>(buf + 4, mergedHdr.Version);
2775-
endian::write32<ELFT::TargetEndianness>(buf + 8, mergedHdr.CompUnitCount);
2776-
endian::write32<ELFT::TargetEndianness>(buf + 12,
2777-
mergedHdr.LocalTypeUnitCount);
2778-
endian::write32<ELFT::TargetEndianness>(buf + 16,
2779-
mergedHdr.ForeignTypeUnitCount);
2780-
endian::write32<ELFT::TargetEndianness>(buf + 20, mergedHdr.BucketCount);
2781-
endian::write32<ELFT::TargetEndianness>(buf + 24, mergedHdr.NameCount);
2782-
endian::write32<ELFT::TargetEndianness>(buf + 28, mergedHdr.AbbrevTableSize);
2783-
endian::write32<ELFT::TargetEndianness>(buf + 32,
2784-
mergedHdr.AugmentationStringSize);
2773+
endian::write32<ELFT::Endianness>(buf + 0, mergedHdr.UnitLength);
2774+
endian::write16<ELFT::Endianness>(buf + 4, mergedHdr.Version);
2775+
endian::write32<ELFT::Endianness>(buf + 8, mergedHdr.CompUnitCount);
2776+
endian::write32<ELFT::Endianness>(buf + 12, mergedHdr.LocalTypeUnitCount);
2777+
endian::write32<ELFT::Endianness>(buf + 16, mergedHdr.ForeignTypeUnitCount);
2778+
endian::write32<ELFT::Endianness>(buf + 20, mergedHdr.BucketCount);
2779+
endian::write32<ELFT::Endianness>(buf + 24, mergedHdr.NameCount);
2780+
endian::write32<ELFT::Endianness>(buf + 28, mergedHdr.AbbrevTableSize);
2781+
endian::write32<ELFT::Endianness>(buf + 32, mergedHdr.AugmentationStringSize);
27852782
buf += 36;
27862783
memcpy(buf, mergedHdr.AugmentationString.c_str(), 8);
27872784
buf += 8;
27882785

27892786
// Write the CU list.
27902787
for (uint32_t offset : mergedCuOffsets) {
2791-
endian::write32<ELFT::TargetEndianness>(buf + 0, offset);
2788+
endian::write32<ELFT::Endianness>(buf + 0, offset);
27922789
buf += 4;
27932790
}
27942791

@@ -2807,7 +2804,7 @@ template <class ELFT> void DebugNamesSection<ELFT>::writeTo(uint8_t *buf) {
28072804
uint32_t idx = 1;
28082805
for (const auto &bucket : bucketList) {
28092806
if (!bucket.empty())
2810-
endian::write32<ELFT::TargetEndianness>(buf + 0, idx);
2807+
endian::write32<ELFT::Endianness>(buf + 0, idx);
28112808
idx += bucket.size();
28122809
buf += 4;
28132810
}
@@ -2816,21 +2813,20 @@ template <class ELFT> void DebugNamesSection<ELFT>::writeTo(uint8_t *buf) {
28162813
for (const auto &bucket : bucketList) {
28172814
for (const auto &entry : bucket) {
28182815
uint32_t hashValue = entry->hashValue;
2819-
endian::write32<ELFT::TargetEndianness>(buf + 0, hashValue);
2816+
endian::write32<ELFT::Endianness>(buf + 0, hashValue);
28202817
buf += 4;
28212818
}
28222819
}
28232820

28242821
// Write the string offsets.
28252822
for (const auto &entry : mergedEntries) {
2826-
endian::write32<ELFT::TargetEndianness>(buf + 0,
2827-
entry.relocatedEntryOffset);
2823+
endian::write32<ELFT::Endianness>(buf + 0, entry.relocatedEntryOffset);
28282824
buf += 4;
28292825
}
28302826

28312827
// Write the entry offsets.
28322828
for (const auto &entry : mergedEntries) {
2833-
endian::write32<ELFT::TargetEndianness>(buf + 0, entry.entryOffset);
2829+
endian::write32<ELFT::Endianness>(buf + 0, entry.entryOffset);
28342830
buf += 4;
28352831
}
28362832

@@ -2842,7 +2838,7 @@ template <class ELFT> void DebugNamesSection<ELFT>::writeTo(uint8_t *buf) {
28422838
buf += encodeULEB128(attr.Index, buf);
28432839
buf += encodeULEB128(attr.Form, buf);
28442840
}
2845-
endian::write16<ELFT::TargetEndianness>(buf + 0, 0); // attribute sentinels.
2841+
endian::write16<ELFT::Endianness>(buf + 0, 0); // attribute sentinels.
28462842
buf += 2;
28472843
}
28482844
*buf++ = 0; // abbrev table sentinel
@@ -2853,7 +2849,7 @@ template <class ELFT> void DebugNamesSection<ELFT>::writeTo(uint8_t *buf) {
28532849
for (const auto &entry : stringEntry.indexEntries) {
28542850
buf += encodeULEB128(entry->abbrevCode, buf);
28552851
for (const auto &value : entry->attrValues) {
2856-
endian::write32<ELFT::TargetEndianness>(buf + 0, value.attrValue);
2852+
endian::write32<ELFT::Endianness>(buf + 0, value.attrValue);
28572853
buf += value.attrSize;
28582854
}
28592855
}

0 commit comments

Comments
 (0)