[llvm-branch-commits] [lld] release/21.x: [ELF][Hexagon] Fix host endianness assumption (PR #151886)
github-actions[bot] wrote: @jrtc27 (or anyone else). If you would like to add a note about this fix in the release notes (completely optional). Please reply to this comment with a one or two sentence description of the fix. When you are done, please add the release:note label to this PR. https://github.com/llvm/llvm-project/pull/151886 ___ llvm-branch-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [lld] release/21.x: [ELF][Hexagon] Fix host endianness assumption (PR #151886)
https://github.com/tru closed https://github.com/llvm/llvm-project/pull/151886 ___ llvm-branch-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [lld] release/21.x: [ELF][Hexagon] Fix host endianness assumption (PR #151886)
https://github.com/tru updated https://github.com/llvm/llvm-project/pull/151886
>From 489d36cedc71b13b04a579c52ba58924bc6bafb6 Mon Sep 17 00:00:00 2001
From: Jessica Clarke
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 74a0c1e962c04a500f79d2d02b8cdf6c170c2937 Mon Sep 17 00:00:00 2001
From: Jessica Clarke
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 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 f5ad8dc6876ab667d07fe6c3bd2ac2bad434f6fb Mon Sep 17 00:00:00 2001
From: Jessica Clarke
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
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [lld] release/21.x: [ELF][Hexagon] Fix host endianness assumption (PR #151886)
https://github.com/MaskRay approved this pull request. https://github.com/llvm/llvm-project/pull/151886 ___ llvm-branch-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [lld] release/21.x: [ELF][Hexagon] Fix host endianness assumption (PR #151886)
llvmbot wrote:
@llvm/pr-subscribers-lld
Author: None (llvmbot)
Changes
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 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) {
``
https://github.com/llvm/llvm-project/pull/151886
___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [lld] release/21.x: [ELF][Hexagon] Fix host endianness assumption (PR #151886)
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
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
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 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
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
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [lld] release/21.x: [ELF][Hexagon] Fix host endianness assumption (PR #151886)
https://github.com/llvmbot milestoned https://github.com/llvm/llvm-project/pull/151886 ___ llvm-branch-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
