mirror of
https://codeberg.org/kiss-community/repo
synced 2024-12-21 23:00:06 -07:00
rust: 1.72.0
This commit is contained in:
parent
73170d3a99
commit
aa388cabd2
@ -6,6 +6,28 @@ for p in *.patch; do
|
||||
patch -p1 < "$p"
|
||||
done
|
||||
|
||||
mkdir _lib
|
||||
|
||||
(
|
||||
cd _lib
|
||||
|
||||
: "${AR:=ar}"
|
||||
: "${CC:=cc}"
|
||||
|
||||
$CC ../liblfs64.c -c -fPIC -o liblfs64.o
|
||||
$AR rcs liblfs64.a liblfs64.o
|
||||
|
||||
cat > cc <<EOF
|
||||
#!/bin/sh
|
||||
set -x
|
||||
PATH="$PATH"
|
||||
exec $CC \$@ -L$PWD -llfs64
|
||||
EOF
|
||||
chmod +x cc
|
||||
)
|
||||
|
||||
export PATH="$PWD/_lib:$PATH"
|
||||
|
||||
# Instruct the compiler to trim absolute paths in resulting binaries and instead
|
||||
# change them to relative paths ($PWD/... ./...).
|
||||
export RUSTFLAGS="$RUSTFLAGS --remap-path-prefix=$PWD=."
|
||||
@ -15,19 +37,8 @@ sed 's/\(crt_static_default = \)true/\1false/' \
|
||||
compiler/rustc_target/src/spec/linux_musl_base.rs > _
|
||||
mv -f _ compiler/rustc_target/src/spec/linux_musl_base.rs
|
||||
|
||||
# Ignore checksums of files modified above.
|
||||
for p in \
|
||||
curl-sys \
|
||||
getrandom-0.2.8 \
|
||||
libc \
|
||||
libc-0.2.138 \
|
||||
libc-0.2.139 \
|
||||
libc-0.2.140 \
|
||||
libc-0.2.143
|
||||
do
|
||||
sed 's/\("files":{\)[^}]*/\1/' vendor/"$p"/.cargo-checksum.json > _
|
||||
mv -f _ vendor/"$p"/.cargo-checksum.json
|
||||
done
|
||||
sed 's/\("files":{\)[^}]*/\1/' vendor/curl-sys/.cargo-checksum.json > _
|
||||
mv -f _ vendor/curl-sys/.cargo-checksum.json
|
||||
|
||||
cat > config.toml <<EOF
|
||||
[llvm]
|
||||
@ -76,7 +87,7 @@ EOF
|
||||
# This mimics the download process of rust's 'x.py'
|
||||
# bootstrap library to allow for the removal of the internet
|
||||
# connection requirement per build.
|
||||
mkdir -p "${cache_dir:=build/cache/2023-06-01}"
|
||||
mkdir -p "${cache_dir:=build/cache/2023-07-13}"
|
||||
|
||||
for tarball in *.tar.xz\?no-extract; do
|
||||
mv -f "$tarball" "$cache_dir/${tarball%%\?no-extract}"
|
||||
|
@ -1,9 +1,7 @@
|
||||
bd58fef26b44e5e67417ed1e67ef77561df69384bbb4ab77826ebc88b1505d3382
|
||||
a1625920c2162fd0844f18ae6292fae7a9a2208253d8e236286c555c65cde60c92
|
||||
384c95ec0d374c288e2b39ac184f845169a572543138b06b8999242a1820111b59
|
||||
a0a409bae3de782f84a56ed4b7387079adb46915ead28931762c777b52a126f3f3
|
||||
f7b83d9cf2335af67330b057b864926ca3635f7597f009add1f501a33544e3af08
|
||||
b7f3ed8760034d89db2acac7a988c07ae80027e217b434de611e292795f8530a16
|
||||
e261ba77035a56570b89f2fae672156fddc9e38f41e9231d880db49e1a6b19a1fd
|
||||
ce3cd8f5bf5343c38b5c72f0e8be8650656063436f7d748bd4d16bdf82c15f413e
|
||||
2ecd50f0dd6dd37056f393aca4e6d1248c89a6fd310fcadae7daa92cbeae43dbde
|
||||
92721c010db399ac8b20c5c849acb59d3ddb3449914203b56ca07fcaee8a978738
|
||||
97086f892efe0679b6429e507aa65138ff21d1c776f583e593f5c1911e83bf1e7a
|
||||
86c5061bd6d52d79b2a41a82a08c60aa1e4562ffee8ca97deccb8090e9f2b92cee
|
||||
1265a7cf31f4977cae95ae624134636617d1401535684fdbf128a331519be649de
|
||||
490c7bf34c246d9c01e782bf8e9321698f8cdb547f9c133e28fefe148822384145
|
||||
ab61d2faa85e1c3c979da382a92020b06c58250e88487700d9d2716a3e316ac6fe
|
||||
|
44
extra/rust/files/liblfs64.c
Normal file
44
extra/rust/files/liblfs64.c
Normal file
@ -0,0 +1,44 @@
|
||||
#include <dirent.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
|
||||
int stat64(char *pathname, struct stat *statbuf) {
|
||||
return stat(pathname, statbuf);
|
||||
}
|
||||
|
||||
int fstat64(int fd, struct stat *statbuf) { return fstat(fd, statbuf); }
|
||||
|
||||
int fstatat64(int dirfd, char *pathname, struct stat *statbuf, int flags) {
|
||||
return fstatat(dirfd, pathname, statbuf, flags);
|
||||
}
|
||||
|
||||
int lstat64(char *restrict pathname, struct stat *statbuf) {
|
||||
return lstat(pathname, statbuf);
|
||||
}
|
||||
|
||||
int truncate64(char *path, off_t length) { return truncate(path, length); }
|
||||
|
||||
int ftruncate64(int fd, off_t length) { return ftruncate(fd, length); }
|
||||
|
||||
off_t lseek64(int fd, off_t offset, int whence) {
|
||||
return lseek(fd, offset, whence);
|
||||
}
|
||||
|
||||
int open64(const char *pathname, int flags,
|
||||
/* Technically this is undefined behaviour, but the `mode`
|
||||
* value is only checked if the relevant flag is set in `flags`
|
||||
* so a garbage value will never be read */
|
||||
mode_t mode) {
|
||||
return open(pathname, flags, mode);
|
||||
}
|
||||
|
||||
struct dirent *readdir64(DIR *dirp) { return readdir(dirp); }
|
||||
|
||||
ssize_t pread64(int fd, void *buf, size_t count, off_t offset) {
|
||||
return pread(fd, buf, count, offset);
|
||||
}
|
||||
|
||||
ssize_t pwrite64(int fd, void *buf, size_t count, off_t offset) {
|
||||
return pwrite(fd, buf, count, offset);
|
||||
}
|
@ -1,150 +0,0 @@
|
||||
Patch-Source: https://github.com/rust-lang/rust/pull/111698
|
||||
--
|
||||
From 6b8fcb8e5918911c0ba4e155cb2a97e804c62e81 Mon Sep 17 00:00:00 2001
|
||||
From: Amanieu d'Antras <amanieu@gmail.com>
|
||||
Date: Wed, 17 May 2023 23:53:04 +0200
|
||||
Subject: [PATCH] Force all native libraries to be statically linked when
|
||||
linking a static binary
|
||||
|
||||
---
|
||||
compiler/rustc_codegen_ssa/src/back/link.rs | 38 ++++++++++++++++++---
|
||||
compiler/rustc_target/src/spec/mod.rs | 11 ++++++
|
||||
2 files changed, 45 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/compiler/rustc_codegen_ssa/src/back/link.rs b/compiler/rustc_codegen_ssa/src/back/link.rs
|
||||
index ea06cb02d8baf..91598e8d879ee 100644
|
||||
--- a/compiler/rustc_codegen_ssa/src/back/link.rs
|
||||
+++ b/compiler/rustc_codegen_ssa/src/back/link.rs
|
||||
@@ -2129,7 +2129,14 @@ fn linker_with_args<'a>(
|
||||
cmd.add_as_needed();
|
||||
|
||||
// Local native libraries of all kinds.
|
||||
- add_local_native_libraries(cmd, sess, archive_builder_builder, codegen_results, tmpdir);
|
||||
+ add_local_native_libraries(
|
||||
+ cmd,
|
||||
+ sess,
|
||||
+ archive_builder_builder,
|
||||
+ codegen_results,
|
||||
+ tmpdir,
|
||||
+ link_output_kind,
|
||||
+ );
|
||||
|
||||
// Upstream rust crates and their non-dynamic native libraries.
|
||||
add_upstream_rust_crates(
|
||||
@@ -2139,10 +2146,18 @@ fn linker_with_args<'a>(
|
||||
codegen_results,
|
||||
crate_type,
|
||||
tmpdir,
|
||||
+ link_output_kind,
|
||||
);
|
||||
|
||||
// Dynamic native libraries from upstream crates.
|
||||
- add_upstream_native_libraries(cmd, sess, archive_builder_builder, codegen_results, tmpdir);
|
||||
+ add_upstream_native_libraries(
|
||||
+ cmd,
|
||||
+ sess,
|
||||
+ archive_builder_builder,
|
||||
+ codegen_results,
|
||||
+ tmpdir,
|
||||
+ link_output_kind,
|
||||
+ );
|
||||
|
||||
// Link with the import library generated for any raw-dylib functions.
|
||||
for (raw_dylib_name, raw_dylib_imports) in
|
||||
@@ -2397,6 +2412,7 @@ fn add_native_libs_from_crate(
|
||||
cnum: CrateNum,
|
||||
link_static: bool,
|
||||
link_dynamic: bool,
|
||||
+ link_output_kind: LinkOutputKind,
|
||||
) {
|
||||
if !sess.opts.unstable_opts.link_native_libraries {
|
||||
// If `-Zlink-native-libraries=false` is set, then the assumption is that an
|
||||
@@ -2476,8 +2492,16 @@ fn add_native_libs_from_crate(
|
||||
}
|
||||
}
|
||||
NativeLibKind::Unspecified => {
|
||||
- if link_dynamic {
|
||||
- cmd.link_dylib(name, verbatim, true);
|
||||
+ // If we are generating a static binary, prefer static library when the
|
||||
+ // link kind is unspecified.
|
||||
+ if !link_output_kind.can_link_dylib() && !sess.target.crt_static_allows_dylibs {
|
||||
+ if link_static {
|
||||
+ cmd.link_staticlib(name, verbatim)
|
||||
+ }
|
||||
+ } else {
|
||||
+ if link_dynamic {
|
||||
+ cmd.link_dylib(name, verbatim, true);
|
||||
+ }
|
||||
}
|
||||
}
|
||||
NativeLibKind::Framework { as_needed } => {
|
||||
@@ -2504,6 +2528,7 @@ fn add_local_native_libraries(
|
||||
archive_builder_builder: &dyn ArchiveBuilderBuilder,
|
||||
codegen_results: &CodegenResults,
|
||||
tmpdir: &Path,
|
||||
+ link_output_kind: LinkOutputKind,
|
||||
) {
|
||||
if sess.opts.unstable_opts.link_native_libraries {
|
||||
// User-supplied library search paths (-L on the command line). These are the same paths
|
||||
@@ -2533,6 +2558,7 @@ fn add_local_native_libraries(
|
||||
LOCAL_CRATE,
|
||||
link_static,
|
||||
link_dynamic,
|
||||
+ link_output_kind,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -2543,6 +2569,7 @@ fn add_upstream_rust_crates<'a>(
|
||||
codegen_results: &CodegenResults,
|
||||
crate_type: CrateType,
|
||||
tmpdir: &Path,
|
||||
+ link_output_kind: LinkOutputKind,
|
||||
) {
|
||||
// All of the heavy lifting has previously been accomplished by the
|
||||
// dependency_format module of the compiler. This is just crawling the
|
||||
@@ -2620,6 +2647,7 @@ fn add_upstream_rust_crates<'a>(
|
||||
cnum,
|
||||
link_static,
|
||||
link_dynamic,
|
||||
+ link_output_kind,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -2630,6 +2658,7 @@ fn add_upstream_native_libraries(
|
||||
archive_builder_builder: &dyn ArchiveBuilderBuilder,
|
||||
codegen_results: &CodegenResults,
|
||||
tmpdir: &Path,
|
||||
+ link_output_kind: LinkOutputKind,
|
||||
) {
|
||||
let search_path = OnceCell::new();
|
||||
for &cnum in &codegen_results.crate_info.used_crates {
|
||||
@@ -2658,6 +2687,7 @@ fn add_upstream_native_libraries(
|
||||
cnum,
|
||||
link_static,
|
||||
link_dynamic,
|
||||
+ link_output_kind,
|
||||
);
|
||||
}
|
||||
}
|
||||
diff --git a/compiler/rustc_target/src/spec/mod.rs b/compiler/rustc_target/src/spec/mod.rs
|
||||
index ba4b89c9ea10b..e1915e16e2002 100644
|
||||
--- a/compiler/rustc_target/src/spec/mod.rs
|
||||
+++ b/compiler/rustc_target/src/spec/mod.rs
|
||||
@@ -596,6 +596,17 @@ impl LinkOutputKind {
|
||||
_ => return None,
|
||||
})
|
||||
}
|
||||
+
|
||||
+ pub fn can_link_dylib(self) -> bool {
|
||||
+ match self {
|
||||
+ LinkOutputKind::StaticNoPicExe | LinkOutputKind::StaticPicExe => false,
|
||||
+ LinkOutputKind::DynamicNoPicExe
|
||||
+ | LinkOutputKind::DynamicPicExe
|
||||
+ | LinkOutputKind::DynamicDylib
|
||||
+ | LinkOutputKind::StaticDylib
|
||||
+ | LinkOutputKind::WasiReactorExe => true,
|
||||
+ }
|
||||
+ }
|
||||
}
|
||||
|
||||
impl fmt::Display for LinkOutputKind {
|
@ -1,25 +0,0 @@
|
||||
diff --git a/vendor/getrandom-0.2.8/src/util_libc.rs b/vendor/getrandom-0.2.8/src/util_libc.rs
|
||||
index d057071..83a3f2b 100644
|
||||
--- a/vendor/getrandom-0.2.8/src/util_libc.rs
|
||||
+++ b/vendor/getrandom-0.2.8/src/util_libc.rs
|
||||
@@ -135,19 +135,11 @@ impl Weak {
|
||||
}
|
||||
}
|
||||
|
||||
-cfg_if! {
|
||||
- if #[cfg(any(target_os = "linux", target_os = "emscripten"))] {
|
||||
- use libc::open64 as open;
|
||||
- } else {
|
||||
- use libc::open;
|
||||
- }
|
||||
-}
|
||||
-
|
||||
// SAFETY: path must be null terminated, FD must be manually closed.
|
||||
pub unsafe fn open_readonly(path: &str) -> Result<libc::c_int, Error> {
|
||||
debug_assert_eq!(path.as_bytes().last(), Some(&0));
|
||||
loop {
|
||||
- let fd = open(path.as_ptr() as *const _, libc::O_RDONLY | libc::O_CLOEXEC);
|
||||
+ let fd = libc::open(path.as_ptr() as *const _, libc::O_RDONLY | libc::O_CLOEXEC);
|
||||
if fd >= 0 {
|
||||
return Ok(fd);
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -1,27 +1,5 @@
|
||||
Patch-Source: https://github.com/rust-lang/rust/pull/106246
|
||||
--
|
||||
From e2355ea7f22219f1fb3919a45e4f07502652ee5c Mon Sep 17 00:00:00 2001
|
||||
From: Khem Raj <raj.khem@gmail.com>
|
||||
Date: Fri, 19 May 2023 09:22:21 -0700
|
||||
Subject: [PATCH] Do not use LFS64 on linux with musl
|
||||
|
||||
glibc is providing open64 and other lfs64 functions but musl aliases
|
||||
them to normal equivalents since off_t is always 64-bit on musl,
|
||||
therefore check for target env along when target OS is linux before
|
||||
using open64, this is more available. Latest Musl has made these
|
||||
namespace changes [1]
|
||||
|
||||
[1] https://git.musl-libc.org/cgit/musl/commit/?id=246f1c811448f37a44b41cd8df8d0ef9736d95f4
|
||||
|
||||
Signed-off-by: Khem Raj <raj.khem@gmail.com>
|
||||
---
|
||||
library/std/src/os/linux/fs.rs | 9 ++++++++-
|
||||
library/std/src/sys/unix/fd.rs | 14 ++++++++++----
|
||||
library/std/src/sys/unix/fs.rs | 25 +++++++++++++++++++------
|
||||
3 files changed, 37 insertions(+), 11 deletions(-)
|
||||
|
||||
diff --git a/library/std/src/os/linux/fs.rs b/library/std/src/os/linux/fs.rs
|
||||
index 479bbcc17a89e..ab0b2a3eda3f5 100644
|
||||
index 479bbcc1..ab0b2a3e 100644
|
||||
--- a/library/std/src/os/linux/fs.rs
|
||||
+++ b/library/std/src/os/linux/fs.rs
|
||||
@@ -329,7 +329,14 @@ pub trait MetadataExt {
|
||||
@ -41,10 +19,10 @@ index 479bbcc17a89e..ab0b2a3eda3f5 100644
|
||||
fn st_dev(&self) -> u64 {
|
||||
self.as_inner().as_inner().st_dev as u64
|
||||
diff --git a/library/std/src/sys/unix/fd.rs b/library/std/src/sys/unix/fd.rs
|
||||
index cb630eede6da0..c1e0c05213ac2 100644
|
||||
index 85e020ae..7489d5d2 100644
|
||||
--- a/library/std/src/sys/unix/fd.rs
|
||||
+++ b/library/std/src/sys/unix/fd.rs
|
||||
@@ -122,9 +122,12 @@ impl FileDesc {
|
||||
@@ -124,9 +124,12 @@ impl FileDesc {
|
||||
}
|
||||
|
||||
pub fn read_at(&self, buf: &mut [u8], offset: u64) -> io::Result<usize> {
|
||||
@ -59,7 +37,7 @@ index cb630eede6da0..c1e0c05213ac2 100644
|
||||
use libc::pread64;
|
||||
|
||||
unsafe {
|
||||
@@ -277,9 +280,12 @@ impl FileDesc {
|
||||
@@ -281,9 +284,12 @@ impl FileDesc {
|
||||
}
|
||||
|
||||
pub fn write_at(&self, buf: &[u8], offset: u64) -> io::Result<usize> {
|
||||
@ -75,10 +53,10 @@ index cb630eede6da0..c1e0c05213ac2 100644
|
||||
|
||||
unsafe {
|
||||
diff --git a/library/std/src/sys/unix/fs.rs b/library/std/src/sys/unix/fs.rs
|
||||
index 09db5b11dbfd3..e31f987c7dc9a 100644
|
||||
index fbc7f04c..f6034155 100644
|
||||
--- a/library/std/src/sys/unix/fs.rs
|
||||
+++ b/library/std/src/sys/unix/fs.rs
|
||||
@@ -47,9 +47,13 @@ use libc::{c_int, mode_t};
|
||||
@@ -50,9 +50,13 @@ use libc::{c_int, mode_t};
|
||||
all(target_os = "linux", target_env = "gnu")
|
||||
))]
|
||||
use libc::c_char;
|
||||
@ -94,10 +72,10 @@ index 09db5b11dbfd3..e31f987c7dc9a 100644
|
||||
use libc::fstatat64;
|
||||
#[cfg(any(
|
||||
target_os = "android",
|
||||
@@ -58,9 +62,10 @@ use libc::fstatat64;
|
||||
target_os = "redox",
|
||||
@@ -62,9 +66,10 @@ use libc::fstatat64;
|
||||
target_os = "illumos",
|
||||
target_os = "nto",
|
||||
target_os = "vita",
|
||||
+ target_env = "musl",
|
||||
))]
|
||||
use libc::readdir as readdir64;
|
||||
@ -106,7 +84,7 @@ index 09db5b11dbfd3..e31f987c7dc9a 100644
|
||||
use libc::readdir64;
|
||||
#[cfg(any(target_os = "emscripten", target_os = "l4re"))]
|
||||
use libc::readdir64_r;
|
||||
@@ -81,7 +86,13 @@ use libc::{
|
||||
@@ -86,7 +91,13 @@ use libc::{
|
||||
dirent as dirent64, fstat as fstat64, fstatat as fstatat64, ftruncate64, lseek64,
|
||||
lstat as lstat64, off64_t, open as open64, stat as stat64,
|
||||
};
|
||||
@ -120,7 +98,7 @@ index 09db5b11dbfd3..e31f987c7dc9a 100644
|
||||
target_os = "linux",
|
||||
target_os = "emscripten",
|
||||
target_os = "l4re",
|
||||
@@ -91,7 +102,7 @@ use libc::{
|
||||
@@ -96,7 +107,7 @@ use libc::{
|
||||
dirent as dirent64, fstat as fstat64, ftruncate as ftruncate64, lseek as lseek64,
|
||||
lstat as lstat64, off_t as off64_t, open as open64, stat as stat64,
|
||||
};
|
||||
@ -129,7 +107,7 @@ index 09db5b11dbfd3..e31f987c7dc9a 100644
|
||||
use libc::{dirent64, fstat64, ftruncate64, lseek64, lstat64, off64_t, open64, stat64};
|
||||
|
||||
pub use crate::sys_common::fs::try_exists;
|
||||
@@ -278,6 +289,7 @@ unsafe impl Sync for Dir {}
|
||||
@@ -283,6 +294,7 @@ unsafe impl Sync for Dir {}
|
||||
#[cfg(any(
|
||||
target_os = "android",
|
||||
target_os = "linux",
|
||||
@ -137,7 +115,7 @@ index 09db5b11dbfd3..e31f987c7dc9a 100644
|
||||
target_os = "solaris",
|
||||
target_os = "illumos",
|
||||
target_os = "fuchsia",
|
||||
@@ -312,6 +324,7 @@ struct dirent64_min {
|
||||
@@ -324,6 +336,7 @@ struct dirent64_min {
|
||||
}
|
||||
|
||||
#[cfg(not(any(
|
||||
@ -145,7 +123,7 @@ index 09db5b11dbfd3..e31f987c7dc9a 100644
|
||||
target_os = "android",
|
||||
target_os = "linux",
|
||||
target_os = "solaris",
|
||||
@@ -798,7 +811,7 @@ impl DirEntry {
|
||||
@@ -832,7 +845,7 @@ impl DirEntry {
|
||||
}
|
||||
|
||||
#[cfg(all(
|
||||
@ -154,7 +132,7 @@ index 09db5b11dbfd3..e31f987c7dc9a 100644
|
||||
not(miri)
|
||||
))]
|
||||
pub fn metadata(&self) -> io::Result<FileAttr> {
|
||||
@@ -822,7 +835,7 @@ impl DirEntry {
|
||||
@@ -856,7 +869,7 @@ impl DirEntry {
|
||||
}
|
||||
|
||||
#[cfg(any(
|
||||
|
@ -1,9 +1,7 @@
|
||||
https://static.rust-lang.org/dist/rustc-1.71.0-src.tar.xz
|
||||
https://static.rust-lang.org/dist/2023-06-01/rust-std-1.70.0-x86_64-unknown-linux-musl.tar.xz?no-extract
|
||||
https://static.rust-lang.org/dist/2023-06-01/rustc-1.70.0-x86_64-unknown-linux-musl.tar.xz?no-extract
|
||||
https://static.rust-lang.org/dist/2023-06-01/cargo-1.70.0-x86_64-unknown-linux-musl.tar.xz?no-extract
|
||||
patches/fix-crt-static.patch
|
||||
https://static.rust-lang.org/dist/rustc-1.72.0-src.tar.xz
|
||||
https://static.rust-lang.org/dist/2023-07-13/rust-std-1.71.0-x86_64-unknown-linux-musl.tar.xz?no-extract
|
||||
https://static.rust-lang.org/dist/2023-07-13/rustc-1.71.0-x86_64-unknown-linux-musl.tar.xz?no-extract
|
||||
https://static.rust-lang.org/dist/2023-07-13/cargo-1.71.0-x86_64-unknown-linux-musl.tar.xz?no-extract
|
||||
files/liblfs64.c
|
||||
patches/fix-curl.patch
|
||||
patches/lfs64-getrandom.patch
|
||||
patches/lfs64-libc.patch
|
||||
patches/lfs64-rust.patch
|
||||
|
@ -1 +1 @@
|
||||
1.71.0 1
|
||||
1.72.0 1
|
||||
|
Loading…
Reference in New Issue
Block a user