+
+ switch (kind) {
+ case ELF:
+ break;
+ case MachO:
+ // Pad to multiple of 4.
+ while (StringTable.size() % 4)
+ StringTable += '\x00';
+ break;
+ case WinCOFF:
+ // Write the table size in the first word.
+ assert(StringTable.size() <= std::numeric_limits<uint32_t>::max());
+ uint32_t size = static_cast<uint32_t>(StringTable.size());
+ support::endian::write<uint32_t, support::little, support::unaligned>(
+ StringTable.data(), size);
+ break;
+ }
+}
+
+void StringTableBuilder::clear() {
+ StringTable.clear();
+ StringIndexMap.clear();