diff --git a/lld/MachO/InputFiles.cpp b/lld/MachO/InputFiles.cpp --- a/lld/MachO/InputFiles.cpp +++ b/lld/MachO/InputFiles.cpp @@ -597,6 +597,7 @@ ArrayRef nList, const char *strtab, bool subsectionsViaSymbols) { using NList = typename LP::nlist; + size_t subsecCount = 0; // Groups indices of the symbols by the sections that contain them. std::vector> symbolsBySection(subsections.size()); @@ -621,6 +622,7 @@ SubsectionMap &subsecMap = subsections[i]; if (subsecMap.empty()) continue; + subsecCount++; std::vector &symbolIndices = symbolsBySection[i]; llvm::sort(symbolIndices, [&](uint32_t lhs, uint32_t rhs) { @@ -675,8 +677,10 @@ nextIsec->align = MinAlign(sectionAlign, sym.n_value); subsecMap.push_back({sym.n_value - sectionAddr, nextIsec}); subsecEntry = subsecMap.back(); + subsecCount++; } } + fprintf(stderr, "Created %zu subsections\n", subsecCount); } OpaqueFile::OpaqueFile(MemoryBufferRef mb, StringRef segName, diff --git a/lld/MachO/InputSection.cpp b/lld/MachO/InputSection.cpp --- a/lld/MachO/InputSection.cpp +++ b/lld/MachO/InputSection.cpp @@ -106,6 +106,7 @@ s = s.substr(size); off += size; } + fprintf(stderr, "Created %zu strings\n", pieces.size()); } StringPiece &CStringInputSection::getStringPiece(uint64_t off) { diff --git a/lld/MachO/SyntheticSections.cpp b/lld/MachO/SyntheticSections.cpp --- a/lld/MachO/SyntheticSections.cpp +++ b/lld/MachO/SyntheticSections.cpp @@ -1142,6 +1142,7 @@ } void WordLiteralSection::addInput(WordLiteralInputSection *isec) { + size_t litCount = 0; isec->parent = this; // We do all processing of the InputSection here, so it will be effectively // finalized. @@ -1150,6 +1151,7 @@ switch (sectionType(isec->flags)) { case S_4BYTE_LITERALS: { for (size_t off = 0, e = isec->data.size(); off < e; off += 4) { + ++litCount; if (!isec->isLive(off)) continue; uint32_t value = *reinterpret_cast(buf + off); @@ -1159,6 +1161,7 @@ } case S_8BYTE_LITERALS: { for (size_t off = 0, e = isec->data.size(); off < e; off += 8) { + ++litCount; if (!isec->isLive(off)) continue; uint64_t value = *reinterpret_cast(buf + off); @@ -1168,6 +1171,7 @@ } case S_16BYTE_LITERALS: { for (size_t off = 0, e = isec->data.size(); off < e; off += 16) { + ++litCount; if (!isec->isLive(off)) continue; UInt128 value = *reinterpret_cast(buf + off); @@ -1178,6 +1182,7 @@ default: llvm_unreachable("invalid literal section type"); } + fprintf(stderr, "litcount: %zu\n", litCount); } void WordLiteralSection::writeTo(uint8_t *buf) const {