Skip to content

Commit 723b40a

Browse files
committed
[ELF][Hexagon] Fix host endianness assumption
Fixes: b42f96b ("[lld] Add thunks for hexagon (#111217)")
1 parent de15d36 commit 723b40a

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

lld/ELF/Relocations.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2151,9 +2151,8 @@ static int getHexagonPacketOffset(const InputSection &isec,
21512151
for (unsigned i = 0;; i++) {
21522152
if (i == 3 || rel.offset < (i + 1) * 4)
21532153
return i * 4;
2154-
uint32_t instWord = 0;
2155-
memcpy(&instWord, data.data() + (rel.offset - (i + 1) * 4),
2156-
sizeof(instWord));
2154+
uint32_t instWord =
2155+
read32(isec.getCtx(), data.data() + (rel.offset - (i + 1) * 4));
21572156
if (((instWord & HEXAGON_MASK_END_PACKET) == HEXAGON_END_OF_PACKET) ||
21582157
((instWord & HEXAGON_MASK_END_PACKET) == HEXAGON_END_OF_DUPLEX))
21592158
return i * 4;

0 commit comments

Comments
 (0)