summaryrefslogtreecommitdiff
path: root/lib/MC/StringTableBuilder.cpp
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2019-10-23 17:51:42 +0000
committerDimitry Andric <dim@FreeBSD.org>2019-10-23 17:51:42 +0000
commit1d5ae1026e831016fc29fd927877c86af904481f (patch)
tree2cdfd12620fcfa5d9e4a0389f85368e8e36f63f9 /lib/MC/StringTableBuilder.cpp
parente6d1592492a3a379186bfb02bd0f4eda0669c0d5 (diff)
Notes
Diffstat (limited to 'lib/MC/StringTableBuilder.cpp')
-rw-r--r--lib/MC/StringTableBuilder.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/MC/StringTableBuilder.cpp b/lib/MC/StringTableBuilder.cpp
index cb3db8e2268c..c9c88ec58432 100644
--- a/lib/MC/StringTableBuilder.cpp
+++ b/lib/MC/StringTableBuilder.cpp
@@ -38,6 +38,7 @@ void StringTableBuilder::initSize() {
// Start the table with a NUL byte.
Size = 1;
break;
+ case XCOFF:
case WinCOFF:
// Make room to write the table size later.
Size = 4;
@@ -67,9 +68,12 @@ void StringTableBuilder::write(uint8_t *Buf) const {
if (!Data.empty())
memcpy(Buf + P.second, Data.data(), Data.size());
}
- if (K != WinCOFF)
- return;
- support::endian::write32le(Buf, Size);
+ // The COFF formats store the size of the string table in the first 4 bytes.
+ // For Windows, the format is little-endian; for AIX, it is big-endian.
+ if (K == WinCOFF)
+ support::endian::write32le(Buf, Size);
+ else if (K == XCOFF)
+ support::endian::write32be(Buf, Size);
}
// Returns the character at Pos from end of a string.