Skip to content

Commit a448ed9

Browse files
committed
[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
1 parent 57603cb commit a448ed9

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

libunwind/src/Unwind-EHABI.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,11 @@ namespace {
3131
// signinficant byte.
3232
uint8_t getByte(const uint32_t* data, size_t offset) {
3333
const uint8_t* byteData = reinterpret_cast<const uint8_t*>(data);
34+
#ifdef __LITTLE_ENDIAN__
3435
return byteData[(offset & ~(size_t)0x03) + (3 - (offset & (size_t)0x03))];
36+
#else
37+
return byteData[offset];
38+
#endif
3539
}
3640

3741
const char* getNextWord(const char* data, uint32_t* out) {

0 commit comments

Comments
 (0)