https://github.com/llvmbot created 
https://github.com/llvm/llvm-project/pull/151886

Backport b03d1e1e2e8e4b0b4b9e035b7ad9fb86dccefb93 
de15d365743e16848a9d15fc32ae6ab98d399ec2 
723b40a8d92f76fc913ef21061fc3d74e8c47441

Requested by: @jrtc27

>From cbbe5712035a1d0c2d8f4fcd8fa08d2a68ece047 Mon Sep 17 00:00:00 2001
From: Jessica Clarke <jrt...@jrtc27.com>
Date: Sun, 3 Aug 2025 21:22:08 +0100
Subject: [PATCH 1/3] [NFC][ELF] Add missing blank line between functions

Fixes: b42f96bc057f ("[lld] Add thunks for hexagon (#111217)")
(cherry picked from commit b03d1e1e2e8e4b0b4b9e035b7ad9fb86dccefb93)
---
 lld/ELF/Relocations.cpp | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lld/ELF/Relocations.cpp b/lld/ELF/Relocations.cpp
index 2ee308a2d1b3c..b6c676e294e44 100644
--- a/lld/ELF/Relocations.cpp
+++ b/lld/ELF/Relocations.cpp
@@ -2162,6 +2162,7 @@ static int getHexagonPacketOffset(const InputSection 
&isec,
       return i * 4;
   }
 }
+
 static int64_t getPCBias(Ctx &ctx, const InputSection &isec,
                          const Relocation &rel) {
   if (ctx.arg.emachine == EM_ARM) {

>From 66c72f4fcc729bd46fbfd3f8c216c4e8fd34bca6 Mon Sep 17 00:00:00 2001
From: Jessica Clarke <jrt...@jrtc27.com>
Date: Sun, 3 Aug 2025 21:24:10 +0100
Subject: [PATCH 2/3] [NFC][ELF][Hexagon] Avoid pointless ArrayRef::drop_front

Fixes: b42f96bc057f ("[lld] Add thunks for hexagon (#111217)")
(cherry picked from commit de15d365743e16848a9d15fc32ae6ab98d399ec2)
---
 lld/ELF/Relocations.cpp | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/lld/ELF/Relocations.cpp b/lld/ELF/Relocations.cpp
index b6c676e294e44..9549cc6f56326 100644
--- a/lld/ELF/Relocations.cpp
+++ b/lld/ELF/Relocations.cpp
@@ -2154,9 +2154,8 @@ static int getHexagonPacketOffset(const InputSection 
&isec,
     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));
+    memcpy(&instWord, data.data() + (rel.offset - (i + 1) * 4),
+           sizeof(instWord));
     if (((instWord & HEXAGON_MASK_END_PACKET) == HEXAGON_END_OF_PACKET) ||
         ((instWord & HEXAGON_MASK_END_PACKET) == HEXAGON_END_OF_DUPLEX))
       return i * 4;

>From 5af35198a3a2a9f5d174a96312d1f255592c3db9 Mon Sep 17 00:00:00 2001
From: Jessica Clarke <jrt...@jrtc27.com>
Date: Sun, 3 Aug 2025 21:28:48 +0100
Subject: [PATCH 3/3] [ELF][Hexagon] Fix host endianness assumption

Fixes: b42f96bc057f ("[lld] Add thunks for hexagon (#111217)")
(cherry picked from commit 723b40a8d92f76fc913ef21061fc3d74e8c47441)
---
 lld/ELF/Relocations.cpp | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/lld/ELF/Relocations.cpp b/lld/ELF/Relocations.cpp
index 9549cc6f56326..608cdd0d26660 100644
--- a/lld/ELF/Relocations.cpp
+++ b/lld/ELF/Relocations.cpp
@@ -2153,9 +2153,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;

_______________________________________________
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