[libcxx-commits] [PATCH] D64402: [libunwind] Fix Unwind-EHABI.cpp:getByte on big-endian targets
Mikhail Maltsev via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Jul 9 04:49:45 PDT 2019
miyuki created this revision.
miyuki added reviewers: phosek, ostannard.
Herald added a subscriber: christof.
Herald added a project: libc++.
The function getByte is dependent on endianness and the current
behavior is incorrect on big-endian targets.
This patch fixes the issue.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D64402
Files:
libunwind/src/Unwind-EHABI.cpp
Index: libunwind/src/Unwind-EHABI.cpp
===================================================================
--- libunwind/src/Unwind-EHABI.cpp
+++ libunwind/src/Unwind-EHABI.cpp
@@ -31,7 +31,11 @@
// signinficant byte.
uint8_t getByte(const uint32_t* data, size_t offset) {
const uint8_t* byteData = reinterpret_cast<const uint8_t*>(data);
+#ifdef __LITTLE_ENDIAN__
return byteData[(offset & ~(size_t)0x03) + (3 - (offset & (size_t)0x03))];
+#else
+ return byteData[offset];
+#endif
}
const char* getNextWord(const char* data, uint32_t* out) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D64402.208643.patch
Type: text/x-patch
Size: 555 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20190709/23fb95c6/attachment.bin>
More information about the libcxx-commits
mailing list