Compare commits

...

No commits in common. 'c9' and 'i10cs' have entirely different histories.
c9 ... i10cs

4
.gitignore vendored

@ -1,2 +1,2 @@
SOURCES/rustc-1.76.0-src.tar.xz
SOURCES/wasi-libc-03b228e46bb02fcc5927253e1b8ad715072b1ae4.tar.gz
SOURCES/rustc-1.83.0-src.tar.xz
SOURCES/wasi-libc-wasi-sdk-24.tar.gz

@ -1,2 +1,2 @@
755339e8131d618d3c1095a581f27afc573ad310 SOURCES/rustc-1.76.0-src.tar.xz
124d114ffb627ada36bfa1df0216bcea0f55a15e SOURCES/wasi-libc-03b228e46bb02fcc5927253e1b8ad715072b1ae4.tar.gz
d45b38f7c4e74f62aa9f1969f144018214625125 SOURCES/rustc-1.83.0-src.tar.xz
0d6b315ce3e7ae23a2c6b079d73fae9d3e2bb438 SOURCES/wasi-libc-wasi-sdk-24.tar.gz

@ -1,4 +1,4 @@
From 184d61d2c12aa2db01de9a14ccb2be0cfae5039b Mon Sep 17 00:00:00 2001
From e12de251f8513f660bbfbc1c71883383bd1037f4 Mon Sep 17 00:00:00 2001
From: Josh Stone <jistone@redhat.com>
Date: Fri, 9 Jun 2023 15:23:08 -0700
Subject: [PATCH] Let environment variables override some default CPUs
@ -10,12 +10,12 @@ Subject: [PATCH] Let environment variables override some default CPUs
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/compiler/rustc_target/src/spec/targets/powerpc64le_unknown_linux_gnu.rs b/compiler/rustc_target/src/spec/targets/powerpc64le_unknown_linux_gnu.rs
index 194c3170e683..9806ca78297c 100644
index 23913687a1fd..3253fbc84c74 100644
--- a/compiler/rustc_target/src/spec/targets/powerpc64le_unknown_linux_gnu.rs
+++ b/compiler/rustc_target/src/spec/targets/powerpc64le_unknown_linux_gnu.rs
@@ -2,7 +2,7 @@
pub fn target() -> Target {
pub(crate) fn target() -> Target {
let mut base = base::linux_gnu::opts();
- base.cpu = "ppc64le".into();
+ base.cpu = option_env!("RUSTC_TARGET_CPU_PPC64LE").unwrap_or("ppc64le").into();
@ -23,25 +23,25 @@ index 194c3170e683..9806ca78297c 100644
base.max_atomic_width = Some(64);
base.stack_probes = StackProbeType::Inline;
diff --git a/compiler/rustc_target/src/spec/targets/s390x_unknown_linux_gnu.rs b/compiler/rustc_target/src/spec/targets/s390x_unknown_linux_gnu.rs
index 6fc410eb2235..c8f84edb9715 100644
index 3efbb4648361..bcdaa5b8276d 100644
--- a/compiler/rustc_target/src/spec/targets/s390x_unknown_linux_gnu.rs
+++ b/compiler/rustc_target/src/spec/targets/s390x_unknown_linux_gnu.rs
@@ -5,7 +5,7 @@ pub fn target() -> Target {
@@ -5,7 +5,7 @@ pub(crate) fn target() -> Target {
let mut base = base::linux_gnu::opts();
base.endian = Endian::Big;
// z10 is the oldest CPU supported by LLVM
- base.cpu = "z10".into();
+ base.cpu = option_env!("RUSTC_TARGET_CPU_S390X").unwrap_or("z10").into();
// FIXME: The ABI implementation in cabi_s390x.rs is for now hard-coded to assume the no-vector
// ABI. Pass the -vector feature string to LLVM to respect this assumption. On LLVM < 16, we
// also strip v128 from the data_layout below to match the older LLVM's expectation.
// FIXME: The ABI implementation in abi/call/s390x.rs is for now hard-coded to assume the no-vector
// ABI. Pass the -vector feature string to LLVM to respect this assumption.
base.features = "-vector".into();
diff --git a/compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_gnu.rs b/compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_gnu.rs
index 80e267c163fa..8436a00e66d5 100644
index 59ec6c7f9d5f..b6f1be890b20 100644
--- a/compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_gnu.rs
+++ b/compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_gnu.rs
@@ -2,7 +2,7 @@
pub fn target() -> Target {
pub(crate) fn target() -> Target {
let mut base = base::linux_gnu::opts();
- base.cpu = "x86-64".into();
+ base.cpu = option_env!("RUSTC_TARGET_CPU_X86_64").unwrap_or("x86-64").into();
@ -49,5 +49,5 @@ index 80e267c163fa..8436a00e66d5 100644
base.max_atomic_width = Some(64);
base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-m64"]);
--
2.41.0
2.47.0

@ -1,19 +1,21 @@
From 61b5cc96337da2121221dd1bcdb63fd36551d065 Mon Sep 17 00:00:00 2001
From 3d8c6d095581e8d7585f3772cfd16f6367f3c008 Mon Sep 17 00:00:00 2001
From: Josh Stone <jistone@redhat.com>
Date: Wed, 1 Nov 2023 15:21:15 -0700
Date: Fri, 16 Aug 2024 10:12:58 -0700
Subject: [PATCH] Use lld provided by system
---
compiler/rustc_target/src/spec/base/wasm.rs | 3 +--
compiler/rustc_target/src/spec/targets/x86_64_unknown_none.rs | 2 +-
compiler/rustc_target/src/spec/targets/x86_64_unknown_uefi.rs | 1 +
3 files changed, 3 insertions(+), 3 deletions(-)
compiler/rustc_target/src/spec/base/wasm.rs | 3 +--
.../src/spec/targets/aarch64_unknown_none_softfloat.rs | 2 +-
compiler/rustc_target/src/spec/targets/aarch64_unknown_uefi.rs | 1 +
compiler/rustc_target/src/spec/targets/x86_64_unknown_none.rs | 2 +-
compiler/rustc_target/src/spec/targets/x86_64_unknown_uefi.rs | 1 +
5 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/compiler/rustc_target/src/spec/base/wasm.rs b/compiler/rustc_target/src/spec/base/wasm.rs
index 87ade9e58cf4..2ddff95febab 100644
index f237391016e7..08bcd9699b4a 100644
--- a/compiler/rustc_target/src/spec/base/wasm.rs
+++ b/compiler/rustc_target/src/spec/base/wasm.rs
@@ -91,8 +91,7 @@ macro_rules! args {
@@ -85,8 +85,7 @@ macro_rules! args {
// arguments just yet
limit_rdylib_exports: false,
@ -23,8 +25,33 @@ index 87ade9e58cf4..2ddff95febab 100644
linker_flavor: LinkerFlavor::WasmLld(Cc::No),
pre_link_args,
diff --git a/compiler/rustc_target/src/spec/targets/aarch64_unknown_none_softfloat.rs b/compiler/rustc_target/src/spec/targets/aarch64_unknown_none_softfloat.rs
index 222d5651b521..4b780bc8a8e7 100644
--- a/compiler/rustc_target/src/spec/targets/aarch64_unknown_none_softfloat.rs
+++ b/compiler/rustc_target/src/spec/targets/aarch64_unknown_none_softfloat.rs
@@ -14,7 +14,7 @@ pub fn target() -> Target {
let opts = TargetOptions {
abi: "softfloat".into(),
linker_flavor: LinkerFlavor::Gnu(Cc::No, Lld::Yes),
- linker: Some("rust-lld".into()),
+ linker: Some("lld".into()),
features: "+v8a,+strict-align,-neon,-fp-armv8".into(),
relocation_model: RelocModel::Static,
disable_redzone: true,
diff --git a/compiler/rustc_target/src/spec/targets/aarch64_unknown_uefi.rs b/compiler/rustc_target/src/spec/targets/aarch64_unknown_uefi.rs
index 429303170b6b..19d4ec53f6d8 100644
--- a/compiler/rustc_target/src/spec/targets/aarch64_unknown_uefi.rs
+++ b/compiler/rustc_target/src/spec/targets/aarch64_unknown_uefi.rs
@@ -9,6 +9,7 @@ pub fn target() -> Target {
base.max_atomic_width = Some(128);
base.add_pre_link_args(LinkerFlavor::Msvc(Lld::No), &["/machine:arm64"]);
base.features = "+v8a".into();
+ base.linker = Some("lld".into());
Target {
llvm_target: "aarch64-unknown-windows".into(),
diff --git a/compiler/rustc_target/src/spec/targets/x86_64_unknown_none.rs b/compiler/rustc_target/src/spec/targets/x86_64_unknown_none.rs
index 9aa95a35f8e5..a9172f9441b7 100644
index 549706998d46..b7e9158ddef5 100644
--- a/compiler/rustc_target/src/spec/targets/x86_64_unknown_none.rs
+++ b/compiler/rustc_target/src/spec/targets/x86_64_unknown_none.rs
@@ -17,7 +17,7 @@ pub fn target() -> Target {
@ -33,11 +60,11 @@ index 9aa95a35f8e5..a9172f9441b7 100644
linker_flavor: LinkerFlavor::Gnu(Cc::No, Lld::Yes),
- linker: Some("rust-lld".into()),
+ linker: Some("lld".into()),
features:
"-mmx,-sse,-sse2,-sse3,-ssse3,-sse4.1,-sse4.2,-3dnow,-3dnowa,-avx,-avx2,+soft-float"
.into(),
features: "-mmx,-sse,-sse2,-sse3,-ssse3,-sse4.1,-sse4.2,-avx,-avx2,+soft-float".into(),
supported_sanitizers: SanitizerSet::KCFI | SanitizerSet::KERNELADDRESS,
disable_redzone: true,
diff --git a/compiler/rustc_target/src/spec/targets/x86_64_unknown_uefi.rs b/compiler/rustc_target/src/spec/targets/x86_64_unknown_uefi.rs
index 5abfb8162f70..13cb43bda1a4 100644
index 6da1fcca58c8..c84ae44576d4 100644
--- a/compiler/rustc_target/src/spec/targets/x86_64_unknown_uefi.rs
+++ b/compiler/rustc_target/src/spec/targets/x86_64_unknown_uefi.rs
@@ -16,6 +16,7 @@ pub fn target() -> Target {
@ -49,5 +76,5 @@ index 5abfb8162f70..13cb43bda1a4 100644
// We disable MMX and SSE for now, even though UEFI allows using them. Problem is, you have to
// enable these CPU features explicitly before their first use, otherwise their instructions
--
2.41.0
2.46.0

@ -1,4 +1,4 @@
From df0d6f1d8b46db82d7599ca8eff6e8f844cf52f2 Mon Sep 17 00:00:00 2001
From babdaf8354098399ec98c96eb3a3627664d6ba03 Mon Sep 17 00:00:00 2001
From: Josh Stone <jistone@redhat.com>
Date: Thu, 28 Sep 2023 18:14:28 -0700
Subject: [PATCH 1/2] bootstrap: allow disabling target self-contained
@ -11,12 +11,12 @@ Subject: [PATCH 1/2] bootstrap: allow disabling target self-contained
4 files changed, 22 insertions(+)
diff --git a/config.example.toml b/config.example.toml
index e5df28a49af6..2fcd8b8cb057 100644
index f1dc32234ccf..82207f19d471 100644
--- a/config.example.toml
+++ b/config.example.toml
@@ -807,6 +807,11 @@ change-id = 116881
# target triples containing `-none`, `nvptx`, `switch`, or `-uefi`.
#no-std = <platform-specific> (bool)
@@ -880,6 +880,11 @@
# argument as the test binary.
#runner = <none> (string)
+# Copy libc and CRT objects into the target lib/self-contained/ directory.
+# Enabled by default on `musl`, `wasi`, and `windows-gnu` targets. Other
@ -27,10 +27,10 @@ index e5df28a49af6..2fcd8b8cb057 100644
# Distribution options
#
diff --git a/src/bootstrap/src/core/build_steps/compile.rs b/src/bootstrap/src/core/build_steps/compile.rs
index 7021a9543582..11555c65ca87 100644
index edf18e2ebf33..d48d027f329c 100644
--- a/src/bootstrap/src/core/build_steps/compile.rs
+++ b/src/bootstrap/src/core/build_steps/compile.rs
@@ -302,6 +302,10 @@ fn copy_self_contained_objects(
@@ -367,6 +367,10 @@ fn copy_self_contained_objects(
compiler: &Compiler,
target: TargetSelection,
) -> Vec<(PathBuf, DependencyType)> {
@ -42,18 +42,18 @@ index 7021a9543582..11555c65ca87 100644
t!(fs::create_dir_all(&libdir_self_contained));
let mut target_deps = vec![];
diff --git a/src/bootstrap/src/core/config/config.rs b/src/bootstrap/src/core/config/config.rs
index 0a9175aa3ea5..a2e028b25036 100644
index bdfee55d8d18..47fcd50e7e03 100644
--- a/src/bootstrap/src/core/config/config.rs
+++ b/src/bootstrap/src/core/config/config.rs
@@ -533,6 +533,7 @@ pub struct Target {
pub wasi_root: Option<PathBuf>,
pub qemu_rootfs: Option<PathBuf>,
@@ -589,6 +589,7 @@ pub struct Target {
pub runner: Option<String>,
pub no_std: bool,
pub codegen_backends: Option<Vec<String>>,
+ pub self_contained: bool,
}
impl Target {
@@ -541,6 +542,9 @@ pub fn from_triple(triple: &str) -> Self {
@@ -597,6 +598,9 @@ pub fn from_triple(triple: &str) -> Self {
if triple.contains("-none") || triple.contains("nvptx") || triple.contains("switch") {
target.no_std = true;
}
@ -63,15 +63,15 @@ index 0a9175aa3ea5..a2e028b25036 100644
target
}
}
@@ -1051,6 +1055,7 @@ struct TomlTarget {
wasi_root: Option<String> = "wasi-root",
qemu_rootfs: Option<String> = "qemu-rootfs",
@@ -1165,6 +1169,7 @@ struct TomlTarget {
no_std: Option<bool> = "no-std",
codegen_backends: Option<Vec<String>> = "codegen-backends",
runner: Option<String> = "runner",
+ self_contained: Option<bool> = "self-contained",
}
}
@@ -1600,6 +1605,9 @@ fn get_table(option: &str) -> Result<TomlConfig, toml::de::Error> {
@@ -1967,6 +1972,9 @@ fn get_table(option: &str) -> Result<TomlConfig, toml::de::Error> {
if let Some(s) = cfg.no_std {
target.no_std = s;
}
@ -82,10 +82,10 @@ index 0a9175aa3ea5..a2e028b25036 100644
target.cxx = cfg.cxx.map(PathBuf::from);
target.ar = cfg.ar.map(PathBuf::from);
diff --git a/src/bootstrap/src/lib.rs b/src/bootstrap/src/lib.rs
index 33b8f1a7ce72..f36e53187576 100644
index 82b640f54234..f724aba50241 100644
--- a/src/bootstrap/src/lib.rs
+++ b/src/bootstrap/src/lib.rs
@@ -1335,6 +1335,11 @@ fn no_std(&self, target: TargetSelection) -> Option<bool> {
@@ -1326,6 +1326,11 @@ fn no_std(&self, target: TargetSelection) -> Option<bool> {
self.config.target_config.get(&target).map(|t| t.no_std)
}
@ -98,5 +98,5 @@ index 33b8f1a7ce72..f36e53187576 100644
/// and `remote-test-server` binaries.
fn remote_tested(&self, target: TargetSelection) -> bool {
--
2.41.0
2.46.0

@ -0,0 +1,162 @@
From 65458aed68fe6786068bab00e5a46d7ecdd2a072 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E8=AE=B8=E6=9D=B0=E5=8F=8B=20Jieyou=20Xu=20=28Joe=29?=
<39484203+jieyouxu@users.noreply.github.com>
Date: Thu, 17 Oct 2024 22:58:45 +0800
Subject: [PATCH] bootstrap: allow setting `--jobs` in config.toml
---
config.example.toml | 5 ++
src/bootstrap/src/core/config/config.rs | 5 +-
src/bootstrap/src/core/config/flags.rs | 3 +-
src/bootstrap/src/core/config/tests.rs | 58 +++++++++++++++++++++++
src/bootstrap/src/utils/change_tracker.rs | 5 ++
5 files changed, 73 insertions(+), 3 deletions(-)
diff --git a/config.example.toml b/config.example.toml
index 4b591b949b36..168ac353cff7 100644
--- a/config.example.toml
+++ b/config.example.toml
@@ -414,6 +414,11 @@
# Specify the location of the Android NDK. Used when targeting Android.
#android-ndk = "/path/to/android-ndk-r26d"
+# Number of parallel jobs to be used for building and testing. If set to `0` or
+# omitted, it will be automatically determined. This is the `-j`/`--jobs` flag
+# passed to cargo invocations.
+#jobs = 0
+
# =============================================================================
# General install configuration options
# =============================================================================
diff --git a/src/bootstrap/src/core/config/config.rs b/src/bootstrap/src/core/config/config.rs
index c2ab439891ea..aeb81b146382 100644
--- a/src/bootstrap/src/core/config/config.rs
+++ b/src/bootstrap/src/core/config/config.rs
@@ -891,6 +891,7 @@ struct Build {
metrics: Option<bool> = "metrics",
android_ndk: Option<PathBuf> = "android-ndk",
optimized_compiler_builtins: Option<bool> = "optimized-compiler-builtins",
+ jobs: Option<u32> = "jobs",
}
}
@@ -1289,7 +1290,6 @@ pub(crate) fn parse_inner(
config.rustc_error_format = flags.rustc_error_format;
config.json_output = flags.json_output;
config.on_fail = flags.on_fail;
- config.jobs = Some(threads_from_config(flags.jobs as u32));
config.cmd = flags.cmd;
config.incremental = flags.incremental;
config.dry_run = if flags.dry_run { DryRun::UserSelected } else { DryRun::Disabled };
@@ -1511,8 +1511,11 @@ fn get_table(option: &str) -> Result<TomlConfig, toml::de::Error> {
metrics: _,
android_ndk,
optimized_compiler_builtins,
+ jobs,
} = toml.build.unwrap_or_default();
+ config.jobs = Some(threads_from_config(flags.jobs.unwrap_or(jobs.unwrap_or(0))));
+
if let Some(file_build) = build {
config.build = TargetSelection::from_user(&file_build);
};
diff --git a/src/bootstrap/src/core/config/flags.rs b/src/bootstrap/src/core/config/flags.rs
index 3aefe517a5be..bfeb811508c0 100644
--- a/src/bootstrap/src/core/config/flags.rs
+++ b/src/bootstrap/src/core/config/flags.rs
@@ -110,11 +110,10 @@ pub struct Flags {
short,
long,
value_hint = clap::ValueHint::Other,
- default_value_t = std::thread::available_parallelism().map_or(1, std::num::NonZeroUsize::get),
value_name = "JOBS"
)]
/// number of jobs to run in parallel
- pub jobs: usize,
+ pub jobs: Option<u32>,
// This overrides the deny-warnings configuration option,
// which passes -Dwarnings to the compiler invocations.
#[arg(global = true, long)]
diff --git a/src/bootstrap/src/core/config/tests.rs b/src/bootstrap/src/core/config/tests.rs
index 2611b6cf51bb..1f02757682c2 100644
--- a/src/bootstrap/src/core/config/tests.rs
+++ b/src/bootstrap/src/core/config/tests.rs
@@ -352,3 +352,61 @@ fn parse_rust_std_features_empty() {
fn parse_rust_std_features_invalid() {
parse("rust.std-features = \"backtrace\"");
}
+
+#[test]
+fn parse_jobs() {
+ assert_eq!(parse("build.jobs = 1").jobs, Some(1));
+}
+
+#[test]
+fn jobs_precedence() {
+ // `--jobs` should take precedence over using `--set build.jobs`.
+
+ let config = Config::parse_inner(
+ Flags::parse(&[
+ "check".to_owned(),
+ "--config=/does/not/exist".to_owned(),
+ "--jobs=67890".to_owned(),
+ "--set=build.jobs=12345".to_owned(),
+ ]),
+ |&_| toml::from_str(""),
+ );
+ assert_eq!(config.jobs, Some(67890));
+
+ // `--set build.jobs` should take precedence over `config.toml`.
+ let config = Config::parse_inner(
+ Flags::parse(&[
+ "check".to_owned(),
+ "--config=/does/not/exist".to_owned(),
+ "--set=build.jobs=12345".to_owned(),
+ ]),
+ |&_| {
+ toml::from_str(
+ r#"
+ [build]
+ jobs = 67890
+ "#,
+ )
+ },
+ );
+ assert_eq!(config.jobs, Some(12345));
+
+ // `--jobs` > `--set build.jobs` > `config.toml`
+ let config = Config::parse_inner(
+ Flags::parse(&[
+ "check".to_owned(),
+ "--jobs=123".to_owned(),
+ "--config=/does/not/exist".to_owned(),
+ "--set=build.jobs=456".to_owned(),
+ ]),
+ |&_| {
+ toml::from_str(
+ r#"
+ [build]
+ jobs = 789
+ "#,
+ )
+ },
+ );
+ assert_eq!(config.jobs, Some(123));
+}
diff --git a/src/bootstrap/src/utils/change_tracker.rs b/src/bootstrap/src/utils/change_tracker.rs
index b37786496cb5..9169bc90a45d 100644
--- a/src/bootstrap/src/utils/change_tracker.rs
+++ b/src/bootstrap/src/utils/change_tracker.rs
@@ -275,4 +275,9 @@ pub fn human_readable_changes(changes: &[ChangeInfo]) -> String {
severity: ChangeSeverity::Info,
summary: "New option `./x setup editor` added, replacing `./x setup vscode` and adding support for vim, emacs and helix.",
},
+ ChangeInfo {
+ change_id: 131838,
+ severity: ChangeSeverity::Info,
+ summary: "Allow setting `--jobs` in config.toml with `build.jobs`.",
+ },
];
--
2.47.0

@ -1,19 +1,19 @@
From 79bb610c8fc5d9df7dd4720ae847b8f17e7b1ad4 Mon Sep 17 00:00:00 2001
From 3fdce19416e80a48c5b2b77b2cdec697d0b5e225 Mon Sep 17 00:00:00 2001
From: Josh Stone <jistone@redhat.com>
Date: Thu, 28 Sep 2023 18:18:16 -0700
Subject: [PATCH 2/2] set an external library path for wasm32-wasi
---
compiler/rustc_codegen_ssa/src/back/link.rs | 9 +++++++++
compiler/rustc_target/src/spec/mod.rs | 2 ++
compiler/rustc_target/src/spec/targets/wasm32_wasi.rs | 6 +++++-
3 files changed, 16 insertions(+), 1 deletion(-)
compiler/rustc_codegen_ssa/src/back/link.rs | 10 ++++++++++
compiler/rustc_target/src/spec/mod.rs | 4 ++++
.../rustc_target/src/spec/targets/wasm32_wasip1.rs | 7 ++++---
3 files changed, 18 insertions(+), 3 deletions(-)
diff --git a/compiler/rustc_codegen_ssa/src/back/link.rs b/compiler/rustc_codegen_ssa/src/back/link.rs
index dd9d277fb775..3d0f0502f255 100644
index e8143b9a5f38..5a928a18b3ea 100644
--- a/compiler/rustc_codegen_ssa/src/back/link.rs
+++ b/compiler/rustc_codegen_ssa/src/back/link.rs
@@ -1496,6 +1496,12 @@ fn get_object_file_path(sess: &Session, name: &str, self_contained: bool) -> Pat
@@ -1621,6 +1621,12 @@ fn get_object_file_path(sess: &Session, name: &str, self_contained: bool) -> Pat
return file_path;
}
}
@ -23,13 +23,14 @@ index dd9d277fb775..3d0f0502f255 100644
+ return file_path;
+ }
+ }
for search_path in fs.search_paths() {
for search_path in sess.target_filesearch(PathKind::Native).search_paths() {
let file_path = search_path.dir.join(name);
if file_path.exists() {
@@ -1982,6 +1988,9 @@ fn add_library_search_dirs(cmd: &mut dyn Linker, sess: &Session, self_contained:
let lib_path = sess.target_filesearch(PathKind::All).get_self_contained_lib_path();
cmd.include_path(&fix_windows_verbatim_for_gcc(&lib_path));
}
@@ -2123,6 +2129,10 @@ fn add_library_search_dirs(
ControlFlow::<()>::Continue(())
},
);
+
+ if let Some(lib_path) = &sess.target.options.external_lib_path {
+ cmd.include_path(Path::new(lib_path.as_ref()));
+ }
@ -37,10 +38,10 @@ index dd9d277fb775..3d0f0502f255 100644
/// Add options making relocation sections in the produced ELF files read-only
diff --git a/compiler/rustc_target/src/spec/mod.rs b/compiler/rustc_target/src/spec/mod.rs
index f04799482c83..25410b37ba24 100644
index d5f227a84a4c..54c22c8ebed6 100644
--- a/compiler/rustc_target/src/spec/mod.rs
+++ b/compiler/rustc_target/src/spec/mod.rs
@@ -1874,6 +1874,7 @@ pub struct TargetOptions {
@@ -2053,6 +2053,7 @@ pub struct TargetOptions {
/// Objects to link before and after all other object code.
pub pre_link_objects: CrtObjects,
pub post_link_objects: CrtObjects,
@ -48,7 +49,7 @@ index f04799482c83..25410b37ba24 100644
/// Same as `(pre|post)_link_objects`, but when self-contained linking mode is enabled.
pub pre_link_objects_self_contained: CrtObjects,
pub post_link_objects_self_contained: CrtObjects,
@@ -2352,6 +2353,7 @@ fn default() -> TargetOptions {
@@ -2540,6 +2541,7 @@ fn default() -> TargetOptions {
relro_level: RelroLevel::None,
pre_link_objects: Default::default(),
post_link_objects: Default::default(),
@ -56,23 +57,42 @@ index f04799482c83..25410b37ba24 100644
pre_link_objects_self_contained: Default::default(),
post_link_objects_self_contained: Default::default(),
link_self_contained: LinkSelfContainedDefault::False,
diff --git a/compiler/rustc_target/src/spec/targets/wasm32_wasi.rs b/compiler/rustc_target/src/spec/targets/wasm32_wasi.rs
index 6dbcb01ea436..2151f86d0648 100644
--- a/compiler/rustc_target/src/spec/targets/wasm32_wasi.rs
+++ b/compiler/rustc_target/src/spec/targets/wasm32_wasi.rs
@@ -86,7 +86,11 @@ pub fn target() -> Target {
options.post_link_objects_self_contained = crt_objects::post_wasi_self_contained();
@@ -3221,6 +3223,7 @@ macro_rules! key {
key!(linker_is_gnu_json = "linker-is-gnu", bool);
key!(pre_link_objects = "pre-link-objects", link_objects);
key!(post_link_objects = "post-link-objects", link_objects);
+ key!(external_lib_path, optional);
key!(pre_link_objects_self_contained = "pre-link-objects-fallback", link_objects);
key!(post_link_objects_self_contained = "post-link-objects-fallback", link_objects);
// Deserializes the backwards-compatible variants of `-Clink-self-contained`
@@ -3482,6 +3485,7 @@ macro_rules! target_option_val {
target_option_val!(linker_is_gnu_json, "linker-is-gnu");
target_option_val!(pre_link_objects);
target_option_val!(post_link_objects);
+ target_option_val!(external_lib_path);
target_option_val!(pre_link_objects_self_contained, "pre-link-objects-fallback");
target_option_val!(post_link_objects_self_contained, "post-link-objects-fallback");
target_option_val!(link_args - pre_link_args_json, "pre-link-args");
diff --git a/compiler/rustc_target/src/spec/targets/wasm32_wasip1.rs b/compiler/rustc_target/src/spec/targets/wasm32_wasip1.rs
index 29e6dff2068f..dbe021ef064c 100644
--- a/compiler/rustc_target/src/spec/targets/wasm32_wasip1.rs
+++ b/compiler/rustc_target/src/spec/targets/wasm32_wasip1.rs
@@ -19,11 +19,12 @@ pub fn target() -> Target {
options.env = "p1".into();
options.add_pre_link_args(LinkerFlavor::WasmLld(Cc::Yes), &["--target=wasm32-wasi"]);
- options.pre_link_objects_self_contained = crt_objects::pre_wasi_self_contained();
- options.post_link_objects_self_contained = crt_objects::post_wasi_self_contained();
+ options.pre_link_objects = crt_objects::pre_wasi_self_contained();
+ options.post_link_objects = crt_objects::post_wasi_self_contained();
// FIXME: Figure out cases in which WASM needs to link with a native toolchain.
- options.link_self_contained = LinkSelfContainedDefault::True;
+ options.link_self_contained = LinkSelfContainedDefault::False;
+
+ options.pre_link_objects = options.pre_link_objects_self_contained.clone();
+ options.post_link_objects = options.post_link_objects_self_contained.clone();
+ options.external_lib_path = Some("/usr/wasm32-wasi/lib/wasm32-wasi".into());
// Right now this is a bit of a workaround but we're currently saying that
// the target by default has a static crt which we're taking as a signal
--
2.41.0
2.46.0

@ -0,0 +1,62 @@
# rust_arches: list of architectures where building Rust is supported
#
# Since RPM itself now depends on Rust code (via its GPG backend, rpm-sequoia),
# this list will probably always be a superset of all architectures that are
# supported by Fedora, which is why it is no longer required to set
# "ExclusiveArch: rust_arches" for Rust packages in Fedora.
%rust_arches x86_64 %{ix86} armv7hl aarch64 ppc64 ppc64le riscv64 s390x
# version_no_tilde: lua macro for reconstructing the original crate version
# from the RPM version (i.e. replace any "~" characters with "-")
%version_no_tilde() %{lua:
local sep = rpm.expand('%1')
local ver = rpm.expand('%2')
\
if sep == '%1' then
sep = '-'
end
\
if ver == '%2' then
ver = rpm.expand('%version')
end
ver = ver:gsub('~', sep)
\
print(ver)
}
# __crates_url: default API endpoint for downloading .crate files from crates.io
%__crates_url https://crates.io/api/v1/crates/
# crates_source: lua macro for constructing the Source URL for a crate
%crates_source() %{lua:
local crate = rpm.expand('%1')
local version = rpm.expand('%2')
local url = rpm.expand('%__crates_url')
\
-- first argument missing: fall back to %crate
if crate == '%1' then
crate = rpm.expand('%crate')
end
-- %crate macro not defined: fall back to %name
if crate == '%crate' then
crate = rpm.expand('%name')
end
\
-- second argument missing: fall back to %crate_version
if version == '%2' then
version = rpm.expand('%crate_version')
end
-- %crate_version macro not defined: fall back to %version
if version == '%crate_version' then
version = rpm.expand('%version')
end
-- replace '~' with '-' for backwards compatibility
-- can be removed in the future
version = version:gsub('~', '-')
\
print(url .. crate .. '/' .. version .. '/download#/' .. crate .. '-' .. version .. '.crate')
}
# __cargo_skip_build: unused macro, set to 0 for backwards compatibility
%__cargo_skip_build 0

@ -48,7 +48,7 @@
# __cargo: cargo command with environment variables
#
# CARGO_HOME: This ensures cargo reads configuration file from .cargo/config,
# CARGO_HOME: This ensures cargo reads configuration file from .cargo/config.toml,
# and prevents writing any files to $HOME during RPM builds.
%__cargo /usr/bin/env CARGO_HOME=.cargo RUSTFLAGS='%{build_rustflags}' /usr/bin/cargo
@ -61,7 +61,7 @@
#
# This involves four steps:
# - create the ".cargo" directory if it doesn't exist yet
# - dump custom cargo configuration into ".cargo/config"
# - dump custom cargo configuration into ".cargo/config.toml"
# - remove "Cargo.lock" if it exists (it breaks builds with custom cargo config)
# - remove "Cargo.toml.orig" if it exists (it breaks running "cargo package")
#
@ -79,7 +79,7 @@ set -euo pipefail\
/usr/bin/ln -s rpm target/release\
%{__rm} -rf .cargo/\
%{__mkdir} -p .cargo\
cat > .cargo/config << EOF\
cat > .cargo/config.toml << EOF\
[build]\
rustc = "%{__rustc}"\
rustdoc = "%{__rustdoc}"\
@ -104,7 +104,7 @@ verbose = true\
EOF\
%{-V:%{__tar} -xoaf %{S:%{-V*}}}\
%{!?-N:\
cat >> .cargo/config << EOF\
cat >> .cargo/config.toml << EOF\
[source.vendored-sources]\
directory = "%{-v*}%{-V:./vendor}"\
\
@ -126,32 +126,31 @@ EOF}\
%{nil} \
}
# NB: cargo_build/test/install do not use the -n/-a/-f argument parsing like
# Fedora's rust-packaging, because that change would break anyone that's
# already passing arguments directly to cargo after the macro. Instead, one can
# explicitly use --no-default-features, --all-features, or --features XYZ.
# cargo_build: builds the crate with cargo
%cargo_build\
# cargo_build: builds the crate with cargo with the specified feature flags
%cargo_build(naf:)\
%{shrink: \
%{__cargo} build \
%{__cargo_common_opts} \
--profile rpm \
%{__cargo_parse_opts %{-n} %{-a} %{-f:-f%{-f*}}} \
%* \
}
# cargo_test: runs the test suite with cargo
# cargo_test: runs the test suite with cargo with the specified feature flags
#
# To pass command-line arguments to the cargo test runners directly (for
# example, to skip certain tests during package builds), the
# "cargo test" argument parsing need to be bypassed,
# i.e. "%%cargo_test -- --skip foo" for skipping all tests with names that
# example, to skip certain tests during package builds), both the cargo_test
# macro argument parsing and "cargo test" argument parsing need to be bypassed,
# i.e. "%%cargo_test -- -- --skip foo" for skipping all tests with names that
# match "foo".
%cargo_test\
%cargo_test(naf:)\
%{shrink: \
%{__cargo} test \
%{__cargo_common_opts} \
--profile rpm \
--no-fail-fast \
%{__cargo_parse_opts %{-n} %{-a} %{-f:-f%{-f*}}} \
%* \
}
# cargo_install: install files into the buildroot
@ -161,7 +160,7 @@ EOF}\
# "$CARGO_HOME/.crates.toml" file, which is used to keep track of which version
# of a specific binary has been installed, but which conflicts between builds
# of different Rust applications and is not needed when building RPM packages.
%cargo_install\
%cargo_install(t:naf:)\
(\
set -euo pipefail \
%{shrink: \
@ -170,6 +169,8 @@ set -euo pipefail \
--profile rpm \
--no-track \
--path . \
%{__cargo_parse_opts %{-n} %{-a} %{-f:-f%{-f*}}} \
%* \
} \
)

@ -1,42 +0,0 @@
--- rustc-beta-src/src/tools/cargo/Cargo.lock.orig 2024-01-07 18:12:08.000000000 -0800
+++ rustc-beta-src/src/tools/cargo/Cargo.lock 2024-01-09 15:25:51.519781381 -0800
@@ -2071,7 +2071,6 @@
dependencies = [
"cc",
"libc",
- "libssh2-sys",
"libz-sys",
"openssl-sys",
"pkg-config",
@@ -2113,20 +2112,6 @@
"pkg-config",
"vcpkg",
]
-
-[[package]]
-name = "libssh2-sys"
-version = "0.3.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2dc8a030b787e2119a731f1951d6a773e2280c660f8ec4b0f5e1505a386e71ee"
-dependencies = [
- "cc",
- "libc",
- "libz-sys",
- "openssl-sys",
- "pkg-config",
- "vcpkg",
-]
[[package]]
name = "libz-sys"
--- rustc-beta-src/src/tools/cargo/Cargo.toml.orig 2024-01-09 15:23:02.369032291 -0800
+++ rustc-beta-src/src/tools/cargo/Cargo.toml 2024-01-09 15:24:44.015679666 -0800
@@ -40,7 +40,7 @@
curl-sys = "0.4.70"
filetime = "0.2.22"
flate2 = { version = "1.0.28", default-features = false, features = ["zlib"] }
-git2 = "0.18.1"
+git2 = { version = "0.18.1", default-features = false, features = ["https"] }
git2-curl = "0.19.0"
gix = { version = "0.56.0", default-features = false, features = ["blocking-http-transport-curl", "progress-tree", "revision"] }
gix-features-for-configuration-only = { version = "0.35.0", package = "gix-features", features = [ "parallel" ] }

@ -1,21 +0,0 @@
--- rustc-beta-src/src/tools/cargo/Cargo.lock.orig 2024-01-07 18:12:08.000000000 -0800
+++ rustc-beta-src/src/tools/cargo/Cargo.lock 2024-01-09 15:36:23.808367445 -0800
@@ -2109,7 +2109,6 @@
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cf4e226dcd58b4be396f7bd3c20da8fdee2911400705297ba7d2d7cc2c30f716"
dependencies = [
- "cc",
"pkg-config",
"vcpkg",
]
--- rustc-beta-src/src/tools/cargo/Cargo.toml.orig 2024-01-07 18:12:08.000000000 -0800
+++ rustc-beta-src/src/tools/cargo/Cargo.toml 2024-01-09 15:36:18.534437627 -0800
@@ -73,7 +73,7 @@
pulldown-cmark = { version = "0.9.3", default-features = false }
rand = "0.8.5"
regex = "1.10.2"
-rusqlite = { version = "0.30.0", features = ["bundled"] }
+rusqlite = { version = "0.30.0", features = [] }
rustfix = { version = "0.7.0", path = "crates/rustfix" }
same-file = "1.0.6"
security-framework = "2.9.2"

@ -0,0 +1,44 @@
diff -up rustc-beta-src/src/tools/cargo/Cargo.lock.orig rustc-beta-src/src/tools/cargo/Cargo.lock
--- rustc-beta-src/src/tools/cargo/Cargo.lock.orig 2024-09-06 10:36:55.743405666 -0700
+++ rustc-beta-src/src/tools/cargo/Cargo.lock 2024-09-06 10:36:55.745405652 -0700
@@ -2156,7 +2156,6 @@ checksum = "10472326a8a6477c3c20a64547b0
dependencies = [
"cc",
"libc",
- "libssh2-sys",
"libz-sys",
"openssl-sys",
"pkg-config",
@@ -2197,20 +2196,6 @@ dependencies = [
"pkg-config",
"vcpkg",
]
-
-[[package]]
-name = "libssh2-sys"
-version = "0.3.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2dc8a030b787e2119a731f1951d6a773e2280c660f8ec4b0f5e1505a386e71ee"
-dependencies = [
- "cc",
- "libc",
- "libz-sys",
- "openssl-sys",
- "pkg-config",
- "vcpkg",
-]
[[package]]
name = "libz-sys"
diff -up rustc-beta-src/src/tools/cargo/Cargo.toml.orig rustc-beta-src/src/tools/cargo/Cargo.toml
--- rustc-beta-src/src/tools/cargo/Cargo.toml.orig 2024-09-06 10:36:55.746405645 -0700
+++ rustc-beta-src/src/tools/cargo/Cargo.toml 2024-09-06 10:37:13.849280464 -0700
@@ -44,7 +44,7 @@ curl = "0.4.46"
curl-sys = "0.4.73"
filetime = "0.2.23"
flate2 = { version = "1.0.30", default-features = false, features = ["zlib"] }
-git2 = "0.19.0"
+git2 = { version = "0.19.0", default-features = false, features = ["https"] }
git2-curl = "0.20.0"
gix = { version = "0.64.0", default-features = false, features = ["blocking-http-transport-curl", "progress-tree", "parallel", "dirwalk"] }
glob = "0.3.1"

@ -0,0 +1,23 @@
diff -up rustc-beta-src/src/tools/cargo/Cargo.lock.orig rustc-beta-src/src/tools/cargo/Cargo.lock
--- rustc-beta-src/src/tools/cargo/Cargo.lock.orig 2024-09-06 10:30:29.435107742 -0700
+++ rustc-beta-src/src/tools/cargo/Cargo.lock 2024-09-06 10:31:57.168492758 -0700
@@ -2194,7 +2194,6 @@ version = "0.30.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2e99fb7a497b1e3339bc746195567ed8d3e24945ecd636e3619d20b9de9e9149"
dependencies = [
- "cc",
"pkg-config",
"vcpkg",
]
diff -up rustc-beta-src/src/tools/cargo/Cargo.toml.orig rustc-beta-src/src/tools/cargo/Cargo.toml
--- rustc-beta-src/src/tools/cargo/Cargo.toml.orig 2024-09-06 10:30:29.435107742 -0700
+++ rustc-beta-src/src/tools/cargo/Cargo.toml 2024-09-06 10:31:27.942697616 -0700
@@ -77,7 +77,7 @@ proptest = "1.5.0"
pulldown-cmark = { version = "0.11.0", default-features = false, features = ["html"] }
rand = "0.8.5"
regex = "1.10.5"
-rusqlite = { version = "0.32.0", features = ["bundled"] }
+rusqlite = { version = "0.32.0", features = [] }
rustfix = { version = "0.8.2", path = "crates/rustfix" }
same-file = "1.0.6"
security-framework = "2.11.1"

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save