llvmbot wrote:

<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-lld

Author: None (llvmbot)

<details>
<summary>Changes</summary>

Backport b03d1e1e2e8e4b0b4b9e035b7ad9fb86dccefb93 
de15d365743e16848a9d15fc32ae6ab98d399ec2 
723b40a8d92f76fc913ef21061fc3d74e8c47441

Requested by: @<!-- -->jrtc27

---
Full diff: https://github.com/llvm/llvm-project/pull/151886.diff


1 Files Affected:

- (modified) lld/ELF/Relocations.cpp (+3-4) 


``````````diff
diff --git a/lld/ELF/Relocations.cpp b/lld/ELF/Relocations.cpp
index 2ee308a2d1b3c..608cdd0d26660 100644
--- a/lld/ELF/Relocations.cpp
+++ b/lld/ELF/Relocations.cpp
@@ -2153,15 +2153,14 @@ 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;
-    const ArrayRef<uint8_t> instWordContents =
-        data.drop_front(rel.offset - (i + 1) * 4);
-    memcpy(&instWord, instWordContents.data(), 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;
   }
 }
+
 static int64_t getPCBias(Ctx &ctx, const InputSection &isec,
                          const Relocation &rel) {
   if (ctx.arg.emachine == EM_ARM) {

``````````

</details>


https://github.com/llvm/llvm-project/pull/151886
_______________________________________________
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

Reply via email to