diff options
Diffstat (limited to 'meta/recipes-devtools/rust/files/0001-Do-not-use-LFS64-on-linux-with-musl.patch')
| -rw-r--r-- | meta/recipes-devtools/rust/files/0001-Do-not-use-LFS64-on-linux-with-musl.patch | 169 |
1 files changed, 0 insertions, 169 deletions
diff --git a/meta/recipes-devtools/rust/files/0001-Do-not-use-LFS64-on-linux-with-musl.patch b/meta/recipes-devtools/rust/files/0001-Do-not-use-LFS64-on-linux-with-musl.patch deleted file mode 100644 index 794ad804f0..0000000000 --- a/meta/recipes-devtools/rust/files/0001-Do-not-use-LFS64-on-linux-with-musl.patch +++ /dev/null | |||
| @@ -1,169 +0,0 @@ | |||
| 1 | From 3ecce665198e3420d70139d86ed22e74804c9379 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Khem Raj <raj.khem@gmail.com> | ||
| 3 | Date: Wed, 28 Dec 2022 22:35:55 -0800 | ||
| 4 | Subject: [PATCH] Do not use LFS64 on linux with musl | ||
| 5 | |||
| 6 | glibc is providing open64 and other lfs64 functions but musl aliases | ||
| 7 | them to normal equivalents since off_t is always 64-bit on musl, | ||
| 8 | therefore check for target env along when target OS is linux before | ||
| 9 | using open64, this is more available. Latest Musl has made these | ||
| 10 | namespace changes [1] | ||
| 11 | |||
| 12 | [1] https://git.musl-libc.org/cgit/musl/commit/?id=246f1c811448f37a44b41cd8df8d0ef9736d95f4 | ||
| 13 | |||
| 14 | Upstream-Status: Submitted [https://github.com/rust-lang/rust/pull/106246] | ||
| 15 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
| 16 | --- | ||
| 17 | library/std/src/os/linux/fs.rs | 9 ++++++++- | ||
| 18 | library/std/src/sys/unix/fd.rs | 14 ++++++++++---- | ||
| 19 | library/std/src/sys/unix/fs.rs | 27 ++++++++++++++++++++------- | ||
| 20 | 3 files changed, 38 insertions(+), 12 deletions(-) | ||
| 21 | |||
| 22 | Index: rustc-1.73.0-src/library/std/src/os/linux/fs.rs | ||
| 23 | =================================================================== | ||
| 24 | --- rustc-1.73.0-src.orig/library/std/src/os/linux/fs.rs | ||
| 25 | +++ rustc-1.73.0-src/library/std/src/os/linux/fs.rs | ||
| 26 | @@ -329,7 +329,14 @@ pub trait MetadataExt { | ||
| 27 | impl MetadataExt for Metadata { | ||
| 28 | #[allow(deprecated)] | ||
| 29 | fn as_raw_stat(&self) -> &raw::stat { | ||
| 30 | - unsafe { &*(self.as_inner().as_inner() as *const libc::stat64 as *const raw::stat) } | ||
| 31 | + #[cfg(target_env = "musl")] | ||
| 32 | + unsafe { | ||
| 33 | + &*(self.as_inner().as_inner() as *const libc::stat as *const raw::stat) | ||
| 34 | + } | ||
| 35 | + #[cfg(not(target_env = "musl"))] | ||
| 36 | + unsafe { | ||
| 37 | + &*(self.as_inner().as_inner() as *const libc::stat64 as *const raw::stat) | ||
| 38 | + } | ||
| 39 | } | ||
| 40 | fn st_dev(&self) -> u64 { | ||
| 41 | self.as_inner().as_inner().st_dev as u64 | ||
| 42 | Index: rustc-1.73.0-src/library/std/src/sys/unix/fd.rs | ||
| 43 | =================================================================== | ||
| 44 | --- rustc-1.73.0-src.orig/library/std/src/sys/unix/fd.rs | ||
| 45 | +++ rustc-1.73.0-src/library/std/src/sys/unix/fd.rs | ||
| 46 | @@ -124,9 +124,12 @@ impl FileDesc { | ||
| 47 | } | ||
| 48 | |||
| 49 | pub fn read_at(&self, buf: &mut [u8], offset: u64) -> io::Result<usize> { | ||
| 50 | - #[cfg(not(any(target_os = "linux", target_os = "android")))] | ||
| 51 | + #[cfg(not(any( | ||
| 52 | + all(target_os = "linux", not(target_env = "musl")), | ||
| 53 | + target_os = "android" | ||
| 54 | + )))] | ||
| 55 | use libc::pread as pread64; | ||
| 56 | - #[cfg(any(target_os = "linux", target_os = "android"))] | ||
| 57 | + #[cfg(any(all(target_os = "linux", not(target_env = "musl")), target_os = "android"))] | ||
| 58 | use libc::pread64; | ||
| 59 | |||
| 60 | unsafe { | ||
| 61 | @@ -281,9 +284,12 @@ impl FileDesc { | ||
| 62 | } | ||
| 63 | |||
| 64 | pub fn write_at(&self, buf: &[u8], offset: u64) -> io::Result<usize> { | ||
| 65 | - #[cfg(not(any(target_os = "linux", target_os = "android")))] | ||
| 66 | + #[cfg(not(any( | ||
| 67 | + all(target_os = "linux", not(target_env = "musl")), | ||
| 68 | + target_os = "android" | ||
| 69 | + )))] | ||
| 70 | use libc::pwrite as pwrite64; | ||
| 71 | - #[cfg(any(target_os = "linux", target_os = "android"))] | ||
| 72 | + #[cfg(any(all(target_os = "linux", not(target_env = "musl")), target_os = "android"))] | ||
| 73 | use libc::pwrite64; | ||
| 74 | |||
| 75 | unsafe { | ||
| 76 | Index: rustc-1.73.0-src/library/std/src/sys/unix/fs.rs | ||
| 77 | =================================================================== | ||
| 78 | --- rustc-1.73.0-src.orig/library/std/src/sys/unix/fs.rs | ||
| 79 | +++ rustc-1.73.0-src/library/std/src/sys/unix/fs.rs | ||
| 80 | @@ -39,9 +39,13 @@ use libc::{c_int, mode_t}; | ||
| 81 | all(target_os = "linux", target_env = "gnu") | ||
| 82 | ))] | ||
| 83 | use libc::c_char; | ||
| 84 | -#[cfg(any(target_os = "linux", target_os = "emscripten", target_os = "android"))] | ||
| 85 | +#[cfg(any( | ||
| 86 | + all(target_os = "linux", not(target_env = "musl")), | ||
| 87 | + target_os = "emscripten", | ||
| 88 | + target_os = "android" | ||
| 89 | +))] | ||
| 90 | use libc::dirfd; | ||
| 91 | -#[cfg(any(target_os = "linux", target_os = "emscripten"))] | ||
| 92 | +#[cfg(any(not(target_env = "musl"), target_os = "emscripten"))] | ||
| 93 | use libc::fstatat64; | ||
| 94 | #[cfg(any( | ||
| 95 | target_os = "android", | ||
| 96 | @@ -53,7 +57,7 @@ use libc::fstatat64; | ||
| 97 | target_os = "vita", | ||
| 98 | ))] | ||
| 99 | use libc::readdir as readdir64; | ||
| 100 | -#[cfg(target_os = "linux")] | ||
| 101 | +#[cfg(all(target_os = "linux", not(target_env = "musl")))] | ||
| 102 | use libc::readdir64; | ||
| 103 | #[cfg(any(target_os = "emscripten", target_os = "l4re"))] | ||
| 104 | use libc::readdir64_r; | ||
| 105 | @@ -68,6 +72,7 @@ use libc::readdir64_r; | ||
| 106 | target_os = "redox", | ||
| 107 | target_os = "nto", | ||
| 108 | target_os = "vita", | ||
| 109 | + target_env = "musl", | ||
| 110 | )))] | ||
| 111 | use libc::readdir_r as readdir64_r; | ||
| 112 | #[cfg(target_os = "android")] | ||
| 113 | @@ -75,7 +80,13 @@ use libc::{ | ||
| 114 | dirent as dirent64, fstat as fstat64, fstatat as fstatat64, ftruncate64, lseek64, | ||
| 115 | lstat as lstat64, off64_t, open as open64, stat as stat64, | ||
| 116 | }; | ||
| 117 | +#[cfg(target_env = "musl")] | ||
| 118 | +use libc::{ | ||
| 119 | + dirent as dirent64, fstat as fstat64, ftruncate as ftruncate64, lseek as lseek64, | ||
| 120 | + lstat as lstat64, off_t as off64_t, open as open64, stat as stat64, | ||
| 121 | +}; | ||
| 122 | #[cfg(not(any( | ||
| 123 | + target_env = "musl", | ||
| 124 | target_os = "linux", | ||
| 125 | target_os = "emscripten", | ||
| 126 | target_os = "l4re", | ||
| 127 | @@ -85,7 +96,7 @@ use libc::{ | ||
| 128 | dirent as dirent64, fstat as fstat64, ftruncate as ftruncate64, lseek as lseek64, | ||
| 129 | lstat as lstat64, off_t as off64_t, open as open64, stat as stat64, | ||
| 130 | }; | ||
| 131 | -#[cfg(any(target_os = "linux", target_os = "emscripten", target_os = "l4re"))] | ||
| 132 | +#[cfg(any(not(target_env = "musl"), target_os = "emscripten", target_os = "l4re"))] | ||
| 133 | use libc::{dirent64, fstat64, ftruncate64, lseek64, lstat64, off64_t, open64, stat64}; | ||
| 134 | |||
| 135 | pub use crate::sys_common::fs::try_exists; | ||
| 136 | @@ -272,6 +283,7 @@ unsafe impl Sync for Dir {} | ||
| 137 | #[cfg(any( | ||
| 138 | target_os = "android", | ||
| 139 | target_os = "linux", | ||
| 140 | + not(target_env = "musl"), | ||
| 141 | target_os = "solaris", | ||
| 142 | target_os = "illumos", | ||
| 143 | target_os = "fuchsia", | ||
| 144 | @@ -313,6 +325,7 @@ struct dirent64_min { | ||
| 145 | } | ||
| 146 | |||
| 147 | #[cfg(not(any( | ||
| 148 | + target_env = "musl", | ||
| 149 | target_os = "android", | ||
| 150 | target_os = "linux", | ||
| 151 | target_os = "solaris", | ||
| 152 | @@ -809,7 +822,7 @@ impl DirEntry { | ||
| 153 | } | ||
| 154 | |||
| 155 | #[cfg(all( | ||
| 156 | - any(target_os = "linux", target_os = "emscripten", target_os = "android"), | ||
| 157 | + any(not(target_env = "musl"), target_os = "emscripten", target_os = "android"), | ||
| 158 | not(miri) | ||
| 159 | ))] | ||
| 160 | pub fn metadata(&self) -> io::Result<FileAttr> { | ||
| 161 | @@ -833,7 +846,7 @@ impl DirEntry { | ||
| 162 | } | ||
| 163 | |||
| 164 | #[cfg(any( | ||
| 165 | - not(any(target_os = "linux", target_os = "emscripten", target_os = "android")), | ||
| 166 | + not(any(not(target_env = "musl"), target_os = "emscripten", target_os = "android")), | ||
| 167 | miri | ||
| 168 | ))] | ||
| 169 | pub fn metadata(&self) -> io::Result<FileAttr> { | ||
