summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Object/WindowsResource.cpp
diff options
context:
space:
mode:
authorEric Beckmann <ecbeckmann@google.com>2017-06-13 20:53:31 +0000
committerEric Beckmann <ecbeckmann@google.com>2017-06-13 20:53:31 +0000
commit1f76ca5a2d1ddebdd81690a2891c11359e805ea9 (patch)
treeeaf634760a34c661418af1b1f4895a73c397dd27 /llvm/lib/Object/WindowsResource.cpp
parent8015f885255c85810b7082e0585d40a1460fe35e (diff)
downloadbcm5719-llvm-1f76ca5a2d1ddebdd81690a2891c11359e805ea9.tar.gz
bcm5719-llvm-1f76ca5a2d1ddebdd81690a2891c11359e805ea9.zip
Fix a bug introduced in r305092 on big-endian systems.
Summary: We were writing the length of the string based on system-endianness, and not universally little-endian. This fixes that. Reviewers: zturner Subscribers: hiraditya, llvm-commits Differential Revision: https://reviews.llvm.org/D34159 llvm-svn: 305322
Diffstat (limited to 'llvm/lib/Object/WindowsResource.cpp')
-rw-r--r--llvm/lib/Object/WindowsResource.cpp4
1 files changed, 1 insertions, 3 deletions
diff --git a/llvm/lib/Object/WindowsResource.cpp b/llvm/lib/Object/WindowsResource.cpp
index fdf4690e604..a1a0d96acbc 100644
--- a/llvm/lib/Object/WindowsResource.cpp
+++ b/llvm/lib/Object/WindowsResource.cpp
@@ -691,10 +691,8 @@ void WindowsResourceCOFFWriter::writeDirectoryStringTable() {
// Now write the directory string table for .rsrc$01
uint32_t TotalStringTableSize = 0;
for (auto String : StringTable) {
- auto *LengthField =
- reinterpret_cast<uint16_t *>(BufferStart + CurrentOffset);
uint16_t Length = String.size();
- *LengthField = Length;
+ support::endian::write16le(BufferStart + CurrentOffset, Length);
CurrentOffset += sizeof(uint16_t);
auto *Start = reinterpret_cast<UTF16 *>(BufferStart + CurrentOffset);
std::copy(String.begin(), String.end(), Start);
OpenPOWER on IntegriCloud