[lld] 723b40a - [ELF][Hexagon] Fix host endianness assumption
Jessica Clarke via llvm-commits
llvm-commits at lists.llvm.org
Sun Aug 3 13:30:25 PDT 2025
Author: Jessica Clarke
Date: 2025-08-03T21:30:17+01:00
New Revision: 723b40a8d92f76fc913ef21061fc3d74e8c47441
URL: https://github.com/llvm/llvm-project/commit/723b40a8d92f76fc913ef21061fc3d74e8c47441
DIFF: https://github.com/llvm/llvm-project/commit/723b40a8d92f76fc913ef21061fc3d74e8c47441.diff
LOG: [ELF][Hexagon] Fix host endianness assumption
Fixes: b42f96bc057f ("[lld] Add thunks for hexagon (#111217)")
Added:
Modified:
lld/ELF/Relocations.cpp
Removed:
################################################################################
diff --git a/lld/ELF/Relocations.cpp b/lld/ELF/Relocations.cpp
index cc59070d61230..666863b700caa 100644
--- a/lld/ELF/Relocations.cpp
+++ b/lld/ELF/Relocations.cpp
@@ -2151,9 +2151,8 @@ static int getHexagonPacketOffset(const InputSection &isec,
for (unsigned i = 0;; i++) {
if (i == 3 || rel.offset < (i + 1) * 4)
return i * 4;
- uint32_t instWord = 0;
- memcpy(&instWord, data.data() + (rel.offset - (i + 1) * 4),
- sizeof(instWord));
+ uint32_t instWord =
+ read32(isec.getCtx(), data.data() + (rel.offset - (i + 1) * 4));
if (((instWord & HEXAGON_MASK_END_PACKET) == HEXAGON_END_OF_PACKET) ||
((instWord & HEXAGON_MASK_END_PACKET) == HEXAGON_END_OF_DUPLEX))
return i * 4;
More information about the llvm-commits
mailing list