[llvm] r198847 - llvm-readobj: fix endianness
Saleem Abdulrasool
compnerd at compnerd.org
Wed Jan 8 20:31:14 PST 2014
Author: compnerd
Date: Wed Jan 8 22:31:14 2014
New Revision: 198847
URL: http://llvm.org/viewvc/llvm-project?rev=198847&view=rev
Log:
llvm-readobj: fix endianness
Explicitly handle endianness to ensure that bytes are read properly on
big-endian systems.
Modified:
llvm/trunk/tools/llvm-readobj/ARMEHABIPrinter.h
Modified: llvm/trunk/tools/llvm-readobj/ARMEHABIPrinter.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-readobj/ARMEHABIPrinter.h?rev=198847&r1=198846&r2=198847&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-readobj/ARMEHABIPrinter.h (original)
+++ llvm/trunk/tools/llvm-readobj/ARMEHABIPrinter.h Wed Jan 8 22:31:14 2014
@@ -137,8 +137,8 @@ void PrinterContext<ET>::PrintExceptionT
/// +-+---+----+-----------------------+
/// | 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
/// - 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) {
More information about the llvm-commits
mailing list