llvm.org GIT mirror llvm / fe097bf
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 Saleem Abdulrasool 5 years ago
1 changed file(s) with 6 addition(s) and 5 deletion(s). Raw diff Collapse all Expand all
136136 /// +-+---+----+-----------------------+
137137 /// | more personality routine data |
138138
139 const uint32_t Word =
140 *reinterpret_cast(Contents->data() + TableEntryOffset);
139 const support::ulittle32_t Word =
140 *reinterpret_cast(Contents->data() + TableEntryOffset);
141141
142142 if (Word & 0x80000000) {
143143 SW.printString("Model", StringRef("Compact"));
199199 /// - The special bit pattern EXIDX_CANTUNWIND, indicating that associated
200200 /// frames cannot be unwound
201201
202 const uint32_t *Data = reinterpret_cast(Contents->data());
202 const support::ulittle32_t *Data =
203 reinterpret_cast(Contents->data());
203204 const unsigned Entries = IT->sh_size / IndexTableEntrySize;
204205
205206 ListScope E(SW, "Entries");
206207 for (unsigned Entry = 0; Entry < Entries; ++Entry) {
207208 DictScope E(SW, "Entry");
208209
209 const uint32_t Word0 =
210 const support::ulittle32_t Word0 =
210211 Data[Entry * (IndexTableEntrySize / sizeof(*Data)) + 0];
211 const uint32_t Word1 =
212 const support::ulittle32_t Word1 =
212213 Data[Entry * (IndexTableEntrySize / sizeof(*Data)) + 1];
213214
214215 if (Word0 & 0x80000000) {