diff options
author | Mikhail Maltsev <mikhail.maltsev@arm.com> | 2019-07-09 15:29:06 +0000 |
---|---|---|
committer | Mikhail Maltsev <mikhail.maltsev@arm.com> | 2019-07-09 15:29:06 +0000 |
commit | a448ed99dfdb54c62f77cfd3bc9929fe7fc8d555 (patch) | |
tree | 3e1f269d3c137849a4e47a5f909c7299429a60cf | |
parent | 57603cbde8b8333df233eb04841bc1b77e1747d1 (diff) | |
download | bcm5719-llvm-a448ed99dfdb54c62f77cfd3bc9929fe7fc8d555.tar.gz bcm5719-llvm-a448ed99dfdb54c62f77cfd3bc9929fe7fc8d555.zip |
[libunwind] Fix Unwind-EHABI.cpp:getByte on big-endian targets
Summary:
The function getByte is dependent on endianness and the current
behavior is incorrect on big-endian targets.
This patch fixes the issue.
Reviewers: phosek, ostannard, dmgreen, christof, chill
Reviewed By: ostannard, chill
Subscribers: chill, christof, libcxx-commits
Tags: #libc
Differential Revision: https://reviews.llvm.org/D64402
llvm-svn: 365505
-rw-r--r-- | libunwind/src/Unwind-EHABI.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/libunwind/src/Unwind-EHABI.cpp b/libunwind/src/Unwind-EHABI.cpp index f4558231a0e..4ff5e318b5f 100644 --- a/libunwind/src/Unwind-EHABI.cpp +++ b/libunwind/src/Unwind-EHABI.cpp @@ -31,7 +31,11 @@ namespace { // 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) { |