summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSaleem Abdulrasool <compnerd@compnerd.org>2014-01-09 04:31:14 +0000
committerSaleem Abdulrasool <compnerd@compnerd.org>2014-01-09 04:31:14 +0000
commitfe097bffa73ee232ed23ce503a352556674aa4f3 (patch)
treeb10fa3a4eb8c38085dbf8e35e6ba06f654b88218
parent6fc76f3ec418d8e96cbbd0dcba90fa4026940785 (diff)
llvm-readobj: fix endianness
Explicitly handle endianness to ensure that bytes are read properly on big-endian systems. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@198847 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--tools/llvm-readobj/ARMEHABIPrinter.h11
1 files changed, 6 insertions, 5 deletions
diff --git a/tools/llvm-readobj/ARMEHABIPrinter.h b/tools/llvm-readobj/ARMEHABIPrinter.h
index f6c14b9610d..754733f6b42 100644
--- a/tools/llvm-readobj/ARMEHABIPrinter.h
+++ b/tools/llvm-readobj/ARMEHABIPrinter.h
@@ -137,8 +137,8 @@ void PrinterContext<ET>::PrintExceptionTable(const Elf_Shdr *IT,
/// +-+---+----+-----------------------+
/// | more personality routine data |
- const uint32_t Word =
- *reinterpret_cast<const uint32_t *>(Contents->data() + TableEntryOffset);
+ const support::ulittle32_t Word =
+ *reinterpret_cast<const support::ulittle32_t *>(Contents->data() + TableEntryOffset);
if (Word & 0x80000000) {
SW.printString("Model", StringRef("Compact"));
@@ -200,16 +200,17 @@ void PrinterContext<ET>::PrintIndexTable(unsigned SectionIndex,
/// - The special bit pattern EXIDX_CANTUNWIND, indicating that associated
/// frames cannot be unwound
- const uint32_t *Data = reinterpret_cast<const uint32_t *>(Contents->data());
+ const support::ulittle32_t *Data =
+ reinterpret_cast<const support::ulittle32_t *>(Contents->data());
const unsigned Entries = IT->sh_size / IndexTableEntrySize;
ListScope E(SW, "Entries");
for (unsigned Entry = 0; Entry < Entries; ++Entry) {
DictScope E(SW, "Entry");
- const uint32_t Word0 =
+ const support::ulittle32_t Word0 =
Data[Entry * (IndexTableEntrySize / sizeof(*Data)) + 0];
- const uint32_t Word1 =
+ const support::ulittle32_t Word1 =
Data[Entry * (IndexTableEntrySize / sizeof(*Data)) + 1];
if (Word0 & 0x80000000) {