mirror of
https://github.com/RPCS3/llvm.git
synced 2025-02-02 00:35:27 +00:00
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
This commit is contained in:
parent
6fc76f3ec4
commit
fe097bffa7
@ -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) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user