From 5379ac25ac84118a6fa60bb950566889dcf3e1ea Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Thu, 15 Dec 2022 09:12:22 -0800 Subject: [PATCH] Update to 1.66.0. --- .gitignore | 2 + ...ove-generating-Custom-entry-function.patch | 302 ++++++++++++++++++ ...e-main-as-__main_void-on-wasm32-wasi.patch | 34 ++ ...-Use-lld-provided-by-system-for-wasm.patch | 12 +- ...the-dylib-path-when-gathering-target.patch | 31 +- ...ansmute-fix-big-endian-discriminants.patch | 52 --- rust.spec | 31 +- sources | 4 +- 8 files changed, 382 insertions(+), 86 deletions(-) create mode 100644 0001-Improve-generating-Custom-entry-function.patch create mode 100644 0001-Mangle-main-as-__main_void-on-wasm32-wasi.patch delete mode 100644 0001-rustc_transmute-fix-big-endian-discriminants.patch diff --git a/.gitignore b/.gitignore index 7cce16d..9c352d2 100644 --- a/.gitignore +++ b/.gitignore @@ -407,3 +407,5 @@ /rustc-1.64.0-src.tar.xz /rustc-1.65.0-src.tar.xz /wasi-libc-wasi-sdk-16.tar.gz +/rustc-1.66.0-src.tar.xz +/wasi-libc-wasi-sdk-17.tar.gz diff --git a/0001-Improve-generating-Custom-entry-function.patch b/0001-Improve-generating-Custom-entry-function.patch new file mode 100644 index 0000000..77cb30e --- /dev/null +++ b/0001-Improve-generating-Custom-entry-function.patch @@ -0,0 +1,302 @@ +From 9f0a8620bd7d325e6d42417b08daff3e55cb88f6 Mon Sep 17 00:00:00 2001 +From: Ayush Singh +Date: Sat, 5 Nov 2022 14:36:38 +0530 +Subject: [PATCH] Improve generating Custom entry function + +This commit is aimed at making compiler generated entry functions +(Basically just C `main` right now) more generic so other targets can do +similar things for custom entry. This was initially implemented as part +of https://github.com/rust-lang/rust/pull/100316. + +Currently, this moves the entry function name and Call convention to the +target spec. + +Signed-off-by: Ayush Singh +--- + compiler/rustc_codegen_llvm/src/abi.rs | 40 +++++++++++-------- + compiler/rustc_codegen_llvm/src/context.rs | 10 ++++- + compiler/rustc_codegen_llvm/src/declare.rs | 22 ++++++++++ + .../src/back/symbol_export.rs | 3 +- + compiler/rustc_target/src/abi/call/mod.rs | 28 +++++++++++++ + compiler/rustc_target/src/json.rs | 25 ++++++++++++ + compiler/rustc_target/src/spec/mod.rs | 27 +++++++++++++ + 7 files changed, 135 insertions(+), 20 deletions(-) + +diff --git a/compiler/rustc_codegen_llvm/src/abi.rs b/compiler/rustc_codegen_llvm/src/abi.rs +index d478efc863a9..a6fd2a7de6bd 100644 +--- a/compiler/rustc_codegen_llvm/src/abi.rs ++++ b/compiler/rustc_codegen_llvm/src/abi.rs +@@ -398,23 +398,7 @@ fn ptr_to_llvm_type(&self, cx: &CodegenCx<'ll, 'tcx>) -> &'ll Type { + } + + fn llvm_cconv(&self) -> llvm::CallConv { +- match self.conv { +- Conv::C | Conv::Rust | Conv::CCmseNonSecureCall => llvm::CCallConv, +- Conv::RustCold => llvm::ColdCallConv, +- Conv::AmdGpuKernel => llvm::AmdGpuKernel, +- Conv::AvrInterrupt => llvm::AvrInterrupt, +- Conv::AvrNonBlockingInterrupt => llvm::AvrNonBlockingInterrupt, +- Conv::ArmAapcs => llvm::ArmAapcsCallConv, +- Conv::Msp430Intr => llvm::Msp430Intr, +- Conv::PtxKernel => llvm::PtxKernel, +- Conv::X86Fastcall => llvm::X86FastcallCallConv, +- Conv::X86Intr => llvm::X86_Intr, +- Conv::X86Stdcall => llvm::X86StdcallCallConv, +- Conv::X86ThisCall => llvm::X86_ThisCall, +- Conv::X86VectorCall => llvm::X86_VectorCall, +- Conv::X86_64SysV => llvm::X86_64_SysV, +- Conv::X86_64Win64 => llvm::X86_64_Win64, +- } ++ self.conv.into() + } + + fn apply_attrs_llfn(&self, cx: &CodegenCx<'ll, 'tcx>, llfn: &'ll Value) { +@@ -596,3 +580,25 @@ fn get_param(&mut self, index: usize) -> Self::Value { + llvm::get_param(self.llfn(), index as c_uint) + } + } ++ ++impl From for llvm::CallConv { ++ fn from(conv: Conv) -> Self { ++ match conv { ++ Conv::C | Conv::Rust | Conv::CCmseNonSecureCall => llvm::CCallConv, ++ Conv::RustCold => llvm::ColdCallConv, ++ Conv::AmdGpuKernel => llvm::AmdGpuKernel, ++ Conv::AvrInterrupt => llvm::AvrInterrupt, ++ Conv::AvrNonBlockingInterrupt => llvm::AvrNonBlockingInterrupt, ++ Conv::ArmAapcs => llvm::ArmAapcsCallConv, ++ Conv::Msp430Intr => llvm::Msp430Intr, ++ Conv::PtxKernel => llvm::PtxKernel, ++ Conv::X86Fastcall => llvm::X86FastcallCallConv, ++ Conv::X86Intr => llvm::X86_Intr, ++ Conv::X86Stdcall => llvm::X86StdcallCallConv, ++ Conv::X86ThisCall => llvm::X86_ThisCall, ++ Conv::X86VectorCall => llvm::X86_VectorCall, ++ Conv::X86_64SysV => llvm::X86_64_SysV, ++ Conv::X86_64Win64 => llvm::X86_64_Win64, ++ } ++ } ++} +diff --git a/compiler/rustc_codegen_llvm/src/context.rs b/compiler/rustc_codegen_llvm/src/context.rs +index 79ddfd884dfa..f3ef618fff54 100644 +--- a/compiler/rustc_codegen_llvm/src/context.rs ++++ b/compiler/rustc_codegen_llvm/src/context.rs +@@ -570,8 +570,14 @@ fn apply_target_cpu_attr(&self, llfn: &'ll Value) { + } + + fn declare_c_main(&self, fn_type: Self::Type) -> Option { +- if self.get_declared_value("main").is_none() { +- Some(self.declare_cfn("main", llvm::UnnamedAddr::Global, fn_type)) ++ let entry_name = self.sess().target.entry_name.as_ref(); ++ if self.get_declared_value(entry_name).is_none() { ++ Some(self.declare_entry_fn( ++ entry_name, ++ self.sess().target.entry_abi.into(), ++ llvm::UnnamedAddr::Global, ++ fn_type, ++ )) + } else { + // If the symbol already exists, it is an error: for example, the user wrote + // #[no_mangle] extern "C" fn main(..) {..} +diff --git a/compiler/rustc_codegen_llvm/src/declare.rs b/compiler/rustc_codegen_llvm/src/declare.rs +index f79ef11720df..dc21a02cec44 100644 +--- a/compiler/rustc_codegen_llvm/src/declare.rs ++++ b/compiler/rustc_codegen_llvm/src/declare.rs +@@ -90,6 +90,28 @@ pub fn declare_cfn( + declare_raw_fn(self, name, llvm::CCallConv, unnamed, visibility, fn_type) + } + ++ /// Declare an entry Function ++ /// ++ /// The ABI of this function can change depending on the target (although for now the same as ++ /// `declare_cfn`) ++ /// ++ /// If there’s a value with the same name already declared, the function will ++ /// update the declaration and return existing Value instead. ++ pub fn declare_entry_fn( ++ &self, ++ name: &str, ++ callconv: llvm::CallConv, ++ unnamed: llvm::UnnamedAddr, ++ fn_type: &'ll Type, ++ ) -> &'ll Value { ++ let visibility = if self.tcx.sess.target.default_hidden_visibility { ++ llvm::Visibility::Hidden ++ } else { ++ llvm::Visibility::Default ++ }; ++ declare_raw_fn(self, name, callconv, unnamed, visibility, fn_type) ++ } ++ + /// Declare a Rust function. + /// + /// If there’s a value with the same name already declared, the function will +diff --git a/compiler/rustc_codegen_ssa/src/back/symbol_export.rs b/compiler/rustc_codegen_ssa/src/back/symbol_export.rs +index 752f6b1ef40c..22f534d909ab 100644 +--- a/compiler/rustc_codegen_ssa/src/back/symbol_export.rs ++++ b/compiler/rustc_codegen_ssa/src/back/symbol_export.rs +@@ -180,7 +180,8 @@ fn exported_symbols_provider_local<'tcx>( + .collect(); + + if tcx.entry_fn(()).is_some() { +- let exported_symbol = ExportedSymbol::NoDefId(SymbolName::new(tcx, "main")); ++ let exported_symbol = ++ ExportedSymbol::NoDefId(SymbolName::new(tcx, tcx.sess.target.entry_name.as_ref())); + + symbols.push(( + exported_symbol, +diff --git a/compiler/rustc_target/src/abi/call/mod.rs b/compiler/rustc_target/src/abi/call/mod.rs +index 9e5f0e4d158b..c622bd36b00c 100644 +--- a/compiler/rustc_target/src/abi/call/mod.rs ++++ b/compiler/rustc_target/src/abi/call/mod.rs +@@ -3,6 +3,7 @@ + use crate::spec::{self, HasTargetSpec}; + use rustc_span::Symbol; + use std::fmt; ++use std::str::FromStr; + + mod aarch64; + mod amdgpu; +@@ -735,6 +736,33 @@ pub fn adjust_for_foreign_abi( + } + } + ++impl FromStr for Conv { ++ type Err = String; ++ ++ fn from_str(s: &str) -> Result { ++ match s { ++ "C" => Ok(Conv::C), ++ "Rust" => Ok(Conv::Rust), ++ "RustCold" => Ok(Conv::Rust), ++ "ArmAapcs" => Ok(Conv::ArmAapcs), ++ "CCmseNonSecureCall" => Ok(Conv::CCmseNonSecureCall), ++ "Msp430Intr" => Ok(Conv::Msp430Intr), ++ "PtxKernel" => Ok(Conv::PtxKernel), ++ "X86Fastcall" => Ok(Conv::X86Fastcall), ++ "X86Intr" => Ok(Conv::X86Intr), ++ "X86Stdcall" => Ok(Conv::X86Stdcall), ++ "X86ThisCall" => Ok(Conv::X86ThisCall), ++ "X86VectorCall" => Ok(Conv::X86VectorCall), ++ "X86_64SysV" => Ok(Conv::X86_64SysV), ++ "X86_64Win64" => Ok(Conv::X86_64Win64), ++ "AmdGpuKernel" => Ok(Conv::AmdGpuKernel), ++ "AvrInterrupt" => Ok(Conv::AvrInterrupt), ++ "AvrNonBlockingInterrupt" => Ok(Conv::AvrNonBlockingInterrupt), ++ _ => Err(format!("'{}' is not a valid value for entry function call convetion.", s)), ++ } ++ } ++} ++ + // Some types are used a lot. Make sure they don't unintentionally get bigger. + #[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))] + mod size_asserts { +diff --git a/compiler/rustc_target/src/json.rs b/compiler/rustc_target/src/json.rs +index b5d926352122..75bb76a9de08 100644 +--- a/compiler/rustc_target/src/json.rs ++++ b/compiler/rustc_target/src/json.rs +@@ -89,3 +89,28 @@ fn to_json(&self) -> Json { + } + } + } ++ ++impl ToJson for crate::abi::call::Conv { ++ fn to_json(&self) -> Json { ++ let s = match self { ++ Self::C => "C", ++ Self::Rust => "Rust", ++ Self::RustCold => "RustCold", ++ Self::ArmAapcs => "ArmAapcs", ++ Self::CCmseNonSecureCall => "CCmseNonSecureCall", ++ Self::Msp430Intr => "Msp430Intr", ++ Self::PtxKernel => "PtxKernel", ++ Self::X86Fastcall => "X86Fastcall", ++ Self::X86Intr => "X86Intr", ++ Self::X86Stdcall => "X86Stdcall", ++ Self::X86ThisCall => "X86ThisCall", ++ Self::X86VectorCall => "X86VectorCall", ++ Self::X86_64SysV => "X86_64SysV", ++ Self::X86_64Win64 => "X86_64Win64", ++ Self::AmdGpuKernel => "AmdGpuKernel", ++ Self::AvrInterrupt => "AvrInterrupt", ++ Self::AvrNonBlockingInterrupt => "AvrNonBlockingInterrupt", ++ }; ++ Json::String(s.to_owned()) ++ } ++} +diff --git a/compiler/rustc_target/src/spec/mod.rs b/compiler/rustc_target/src/spec/mod.rs +index 72b088d663b1..617de46a55aa 100644 +--- a/compiler/rustc_target/src/spec/mod.rs ++++ b/compiler/rustc_target/src/spec/mod.rs +@@ -34,6 +34,7 @@ + //! the target's settings, though `target-feature` and `link-args` will *add* + //! to the list specified by the target, rather than replace. + ++use crate::abi::call::Conv; + use crate::abi::Endian; + use crate::json::{Json, ToJson}; + use crate::spec::abi::{lookup as lookup_abi, Abi}; +@@ -1668,6 +1669,14 @@ pub struct TargetOptions { + /// Whether the target supports stack canary checks. `true` by default, + /// since this is most common among tier 1 and tier 2 targets. + pub supports_stack_protector: bool, ++ ++ // The name of entry function. ++ // Default value is "main" ++ pub entry_name: StaticCow, ++ ++ // The ABI of entry function. ++ // Default value is `Conv::C`, i.e. C call convention ++ pub entry_abi: Conv, + } + + /// Add arguments for the given flavor and also for its "twin" flavors +@@ -1884,6 +1893,8 @@ fn default() -> TargetOptions { + c_enum_min_bits: 32, + generate_arange_section: true, + supports_stack_protector: true, ++ entry_name: "main".into(), ++ entry_abi: Conv::C, + } + } + } +@@ -2401,6 +2412,18 @@ macro_rules! key { + } + } + } ); ++ ($key_name:ident, Conv) => ( { ++ let name = (stringify!($key_name)).replace("_", "-"); ++ obj.remove(&name).and_then(|o| o.as_str().and_then(|s| { ++ match Conv::from_str(s) { ++ Ok(c) => { ++ base.$key_name = c; ++ Some(Ok(())) ++ } ++ Err(e) => Some(Err(e)) ++ } ++ })).unwrap_or(Ok(())) ++ } ); + } + + if let Some(j) = obj.remove("target-endian") { +@@ -2520,6 +2543,8 @@ macro_rules! key { + key!(c_enum_min_bits, u64); + key!(generate_arange_section, bool); + key!(supports_stack_protector, bool); ++ key!(entry_name); ++ key!(entry_abi, Conv)?; + + if base.is_builtin { + // This can cause unfortunate ICEs later down the line. +@@ -2770,6 +2795,8 @@ macro_rules! target_option_val { + target_option_val!(c_enum_min_bits); + target_option_val!(generate_arange_section); + target_option_val!(supports_stack_protector); ++ target_option_val!(entry_name); ++ target_option_val!(entry_abi); + + if let Some(abi) = self.default_adjusted_cabi { + d.insert("default-adjusted-cabi".into(), Abi::name(abi).to_json()); +-- +2.38.1 + diff --git a/0001-Mangle-main-as-__main_void-on-wasm32-wasi.patch b/0001-Mangle-main-as-__main_void-on-wasm32-wasi.patch new file mode 100644 index 0000000..3f087ef --- /dev/null +++ b/0001-Mangle-main-as-__main_void-on-wasm32-wasi.patch @@ -0,0 +1,34 @@ +From 98ae83daae67e9e7663b8345eced1de8c667271f Mon Sep 17 00:00:00 2001 +From: Dan Gohman +Date: Thu, 8 Dec 2022 10:35:46 -0800 +Subject: [PATCH] Mangle "main" as "__main_void" on wasm32-wasi + +On wasm, the age-old C trick of having a main function which can either have +no arguments or argc+argv doesn't work, because wasm requires caller and +callee signatures to match. WASI's current strategy is to have compilers +mangle main's name to indicate which signature they're using. Rust uses the +no-argument form, which should be mangled as `__main_void`. + +This is needed on wasm32-wasi as of #105395. +--- + compiler/rustc_target/src/spec/wasm32_wasi.rs | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/compiler/rustc_target/src/spec/wasm32_wasi.rs b/compiler/rustc_target/src/spec/wasm32_wasi.rs +index 6f0bbf0672d4..a0476d542e64 100644 +--- a/compiler/rustc_target/src/spec/wasm32_wasi.rs ++++ b/compiler/rustc_target/src/spec/wasm32_wasi.rs +@@ -104,6 +104,10 @@ pub fn target() -> Target { + // `args::args()` makes the WASI API calls itself. + options.main_needs_argc_argv = false; + ++ // And, WASI mangles the name of "main" to distinguish between different ++ // signatures. ++ options.entry_name = "__main_void".into(); ++ + Target { + llvm_target: "wasm32-wasi".into(), + pointer_width: 32, +-- +2.38.1 + diff --git a/0001-Use-lld-provided-by-system-for-wasm.patch b/0001-Use-lld-provided-by-system-for-wasm.patch index fa75ad3..5fcc245 100644 --- a/0001-Use-lld-provided-by-system-for-wasm.patch +++ b/0001-Use-lld-provided-by-system-for-wasm.patch @@ -1,4 +1,4 @@ -From b521511174b1a08dddfac243604d649b71cc7386 Mon Sep 17 00:00:00 2001 +From 37cb177eb53145103ae72b67562884782dde01c3 Mon Sep 17 00:00:00 2001 From: Ivan Mironov Date: Sun, 8 Dec 2019 17:23:08 +0500 Subject: [PATCH] Use lld provided by system for wasm @@ -8,19 +8,19 @@ Subject: [PATCH] Use lld provided by system for wasm 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/compiler/rustc_target/src/spec/wasm_base.rs b/compiler/rustc_target/src/spec/wasm_base.rs -index de7b7374af31..eebbe616e9b6 100644 +index 528a84a8b37c..353d742161d1 100644 --- a/compiler/rustc_target/src/spec/wasm_base.rs +++ b/compiler/rustc_target/src/spec/wasm_base.rs -@@ -99,8 +99,7 @@ pub fn options() -> TargetOptions { +@@ -89,8 +89,7 @@ macro_rules! args { // arguments just yet limit_rdylib_exports: false, - // we use the LLD shipped with the Rust toolchain by default - linker: Some("rust-lld".into()), + linker: Some("lld".into()), - lld_flavor: LldFlavor::Wasm, - linker_is_gnu: false, + linker_flavor: LinkerFlavor::WasmLld(Cc::No), + pre_link_args, -- -2.35.1 +2.38.1 diff --git a/0001-compiletest-set-the-dylib-path-when-gathering-target.patch b/0001-compiletest-set-the-dylib-path-when-gathering-target.patch index 9fcfb3f..54185a7 100644 --- a/0001-compiletest-set-the-dylib-path-when-gathering-target.patch +++ b/0001-compiletest-set-the-dylib-path-when-gathering-target.patch @@ -1,4 +1,4 @@ -From 92b0b20e4119241aaeabb4b91189a9fca8ff8b5d Mon Sep 17 00:00:00 2001 +From 2bdbc5fbf7f84c62f8c7b1007f3b6fd6d3da06f6 Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Fri, 14 Oct 2022 16:11:28 -0700 Subject: [PATCH] compiletest: set the dylib path when gathering target cfg @@ -18,15 +18,15 @@ command for getting the target cfg. Now the library path is set here as well, so it works without rpath. -(cherry picked from commit 97c3608326d123f5462e3504409a3a069611c0fb) +(cherry picked from commit f8a0cc2ca8a644ddb63867526711ba17cb7508c8) --- - src/tools/compiletest/src/common.rs | 17 ++++++++++------- + src/tools/compiletest/src/common.rs | 20 +++++++++++--------- src/tools/compiletest/src/runtest.rs | 27 +++------------------------ src/tools/compiletest/src/util.rs | 23 +++++++++++++++++++++++ - 3 files changed, 36 insertions(+), 31 deletions(-) + 3 files changed, 37 insertions(+), 33 deletions(-) diff --git a/src/tools/compiletest/src/common.rs b/src/tools/compiletest/src/common.rs -index 64df76e27720..53b64e7d1fc3 100644 +index 0260f6848386..9a432f11f82f 100644 --- a/src/tools/compiletest/src/common.rs +++ b/src/tools/compiletest/src/common.rs @@ -2,11 +2,12 @@ @@ -43,20 +43,21 @@ index 64df76e27720..53b64e7d1fc3 100644 use lazycell::LazyCell; use test::ColorConfig; -@@ -389,7 +390,7 @@ pub fn run_enabled(&self) -> bool { +@@ -385,8 +386,7 @@ pub fn run_enabled(&self) -> bool { } fn target_cfg(&self) -> &TargetCfg { -- self.target_cfg.borrow_with(|| TargetCfg::new(&self.rustc_path, &self.target)) +- self.target_cfg +- .borrow_with(|| TargetCfg::new(&self.rustc_path, &self.target, &self.target_rustcflags)) + self.target_cfg.borrow_with(|| TargetCfg::new(self)) } pub fn matches_arch(&self, arch: &str) -> bool { -@@ -455,20 +456,22 @@ pub enum Endian { +@@ -457,21 +457,23 @@ pub enum Endian { } impl TargetCfg { -- fn new(rustc_path: &Path, target: &str) -> TargetCfg { +- fn new(rustc_path: &Path, target: &str, target_rustcflags: &Vec) -> TargetCfg { - let output = match Command::new(rustc_path) + fn new(config: &Config) -> TargetCfg { + let mut command = Command::new(&config.rustc_path); @@ -65,7 +66,9 @@ index 64df76e27720..53b64e7d1fc3 100644 .arg("--print=cfg") .arg("--target") - .arg(target) +- .args(target_rustcflags) + .arg(&config.target) ++ .args(&config.target_rustcflags) .output() { Ok(output) => output, @@ -81,7 +84,7 @@ index 64df76e27720..53b64e7d1fc3 100644 String::from_utf8(output.stderr).unwrap(), ); diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs -index 8f289876f730..eb467170249d 100644 +index 8af5f1da694b..f8903f754f09 100644 --- a/src/tools/compiletest/src/runtest.rs +++ b/src/tools/compiletest/src/runtest.rs @@ -13,7 +13,7 @@ @@ -121,7 +124,7 @@ index 8f289876f730..eb467170249d 100644 /// The platform-specific library name pub fn get_lib_name(lib: &str, dylib: bool) -> String { // In some casess (e.g. MUSL), we build a static -@@ -1826,16 +1814,7 @@ fn compose_and_run( +@@ -1811,16 +1799,7 @@ fn compose_and_run( // Need to be sure to put both the lib_path and the aux path in the dylib // search path for the child. @@ -140,7 +143,7 @@ index 8f289876f730..eb467170249d 100644 let mut child = disable_error_reporting(|| command.spawn()) .unwrap_or_else(|_| panic!("failed to exec `{:?}`", &command)); diff --git a/src/tools/compiletest/src/util.rs b/src/tools/compiletest/src/util.rs -index 9d047b63c859..4b73be0fbb90 100644 +index e5ff0906be8a..ec36f1e4fb72 100644 --- a/src/tools/compiletest/src/util.rs +++ b/src/tools/compiletest/src/util.rs @@ -2,6 +2,7 @@ @@ -151,7 +154,7 @@ index 9d047b63c859..4b73be0fbb90 100644 use tracing::*; -@@ -105,3 +106,25 @@ fn with_extra_extension>(&self, extension: S) -> PathBuf { +@@ -111,3 +112,25 @@ fn with_extra_extension>(&self, extension: S) -> PathBuf { } } } @@ -178,5 +181,5 @@ index 9d047b63c859..4b73be0fbb90 100644 + cmd.env(dylib_env_var(), env::join_paths(new_paths).unwrap()); +} -- -2.37.3 +2.38.1 diff --git a/0001-rustc_transmute-fix-big-endian-discriminants.patch b/0001-rustc_transmute-fix-big-endian-discriminants.patch deleted file mode 100644 index aa4fa94..0000000 --- a/0001-rustc_transmute-fix-big-endian-discriminants.patch +++ /dev/null @@ -1,52 +0,0 @@ -From a72666ed56ec5f1b6d254c7020cf86143edc6dbd Mon Sep 17 00:00:00 2001 -From: Josh Stone -Date: Tue, 20 Sep 2022 13:03:43 -0700 -Subject: [PATCH] rustc_transmute: fix big-endian discriminants - ---- - compiler/rustc_transmute/src/layout/tree.rs | 22 +++++++++++++++------ - 1 file changed, 16 insertions(+), 6 deletions(-) - -diff --git a/compiler/rustc_transmute/src/layout/tree.rs b/compiler/rustc_transmute/src/layout/tree.rs -index 211c813b8001..acd4fa63d782 100644 ---- a/compiler/rustc_transmute/src/layout/tree.rs -+++ b/compiler/rustc_transmute/src/layout/tree.rs -@@ -404,7 +404,7 @@ fn from_repr_c_variant( - .unwrap(); - trace!(?discr_layout, "computed discriminant layout"); - variant_layout = variant_layout.extend(discr_layout).unwrap().0; -- tree = tree.then(Self::from_disr(discr, tcx, layout_summary.discriminant_size)); -+ tree = tree.then(Self::from_discr(discr, tcx, layout_summary.discriminant_size)); - } - - // Next come fields. -@@ -444,11 +444,21 @@ fn from_repr_c_variant( - Ok(tree) - } - -- pub fn from_disr(discr: Discr<'tcx>, tcx: TyCtxt<'tcx>, size: usize) -> Self { -- // FIXME(@jswrenn): I'm certain this is missing needed endian nuance. -- let bytes = discr.val.to_ne_bytes(); -- let bytes = &bytes[..size]; -- Self::Seq(bytes.into_iter().copied().map(|b| Self::from_bits(b)).collect()) -+ pub fn from_discr(discr: Discr<'tcx>, tcx: TyCtxt<'tcx>, size: usize) -> Self { -+ use rustc_target::abi::Endian; -+ -+ let bytes: [u8; 16]; -+ let bytes = match tcx.data_layout.endian { -+ Endian::Little => { -+ bytes = discr.val.to_le_bytes(); -+ &bytes[..size] -+ } -+ Endian::Big => { -+ bytes = discr.val.to_be_bytes(); -+ &bytes[bytes.len() - size..] -+ } -+ }; -+ Self::Seq(bytes.iter().map(|&b| Self::from_bits(b)).collect()) - } - } - --- -2.37.3 - diff --git a/rust.spec b/rust.spec index 1a1492d..d4dbb1c 100644 --- a/rust.spec +++ b/rust.spec @@ -8,9 +8,9 @@ # To bootstrap from scratch, set the channel and date from src/stage0.json # e.g. 1.59.0 wants rustc: 1.58.0-2022-01-13 # or nightly wants some beta-YYYY-MM-DD -%global bootstrap_version 1.64.0 -%global bootstrap_channel 1.64.0 -%global bootstrap_date 2022-09-22 +%global bootstrap_version 1.65.0 +%global bootstrap_channel 1.65.0 +%global bootstrap_date 2022-11-03 # Only the specified arches will use bootstrap binaries. # NOTE: Those binaries used to be uploaded with every new release, but that was @@ -35,7 +35,7 @@ # src/ci/docker/host-x86_64/dist-various-2/build-wasi-toolchain.sh # (updated per https://github.com/rust-lang/rust/pull/96907) %global wasi_libc_url https://github.com/WebAssembly/wasi-libc -%global wasi_libc_ref wasi-sdk-16 +%global wasi_libc_ref wasi-sdk-17 %global wasi_libc_name wasi-libc-%{wasi_libc_ref} %global wasi_libc_source %{wasi_libc_url}/archive/%{wasi_libc_ref}/%{wasi_libc_name}.tar.gz %global wasi_libc_dir %{_builddir}/%{wasi_libc_name} @@ -46,7 +46,7 @@ # We can also choose to just use Rust's bundled LLVM, in case the system LLVM # is insufficient. Rust currently requires LLVM 12.0+. %global min_llvm_version 13.0.0 -%global bundled_llvm_version 15.0.0 +%global bundled_llvm_version 15.0.2 %bcond_with bundled_llvm # Requires stable libgit2 1.5, and not the next minor soname change. @@ -83,7 +83,7 @@ %endif Name: rust -Version: 1.65.0 +Version: 1.66.0 Release: 1%{?dist} Summary: The Rust Programming Language License: (ASL 2.0 or MIT) and (BSD and MIT) @@ -106,11 +106,14 @@ Patch1: 0001-Use-lld-provided-by-system-for-wasm.patch # Set a substitute-path in rust-gdb for standard library sources. Patch2: rustc-1.61.0-rust-gdb-substitute-path.patch -# https://github.com/rust-lang/rust/pull/102076 -Patch3: 0001-rustc_transmute-fix-big-endian-discriminants.patch - # https://github.com/rust-lang/rust/pull/103072 -Patch4: 0001-compiletest-set-the-dylib-path-when-gathering-target.patch +Patch3: 0001-compiletest-set-the-dylib-path-when-gathering-target.patch + +# https://github.com/rust-lang/rust/pull/104001 +Patch4: 0001-Improve-generating-Custom-entry-function.patch + +# https://github.com/rust-lang/rust/pull/105468 +Patch5: 0001-Mangle-main-as-__main_void-on-wasm32-wasi.patch ### RHEL-specific patches below ### @@ -528,7 +531,7 @@ BuildArch: noarch %if 0%{?rhel} && 0%{?rhel} < 8 Requires: %{name}-std-static = %{version}-%{release} %else -Supplements: %{name}-std-static = %{version}-%{release} +Recommends: %{name}-std-static = %{version}-%{release} %endif %description src @@ -541,7 +544,7 @@ Summary: Compiler analysis data for the Rust standard library %if 0%{?rhel} && 0%{?rhel} < 8 Requires: %{name}-std-static%{?_isa} = %{version}-%{release} %else -Supplements: %{name}-std-static%{?_isa} = %{version}-%{release} +Recommends: %{name}-std-static%{?_isa} = %{version}-%{release} %endif %description analysis @@ -588,6 +591,7 @@ test -f '%{local_rust_root}/bin/rustc' %patch2 -p1 %patch3 -p1 %patch4 -p1 +%patch5 -p1 %if %with disabled_libssh2 %patch100 -p1 @@ -1052,6 +1056,9 @@ end} %changelog +* Thu Dec 15 2022 Josh Stone - 1.66.0-1 +- Update to 1.66.0. + * Thu Nov 03 2022 Josh Stone - 1.65.0-1 - Update to 1.65.0. - rust-analyzer now obsoletes rls. diff --git a/sources b/sources index ae1d088..608b89d 100644 --- a/sources +++ b/sources @@ -1,2 +1,2 @@ -SHA512 (rustc-1.65.0-src.tar.xz) = 3d0369ed3028209c4ecb9b9e7b5f5e3a20be8cc05199675df4f091d62a96c0734bc1dbd7630928fe162792392ec6d0daf9ceed10771531ce022200c7b631e3be -SHA512 (wasi-libc-wasi-sdk-16.tar.gz) = 4d3d12e233b2b3321e5287c0851a950d744208e05ed2c6d995dd2e7ff51452c7cfe62451589ed6d3ac58065f8cc87fc5c74a1853ed798e108662d1b0d3ad8a0e +SHA512 (rustc-1.66.0-src.tar.xz) = df329bcabce309846e44d92a118758dfc65b63f06857226799c75568a2a018a96500fd07cd38c1927e3486d190a6f57340ee794c733bbbb69cf80a99855ced73 +SHA512 (wasi-libc-wasi-sdk-17.tar.gz) = 5870f86d4a8431edefaef41163d1fa7eddeabcfa6bc5794c7bf18b4fd320b6ea43c261a7e41966d0da1490a2d96b9742c82cbcca7c56bb404830722664cab376