-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
rust180: make big-endian aarch64 build again.
This is done by conditionalizing use of the neon SIMD extensions on the target being little-endian. Ref. rust-lang/rust#129819
- Loading branch information
Showing
12 changed files
with
441 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
rust180/patches/patch-tools_rust-analyzer_lib_line-index-src_lib.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
$NetBSD$ | ||
|
||
Try to avoid using neon for big-endian aarch64. | ||
Ref. https://github.com/rust-lang/rust/issues/129819 | ||
|
||
--- src/tools/rust-analyzer/lib/line-index/src/lib.rs.orig 2024-09-01 14:12:57.016998002 +0000 | ||
+++ src/tools/rust-analyzer/lib/line-index/src/lib.rs | ||
@@ -227,7 +227,7 @@ fn analyze_source_file_dispatch( | ||
} | ||
} | ||
|
||
-#[cfg(target_arch = "aarch64")] | ||
+#[cfg(all(target_arch = "aarch64", target_endian = "little"))] | ||
fn analyze_source_file_dispatch( | ||
src: &str, | ||
lines: &mut Vec<TextSize>, | ||
@@ -339,7 +339,7 @@ unsafe fn analyze_source_file_sse2( | ||
} | ||
|
||
#[target_feature(enable = "neon")] | ||
-#[cfg(target_arch = "aarch64")] | ||
+#[cfg(all(target_arch = "aarch64", target_endian = "little"))] | ||
#[inline] | ||
// See https://community.arm.com/arm-community-blogs/b/infrastructure-solutions-blog/posts/porting-x86-vector-bitmask-optimizations-to-arm-neon | ||
// | ||
@@ -354,7 +354,7 @@ unsafe fn move_mask(v: std::arch::aarch6 | ||
} | ||
|
||
#[target_feature(enable = "neon")] | ||
-#[cfg(target_arch = "aarch64")] | ||
+#[cfg(all(target_arch = "aarch64", target_endian = "little"))] | ||
unsafe fn analyze_source_file_neon( | ||
src: &str, | ||
lines: &mut Vec<TextSize>, | ||
@@ -433,7 +433,11 @@ unsafe fn analyze_source_file_neon( | ||
} | ||
} | ||
|
||
-#[cfg(not(any(target_arch = "x86", target_arch = "x86_64", target_arch = "aarch64")))] | ||
+#[cfg(not(any( | ||
+ target_arch = "x86", | ||
+ target_arch = "x86_64", | ||
+ all(target_arch = "aarch64", target_endian = "little") | ||
+)))] | ||
// The target (or compiler version) does not support SSE2 ... | ||
fn analyze_source_file_dispatch( | ||
src: &str, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
$NetBSD$ | ||
|
||
Avoid using neon on big-endian aarch64. | ||
Ref. https://github.com/rust-lang/rust/issues/129819 | ||
|
||
--- vendor/bytecount-0.6.8/src/lib.rs.orig 2024-09-01 16:29:37.478735730 +0000 | ||
+++ vendor/bytecount-0.6.8/src/lib.rs | ||
@@ -50,7 +50,10 @@ mod integer_simd; | ||
feature = "runtime-dispatch-simd", | ||
any(target_arch = "x86", target_arch = "x86_64") | ||
), | ||
- target_arch = "aarch64", | ||
+ all( | ||
+ target_arch = "aarch64", | ||
+ target_endian = "little" | ||
+ ), | ||
target_arch = "wasm32", | ||
feature = "generic-simd" | ||
))] | ||
@@ -93,7 +96,11 @@ pub fn count(haystack: &[u8], needle: u8 | ||
} | ||
} | ||
} | ||
- #[cfg(all(target_arch = "aarch64", not(feature = "generic_simd")))] | ||
+ #[cfg(all( | ||
+ target_arch = "aarch64", | ||
+ target_endian = "little", | ||
+ not(feature = "generic_simd") | ||
+ ))] | ||
{ | ||
unsafe { | ||
return simd::aarch64::chunk_count(haystack, needle); | ||
@@ -155,7 +162,11 @@ pub fn num_chars(utf8_chars: &[u8]) -> u | ||
} | ||
} | ||
} | ||
- #[cfg(all(target_arch = "aarch64", not(feature = "generic_simd")))] | ||
+ #[cfg(all( | ||
+ target_arch = "aarch64", | ||
+ target_endian = "little", | ||
+ not(feature = "generic_simd") | ||
+ ))] | ||
{ | ||
unsafe { | ||
return simd::aarch64::chunk_num_chars(utf8_chars); |
25 changes: 25 additions & 0 deletions
25
rust180/patches/patch-vendor_memchr-2.7.2_src_arch_aarch64_memchr.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
$NetBSD$ | ||
|
||
Turn off use of neon on big-endian aarch64. | ||
Ref. https://github.com/rust-lang/rust/issues/129819 | ||
|
||
--- vendor/memchr-2.7.2/src/arch/aarch64/memchr.rs.orig 2024-08-31 22:23:54.486083582 +0000 | ||
+++ vendor/memchr-2.7.2/src/arch/aarch64/memchr.rs | ||
@@ -8,7 +8,7 @@ available for `aarch64` targets.) | ||
|
||
macro_rules! defraw { | ||
($ty:ident, $find:ident, $start:ident, $end:ident, $($needles:ident),+) => {{ | ||
- #[cfg(target_feature = "neon")] | ||
+ #[cfg(all(target_feature = "neon", target_endian = "little"))] | ||
{ | ||
use crate::arch::aarch64::neon::memchr::$ty; | ||
|
||
@@ -19,7 +19,7 @@ macro_rules! defraw { | ||
// enabled. | ||
$ty::new_unchecked($($needles),+).$find($start, $end) | ||
} | ||
- #[cfg(not(target_feature = "neon"))] | ||
+ #[cfg(not(all(target_feature = "neon", target_endian = "little")))] | ||
{ | ||
use crate::arch::all::memchr::$ty; | ||
|
16 changes: 16 additions & 0 deletions
16
rust180/patches/patch-vendor_memchr-2.7.2_src_arch_aarch64_mod.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
$NetBSD$ | ||
|
||
Only use neon extension on little-endian aarch64. | ||
Ref. https://github.com/rust-lang/rust/issues/129819 | ||
|
||
--- vendor/memchr-2.7.2/src/arch/aarch64/mod.rs.orig 2024-09-01 09:05:35.656376678 +0000 | ||
+++ vendor/memchr-2.7.2/src/arch/aarch64/mod.rs | ||
@@ -2,6 +2,8 @@ | ||
Vector algorithms for the `aarch64` target. | ||
*/ | ||
|
||
+#[cfg(target_endian = "little")] | ||
pub mod neon; | ||
|
||
+#[cfg(target_endian = "little")] | ||
pub(crate) mod memchr; |
129 changes: 129 additions & 0 deletions
129
rust180/patches/patch-vendor_memchr-2.7.2_src_memchr.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,129 @@ | ||
$NetBSD$ | ||
|
||
Only use neon on aarch64 in little-endian mode. | ||
Ref. https://github.com/rust-lang/rust/issues/129819 | ||
|
||
--- vendor/memchr-2.7.2/src/memchr.rs.orig 2024-09-01 11:31:02.127419756 +0000 | ||
+++ vendor/memchr-2.7.2/src/memchr.rs | ||
@@ -518,14 +518,14 @@ unsafe fn memchr_raw( | ||
{ | ||
crate::arch::wasm32::memchr::memchr_raw(needle, start, end) | ||
} | ||
- #[cfg(target_arch = "aarch64")] | ||
+ #[cfg(all(target_arch = "aarch64", target_endian = "little"))] | ||
{ | ||
crate::arch::aarch64::memchr::memchr_raw(needle, start, end) | ||
} | ||
#[cfg(not(any( | ||
target_arch = "x86_64", | ||
all(target_arch = "wasm32", target_feature = "simd128"), | ||
- target_arch = "aarch64" | ||
+ all(target_arch = "aarch64", target_endian = "little") | ||
)))] | ||
{ | ||
crate::arch::all::memchr::One::new(needle).find_raw(start, end) | ||
@@ -551,14 +551,14 @@ unsafe fn memrchr_raw( | ||
{ | ||
crate::arch::wasm32::memchr::memrchr_raw(needle, start, end) | ||
} | ||
- #[cfg(target_arch = "aarch64")] | ||
+ #[cfg(all(target_arch = "aarch64", target_endian = "little"))] | ||
{ | ||
crate::arch::aarch64::memchr::memrchr_raw(needle, start, end) | ||
} | ||
#[cfg(not(any( | ||
target_arch = "x86_64", | ||
all(target_arch = "wasm32", target_feature = "simd128"), | ||
- target_arch = "aarch64" | ||
+ all(target_arch = "aarch64", target_endian = "little") | ||
)))] | ||
{ | ||
crate::arch::all::memchr::One::new(needle).rfind_raw(start, end) | ||
@@ -585,14 +585,14 @@ unsafe fn memchr2_raw( | ||
{ | ||
crate::arch::wasm32::memchr::memchr2_raw(needle1, needle2, start, end) | ||
} | ||
- #[cfg(target_arch = "aarch64")] | ||
+ #[cfg(all(target_arch = "aarch64", target_endian = "little"))] | ||
{ | ||
crate::arch::aarch64::memchr::memchr2_raw(needle1, needle2, start, end) | ||
} | ||
#[cfg(not(any( | ||
target_arch = "x86_64", | ||
all(target_arch = "wasm32", target_feature = "simd128"), | ||
- target_arch = "aarch64" | ||
+ all(target_arch = "aarch64", target_endian = "little") | ||
)))] | ||
{ | ||
crate::arch::all::memchr::Two::new(needle1, needle2) | ||
@@ -620,7 +620,7 @@ unsafe fn memrchr2_raw( | ||
{ | ||
crate::arch::wasm32::memchr::memrchr2_raw(needle1, needle2, start, end) | ||
} | ||
- #[cfg(target_arch = "aarch64")] | ||
+ #[cfg(all(target_arch = "aarch64", target_endian = "little"))] | ||
{ | ||
crate::arch::aarch64::memchr::memrchr2_raw( | ||
needle1, needle2, start, end, | ||
@@ -629,7 +629,7 @@ unsafe fn memrchr2_raw( | ||
#[cfg(not(any( | ||
target_arch = "x86_64", | ||
all(target_arch = "wasm32", target_feature = "simd128"), | ||
- target_arch = "aarch64" | ||
+ all(target_arch = "aarch64", target_endian = "little") | ||
)))] | ||
{ | ||
crate::arch::all::memchr::Two::new(needle1, needle2) | ||
@@ -662,7 +662,7 @@ unsafe fn memchr3_raw( | ||
needle1, needle2, needle3, start, end, | ||
) | ||
} | ||
- #[cfg(target_arch = "aarch64")] | ||
+ #[cfg(all(target_arch = "aarch64", target_endian = "little"))] | ||
{ | ||
crate::arch::aarch64::memchr::memchr3_raw( | ||
needle1, needle2, needle3, start, end, | ||
@@ -671,7 +671,7 @@ unsafe fn memchr3_raw( | ||
#[cfg(not(any( | ||
target_arch = "x86_64", | ||
all(target_arch = "wasm32", target_feature = "simd128"), | ||
- target_arch = "aarch64" | ||
+ all(target_arch = "aarch64", target_endian = "little") | ||
)))] | ||
{ | ||
crate::arch::all::memchr::Three::new(needle1, needle2, needle3) | ||
@@ -704,7 +704,7 @@ unsafe fn memrchr3_raw( | ||
needle1, needle2, needle3, start, end, | ||
) | ||
} | ||
- #[cfg(target_arch = "aarch64")] | ||
+ #[cfg(all(target_arch = "aarch64", target_endian = "little"))] | ||
{ | ||
crate::arch::aarch64::memchr::memrchr3_raw( | ||
needle1, needle2, needle3, start, end, | ||
@@ -713,7 +713,7 @@ unsafe fn memrchr3_raw( | ||
#[cfg(not(any( | ||
target_arch = "x86_64", | ||
all(target_arch = "wasm32", target_feature = "simd128"), | ||
- target_arch = "aarch64" | ||
+ all(target_arch = "aarch64", target_endian = "little") | ||
)))] | ||
{ | ||
crate::arch::all::memchr::Three::new(needle1, needle2, needle3) | ||
@@ -736,14 +736,14 @@ unsafe fn count_raw(needle: u8, start: * | ||
{ | ||
crate::arch::wasm32::memchr::count_raw(needle, start, end) | ||
} | ||
- #[cfg(target_arch = "aarch64")] | ||
+ #[cfg(all(target_arch = "aarch64", target_endian = "little"))] | ||
{ | ||
crate::arch::aarch64::memchr::count_raw(needle, start, end) | ||
} | ||
#[cfg(not(any( | ||
target_arch = "x86_64", | ||
all(target_arch = "wasm32", target_feature = "simd128"), | ||
- target_arch = "aarch64" | ||
+ all(target_arch = "aarch64", target_endian = "little") | ||
)))] | ||
{ | ||
crate::arch::all::memchr::One::new(needle).count_raw(start, end) |
Oops, something went wrong.