From 866f6d2d99df26380dd23bbda56a06fe6a8f73cd Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Tue, 10 May 2022 03:07:04 -0400 Subject: [PATCH] import rust-1.58.1-1.module+el8.6.0+14021+586eff1a --- .gitignore | 3 +- .rust.metadata | 3 +- SOURCES/0001-Revert-Auto-merge-of-79547.patch | 102 --- SOURCES/rustc-1.51.0-no-default-pie.patch | 19 - ...tc-1.54.0-unicode-control-codepoints.patch | 737 ------------------ ...tch => rustc-1.56.0-disable-libssh2.patch} | 16 +- ...patch => rustc-1.58.0-disable-http2.patch} | 34 +- SOURCES/rustc-1.58.0-no-default-pie.patch | 44 ++ SPECS/rust.spec | 363 ++++++--- 9 files changed, 334 insertions(+), 987 deletions(-) delete mode 100644 SOURCES/0001-Revert-Auto-merge-of-79547.patch delete mode 100644 SOURCES/rustc-1.51.0-no-default-pie.patch delete mode 100644 SOURCES/rustc-1.54.0-unicode-control-codepoints.patch rename SOURCES/{rustc-1.48.0-disable-libssh2.patch => rustc-1.56.0-disable-libssh2.patch} (66%) rename SOURCES/{rustc-1.53.0-disable-http2.patch => rustc-1.58.0-disable-http2.patch} (66%) create mode 100644 SOURCES/rustc-1.58.0-no-default-pie.patch diff --git a/.gitignore b/.gitignore index 8bd8e61..96cc5a3 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ -SOURCES/rustc-1.54.0-src.tar.xz +SOURCES/rustc-1.58.1-src.tar.xz +SOURCES/wasi-libc-ad5133410f66b93a2381db5b542aad5e0964db96.tar.gz diff --git a/.rust.metadata b/.rust.metadata index b0db6af..9adc181 100644 --- a/.rust.metadata +++ b/.rust.metadata @@ -1 +1,2 @@ -1577242bee41fe6c1aee17d47ae791f4bfc1f8c3 SOURCES/rustc-1.54.0-src.tar.xz +783cb359829e7ea508deae659837f9bb360e46c8 SOURCES/rustc-1.58.1-src.tar.xz +b8865d1192852214d6d9b0a0957d4b36c16832aa SOURCES/wasi-libc-ad5133410f66b93a2381db5b542aad5e0964db96.tar.gz diff --git a/SOURCES/0001-Revert-Auto-merge-of-79547.patch b/SOURCES/0001-Revert-Auto-merge-of-79547.patch deleted file mode 100644 index b2e58a1..0000000 --- a/SOURCES/0001-Revert-Auto-merge-of-79547.patch +++ /dev/null @@ -1,102 +0,0 @@ -From eaf7ea1fc339e1ff348ed941ed2e8c4d66f3e458 Mon Sep 17 00:00:00 2001 -From: Josh Stone -Date: Thu, 18 Feb 2021 19:14:58 -0800 -Subject: [PATCH] Revert "Auto merge of #79547 - erikdesjardins:byval, - r=nagisa" - -This reverts commit a094ff9590b83c8f94d898f92c2964a5803ded06, reversing -changes made to d37afad0cc87bf709ad10c85319296ac53030f03. ---- - compiler/rustc_middle/src/ty/layout.rs | 12 ++++++------ - ...return-value-in-reg.rs => return-value-in-reg.rs} | 4 ++-- - src/test/codegen/union-abi.rs | 11 +++-------- - 3 files changed, 11 insertions(+), 16 deletions(-) - rename src/test/codegen/{arg-return-value-in-reg.rs => return-value-in-reg.rs} (74%) - -diff --git a/compiler/rustc_middle/src/ty/layout.rs b/compiler/rustc_middle/src/ty/layout.rs -index b545b92c9252..545f6aee1a21 100644 ---- a/compiler/rustc_middle/src/ty/layout.rs -+++ b/compiler/rustc_middle/src/ty/layout.rs -@@ -2849,7 +2849,7 @@ fn adjust_for_abi(&mut self, cx: &C, abi: SpecAbi) { - || abi == SpecAbi::RustIntrinsic - || abi == SpecAbi::PlatformIntrinsic - { -- let fixup = |arg: &mut ArgAbi<'tcx, Ty<'tcx>>| { -+ let fixup = |arg: &mut ArgAbi<'tcx, Ty<'tcx>>, is_ret: bool| { - if arg.is_ignore() { - return; - } -@@ -2887,9 +2887,9 @@ fn adjust_for_abi(&mut self, cx: &C, abi: SpecAbi) { - _ => return, - } - -- // Pass and return structures up to 2 pointers in size by value, matching `ScalarPair`. -- // LLVM will usually pass these in 2 registers, which is more efficient than by-ref. -- let max_by_val_size = Pointer.size(cx) * 2; -+ // Return structures up to 2 pointers in size by value, matching `ScalarPair`. LLVM -+ // will usually return these in 2 registers, which is more efficient than by-ref. -+ let max_by_val_size = if is_ret { Pointer.size(cx) * 2 } else { Pointer.size(cx) }; - let size = arg.layout.size; - - if arg.layout.is_unsized() || size > max_by_val_size { -@@ -2901,9 +2901,9 @@ fn adjust_for_abi(&mut self, cx: &C, abi: SpecAbi) { - arg.cast_to(Reg { kind: RegKind::Integer, size }); - } - }; -- fixup(&mut self.ret); -+ fixup(&mut self.ret, true); - for arg in &mut self.args { -- fixup(arg); -+ fixup(arg, false); - } - return; - } -diff --git a/src/test/codegen/arg-return-value-in-reg.rs b/src/test/codegen/return-value-in-reg.rs -similarity index 74% -rename from src/test/codegen/arg-return-value-in-reg.rs -rename to src/test/codegen/return-value-in-reg.rs -index a69291d47821..4bc0136c5e32 100644 ---- a/src/test/codegen/arg-return-value-in-reg.rs -+++ b/src/test/codegen/return-value-in-reg.rs -@@ -1,4 +1,4 @@ --//! Check that types of up to 128 bits are passed and returned by-value instead of via pointer. -+//! This test checks that types of up to 128 bits are returned by-value instead of via out-pointer. - - // compile-flags: -C no-prepopulate-passes -O - // only-x86_64 -@@ -11,7 +11,7 @@ pub struct S { - c: u32, - } - --// CHECK: define i128 @modify(i128{{( %0)?}}) -+// CHECK: define i128 @modify(%S* noalias nocapture dereferenceable(16) %s) - #[no_mangle] - pub fn modify(s: S) -> S { - S { a: s.a + s.a, b: s.b + s.b, c: s.c + s.c } -diff --git a/src/test/codegen/union-abi.rs b/src/test/codegen/union-abi.rs -index f282fd237054..afea01e9a2d0 100644 ---- a/src/test/codegen/union-abi.rs -+++ b/src/test/codegen/union-abi.rs -@@ -63,16 +63,11 @@ pub union UnionU128{a:u128} - #[no_mangle] - pub fn test_UnionU128(_: UnionU128) -> UnionU128 { loop {} } - --pub union UnionU128x2{a:(u128, u128)} --// CHECK: define void @test_UnionU128x2(i128 %_1.0, i128 %_1.1) --#[no_mangle] --pub fn test_UnionU128x2(_: UnionU128x2) { loop {} } -- - #[repr(C)] --pub union CUnionU128x2{a:(u128, u128)} --// CHECK: define void @test_CUnionU128x2(%CUnionU128x2* {{.*}} %_1) -+pub union CUnionU128{a:u128} -+// CHECK: define void @test_CUnionU128(%CUnionU128* {{.*}} %_1) - #[no_mangle] --pub fn test_CUnionU128x2(_: CUnionU128x2) { loop {} } -+pub fn test_CUnionU128(_: CUnionU128) { loop {} } - - pub union UnionBool { b:bool } - // CHECK: define zeroext i1 @test_UnionBool(i8 %b) --- -2.29.2 - diff --git a/SOURCES/rustc-1.51.0-no-default-pie.patch b/SOURCES/rustc-1.51.0-no-default-pie.patch deleted file mode 100644 index d24cc75..0000000 --- a/SOURCES/rustc-1.51.0-no-default-pie.patch +++ /dev/null @@ -1,19 +0,0 @@ ---- rustc-beta-src/compiler/rustc_codegen_ssa/src/back/link.rs.orig 2021-03-09 10:40:09.755485845 -0800 -+++ rustc-beta-src/compiler/rustc_codegen_ssa/src/back/link.rs 2021-03-09 10:44:51.257426181 -0800 -@@ -1279,11 +1279,13 @@ - } - - fn link_output_kind(sess: &Session, crate_type: CrateType) -> LinkOutputKind { -- let kind = match (crate_type, sess.crt_static(Some(crate_type)), sess.relocation_model()) { -+ // Only use PIE if explicity specified. -+ let explicit_pic = matches!(sess.opts.cg.relocation_model, Some(RelocModel::Pic)); -+ let kind = match (crate_type, sess.crt_static(Some(crate_type)), explicit_pic) { - (CrateType::Executable, _, _) if sess.is_wasi_reactor() => LinkOutputKind::WasiReactorExe, -- (CrateType::Executable, false, RelocModel::Pic) => LinkOutputKind::DynamicPicExe, -+ (CrateType::Executable, false, true) => LinkOutputKind::DynamicPicExe, - (CrateType::Executable, false, _) => LinkOutputKind::DynamicNoPicExe, -- (CrateType::Executable, true, RelocModel::Pic) => LinkOutputKind::StaticPicExe, -+ (CrateType::Executable, true, true) => LinkOutputKind::StaticPicExe, - (CrateType::Executable, true, _) => LinkOutputKind::StaticNoPicExe, - (_, true, _) => LinkOutputKind::StaticDylib, - (_, false, _) => LinkOutputKind::DynamicDylib, diff --git a/SOURCES/rustc-1.54.0-unicode-control-codepoints.patch b/SOURCES/rustc-1.54.0-unicode-control-codepoints.patch deleted file mode 100644 index 2389928..0000000 --- a/SOURCES/rustc-1.54.0-unicode-control-codepoints.patch +++ /dev/null @@ -1,737 +0,0 @@ -From 7eaba1c3599f414294e5451e472456eed533475b Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Esteban=20K=C3=BCber?= -Date: Thu, 19 Aug 2021 11:40:00 -0700 -Subject: [PATCH] Lint against RTL unicode codepoints in literals and comments - -Address CVE-2021-42574. - -Backported-by: Josh Stone ---- - Cargo.lock | 1 + - compiler/rustc_errors/src/emitter.rs | 20 +- - compiler/rustc_lint/src/context.rs | 39 +++- - .../src/hidden_unicode_codepoints.rs | 161 +++++++++++++++ - compiler/rustc_lint/src/lib.rs | 3 + - compiler/rustc_lint_defs/src/builtin.rs | 28 +++ - compiler/rustc_lint_defs/src/lib.rs | 1 + - compiler/rustc_parse/Cargo.toml | 1 + - compiler/rustc_parse/src/lexer/mod.rs | 40 +++- - .../src/lexer/unescape_error_reporting.rs | 16 +- - .../ui/parser/unicode-control-codepoints.rs | 39 ++++ - .../parser/unicode-control-codepoints.stderr | 184 ++++++++++++++++++ - 12 files changed, 525 insertions(+), 8 deletions(-) - create mode 100644 compiler/rustc_lint/src/hidden_unicode_codepoints.rs - create mode 100644 src/test/ui/parser/unicode-control-codepoints.rs - create mode 100644 src/test/ui/parser/unicode-control-codepoints.stderr - -diff --git a/Cargo.lock b/Cargo.lock -index de110c55a4b2..140026dc6ae1 100644 ---- a/Cargo.lock -+++ b/Cargo.lock -@@ -4170,6 +4170,7 @@ dependencies = [ - "smallvec", - "tracing", - "unicode-normalization", -+ "unicode-width", - ] - - [[package]] -diff --git a/compiler/rustc_errors/src/emitter.rs b/compiler/rustc_errors/src/emitter.rs -index d3f92bf3047b..db7bbe58c80c 100644 ---- a/compiler/rustc_errors/src/emitter.rs -+++ b/compiler/rustc_errors/src/emitter.rs -@@ -1977,8 +1977,26 @@ fn num_decimal_digits(num: usize) -> usize { - MAX_DIGITS - } - -+// We replace some characters so the CLI output is always consistent and underlines aligned. -+const OUTPUT_REPLACEMENTS: &[(char, &str)] = &[ -+ ('\t', " "), // We do our own tab replacement -+ ('\u{202A}', ""), // The following unicode text flow control characters are inconsistently -+ ('\u{202B}', ""), // supported accross CLIs and can cause confusion due to the bytes on disk -+ ('\u{202D}', ""), // not corresponding to the visible source code, so we replace them always. -+ ('\u{202E}', ""), -+ ('\u{2066}', ""), -+ ('\u{2067}', ""), -+ ('\u{2068}', ""), -+ ('\u{202C}', ""), -+ ('\u{2069}', ""), -+]; -+ - fn replace_tabs(str: &str) -> String { -- str.replace('\t', " ") -+ let mut s = str.to_string(); -+ for (c, replacement) in OUTPUT_REPLACEMENTS { -+ s = s.replace(*c, replacement); -+ } -+ s - } - - fn draw_col_separator(buffer: &mut StyledBuffer, line: usize, col: usize) { -diff --git a/compiler/rustc_lint/src/context.rs b/compiler/rustc_lint/src/context.rs -index a8df1b0952c1..0a2b55dbbada 100644 ---- a/compiler/rustc_lint/src/context.rs -+++ b/compiler/rustc_lint/src/context.rs -@@ -16,6 +16,7 @@ - - use self::TargetLint::*; - -+use crate::hidden_unicode_codepoints::UNICODE_TEXT_FLOW_CHARS; - use crate::levels::LintLevelsBuilder; - use crate::passes::{EarlyLintPassObject, LateLintPassObject}; - use rustc_ast as ast; -@@ -40,7 +41,7 @@ - use rustc_session::Session; - use rustc_session::SessionLintStore; - use rustc_span::lev_distance::find_best_match_for_name; --use rustc_span::{symbol::Symbol, MultiSpan, Span, DUMMY_SP}; -+use rustc_span::{symbol::Symbol, BytePos, MultiSpan, Span, DUMMY_SP}; - use rustc_target::abi::LayoutOf; - use tracing::debug; - -@@ -601,6 +602,42 @@ fn lookup_with_diagnostics( - // Now, set up surrounding context. - let sess = self.sess(); - match diagnostic { -+ BuiltinLintDiagnostics::UnicodeTextFlow(span, content) => { -+ let spans: Vec<_> = content -+ .char_indices() -+ .filter_map(|(i, c)| { -+ UNICODE_TEXT_FLOW_CHARS.contains(&c).then(|| { -+ let lo = span.lo() + BytePos(2 + i as u32); -+ (c, span.with_lo(lo).with_hi(lo + BytePos(c.len_utf8() as u32))) -+ }) -+ }) -+ .collect(); -+ let (an, s) = match spans.len() { -+ 1 => ("an ", ""), -+ _ => ("", "s"), -+ }; -+ db.span_label(span, &format!( -+ "this comment contains {}invisible unicode text flow control codepoint{}", -+ an, -+ s, -+ )); -+ for (c, span) in &spans { -+ db.span_label(*span, format!("{:?}", c)); -+ } -+ db.note( -+ "these kind of unicode codepoints change the way text flows on \ -+ applications that support them, but can cause confusion because they \ -+ change the order of characters on the screen", -+ ); -+ if !spans.is_empty() { -+ db.multipart_suggestion_with_style( -+ "if their presence wasn't intentional, you can remove them", -+ spans.into_iter().map(|(_, span)| (span, "".to_string())).collect(), -+ Applicability::MachineApplicable, -+ SuggestionStyle::HideCodeAlways, -+ ); -+ } -+ }, - BuiltinLintDiagnostics::Normal => (), - BuiltinLintDiagnostics::BareTraitObject(span, is_global) => { - let (sugg, app) = match sess.source_map().span_to_snippet(span) { -diff --git a/compiler/rustc_lint/src/hidden_unicode_codepoints.rs b/compiler/rustc_lint/src/hidden_unicode_codepoints.rs -new file mode 100644 -index 000000000000..1bcdcb806fc4 ---- /dev/null -+++ b/compiler/rustc_lint/src/hidden_unicode_codepoints.rs -@@ -0,0 +1,161 @@ -+use crate::{EarlyContext, EarlyLintPass, LintContext}; -+use rustc_ast as ast; -+use rustc_errors::{Applicability, SuggestionStyle}; -+use rustc_span::{BytePos, Span, Symbol}; -+ -+declare_lint! { -+ /// The `text_direction_codepoint_in_literal` lint detects Unicode codepoints that change the -+ /// visual representation of text on screen in a way that does not correspond to their on -+ /// memory representation. -+ /// -+ /// ### Explanation -+ /// -+ /// The unicode characters `\u{202A}`, `\u{202B}`, `\u{202D}`, `\u{202E}`, `\u{2066}`, -+ /// `\u{2067}`, `\u{2068}`, `\u{202C}` and `\u{2069}` make the flow of text on screen change -+ /// its direction on software that supports these codepoints. This makes the text "abc" display -+ /// as "cba" on screen. By leveraging software that supports these, people can write specially -+ /// crafted literals that make the surrounding code seem like it's performing one action, when -+ /// in reality it is performing another. Because of this, we proactively lint against their -+ /// presence to avoid surprises. -+ /// -+ /// ### Example -+ /// -+ /// ```rust,compile_fail -+ /// #![deny(text_direction_codepoint_in_literal)] -+ /// fn main() { -+ /// println!("{:?}", '‮'); -+ /// } -+ /// ``` -+ /// -+ /// {{produces}} -+ /// -+ pub TEXT_DIRECTION_CODEPOINT_IN_LITERAL, -+ Deny, -+ "detect special Unicode codepoints that affect the visual representation of text on screen, \ -+ changing the direction in which text flows", -+} -+ -+declare_lint_pass!(HiddenUnicodeCodepoints => [TEXT_DIRECTION_CODEPOINT_IN_LITERAL]); -+ -+crate const UNICODE_TEXT_FLOW_CHARS: &[char] = &[ -+ '\u{202A}', '\u{202B}', '\u{202D}', '\u{202E}', '\u{2066}', '\u{2067}', '\u{2068}', '\u{202C}', -+ '\u{2069}', -+]; -+ -+impl HiddenUnicodeCodepoints { -+ fn lint_text_direction_codepoint( -+ &self, -+ cx: &EarlyContext<'_>, -+ text: Symbol, -+ span: Span, -+ padding: u32, -+ point_at_inner_spans: bool, -+ label: &str, -+ ) { -+ // Obtain the `Span`s for each of the forbidden chars. -+ let spans: Vec<_> = text -+ .as_str() -+ .char_indices() -+ .filter_map(|(i, c)| { -+ UNICODE_TEXT_FLOW_CHARS.contains(&c).then(|| { -+ let lo = span.lo() + BytePos(i as u32 + padding); -+ (c, span.with_lo(lo).with_hi(lo + BytePos(c.len_utf8() as u32))) -+ }) -+ }) -+ .collect(); -+ -+ cx.struct_span_lint(TEXT_DIRECTION_CODEPOINT_IN_LITERAL, span, |lint| { -+ let mut err = lint.build(&format!( -+ "unicode codepoint changing visible direction of text present in {}", -+ label -+ )); -+ let (an, s) = match spans.len() { -+ 1 => ("an ", ""), -+ _ => ("", "s"), -+ }; -+ err.span_label( -+ span, -+ &format!( -+ "this {} contains {}invisible unicode text flow control codepoint{}", -+ label, an, s, -+ ), -+ ); -+ if point_at_inner_spans { -+ for (c, span) in &spans { -+ err.span_label(*span, format!("{:?}", c)); -+ } -+ } -+ err.note( -+ "these kind of unicode codepoints change the way text flows on applications that \ -+ support them, but can cause confusion because they change the order of \ -+ characters on the screen", -+ ); -+ if point_at_inner_spans && !spans.is_empty() { -+ err.multipart_suggestion_with_style( -+ "if their presence wasn't intentional, you can remove them", -+ spans.iter().map(|(_, span)| (*span, "".to_string())).collect(), -+ Applicability::MachineApplicable, -+ SuggestionStyle::HideCodeAlways, -+ ); -+ err.multipart_suggestion( -+ "if you want to keep them but make them visible in your source code, you can \ -+ escape them", -+ spans -+ .into_iter() -+ .map(|(c, span)| { -+ let c = format!("{:?}", c); -+ (span, c[1..c.len() - 1].to_string()) -+ }) -+ .collect(), -+ Applicability::MachineApplicable, -+ ); -+ } else { -+ // FIXME: in other suggestions we've reversed the inner spans of doc comments. We -+ // should do the same here to provide the same good suggestions as we do for -+ // literals above. -+ err.note("if their presence wasn't intentional, you can remove them"); -+ err.note(&format!( -+ "if you want to keep them but make them visible in your source code, you can \ -+ escape them: {}", -+ spans -+ .into_iter() -+ .map(|(c, _)| { format!("{:?}", c) }) -+ .collect::>() -+ .join(", "), -+ )); -+ } -+ err.emit(); -+ }); -+ } -+} -+impl EarlyLintPass for HiddenUnicodeCodepoints { -+ fn check_attribute(&mut self, cx: &EarlyContext<'_>, attr: &ast::Attribute) { -+ if let ast::AttrKind::DocComment(_, comment) = attr.kind { -+ if comment.as_str().contains(UNICODE_TEXT_FLOW_CHARS) { -+ self.lint_text_direction_codepoint(cx, comment, attr.span, 0, false, "doc comment"); -+ } -+ } -+ } -+ -+ fn check_expr(&mut self, cx: &EarlyContext<'_>, expr: &ast::Expr) { -+ // byte strings are already handled well enough by `EscapeError::NonAsciiCharInByteString` -+ let (text, span, padding) = match &expr.kind { -+ ast::ExprKind::Lit(ast::Lit { token, kind, span }) => { -+ let text = token.symbol; -+ if !text.as_str().contains(UNICODE_TEXT_FLOW_CHARS) { -+ return; -+ } -+ let padding = match kind { -+ // account for `"` or `'` -+ ast::LitKind::Str(_, ast::StrStyle::Cooked) | ast::LitKind::Char(_) => 1, -+ // account for `r###"` -+ ast::LitKind::Str(_, ast::StrStyle::Raw(val)) => *val as u32 + 2, -+ _ => return, -+ }; -+ (text, span, padding) -+ } -+ _ => return, -+ }; -+ self.lint_text_direction_codepoint(cx, text, *span, padding, true, "literal"); -+ } -+} -diff --git a/compiler/rustc_lint/src/lib.rs b/compiler/rustc_lint/src/lib.rs -index 4f59460aa82a..89612eb72b48 100644 ---- a/compiler/rustc_lint/src/lib.rs -+++ b/compiler/rustc_lint/src/lib.rs -@@ -48,6 +48,7 @@ - pub mod builtin; - mod context; - mod early; -+pub mod hidden_unicode_codepoints; - mod internal; - mod late; - mod levels; -@@ -75,6 +76,7 @@ - - use array_into_iter::ArrayIntoIter; - use builtin::*; -+use hidden_unicode_codepoints::*; - use internal::*; - use methods::*; - use non_ascii_idents::*; -@@ -126,6 +128,7 @@ macro_rules! early_lint_passes { - DeprecatedAttr: DeprecatedAttr::new(), - WhileTrue: WhileTrue, - NonAsciiIdents: NonAsciiIdents, -+ HiddenUnicodeCodepoints: HiddenUnicodeCodepoints, - IncompleteFeatures: IncompleteFeatures, - RedundantSemicolons: RedundantSemicolons, - UnusedDocComment: UnusedDocComment, -diff --git a/compiler/rustc_lint_defs/src/builtin.rs b/compiler/rustc_lint_defs/src/builtin.rs -index 352146d64635..cd4d5c6e5f1c 100644 ---- a/compiler/rustc_lint_defs/src/builtin.rs -+++ b/compiler/rustc_lint_defs/src/builtin.rs -@@ -3240,3 +3240,31 @@ - Allow, - "detects usage of old versions of or-patterns", - } -+ -+declare_lint! { -+ /// The `text_direction_codepoint_in_comment` lint detects Unicode codepoints in comments that -+ /// change the visual representation of text on screen in a way that does not correspond to -+ /// their on memory representation. -+ /// -+ /// ### Example -+ /// -+ /// ```rust,compile_fail -+ /// #![deny(text_direction_codepoint_in_comment)] -+ /// fn main() { -+ /// println!("{:?}"); // '‮'); -+ /// } -+ /// ``` -+ /// -+ /// {{produces}} -+ /// -+ /// ### Explanation -+ /// -+ /// Unicode allows changing the visual flow of text on screen in order to support scripts that -+ /// are written right-to-left, but a specially crafted comment can make code that will be -+ /// compiled appear to be part of a comment, depending on the software used to read the code. -+ /// To avoid potential problems or confusion, such as in CVE-2021-42574, by default we deny -+ /// their use. -+ pub TEXT_DIRECTION_CODEPOINT_IN_COMMENT, -+ Deny, -+ "invisible directionality-changing codepoints in comment" -+} -diff --git a/compiler/rustc_lint_defs/src/lib.rs b/compiler/rustc_lint_defs/src/lib.rs -index f1c4e5fb4a36..1ec50fe5fbb5 100644 ---- a/compiler/rustc_lint_defs/src/lib.rs -+++ b/compiler/rustc_lint_defs/src/lib.rs -@@ -272,6 +272,7 @@ pub enum BuiltinLintDiagnostics { - ExternDepSpec(String, ExternDepSpec), - ProcMacroBackCompat(String), - OrPatternsBackCompat(Span, String), -+ UnicodeTextFlow(Span, String), - } - - /// Lints that are buffered up early on in the `Session` before the -diff --git a/compiler/rustc_parse/Cargo.toml b/compiler/rustc_parse/Cargo.toml -index c887729c3557..96a215628dfb 100644 ---- a/compiler/rustc_parse/Cargo.toml -+++ b/compiler/rustc_parse/Cargo.toml -@@ -19,4 +19,5 @@ rustc_session = { path = "../rustc_session" } - rustc_span = { path = "../rustc_span" } - rustc_ast = { path = "../rustc_ast" } - unicode-normalization = "0.1.11" -+unicode-width = "0.1.4" - smallvec = { version = "1.6.1", features = ["union", "may_dangle"] } -diff --git a/compiler/rustc_parse/src/lexer/mod.rs b/compiler/rustc_parse/src/lexer/mod.rs -index 1c2f9a9645fe..97a9a5aee42a 100644 ---- a/compiler/rustc_parse/src/lexer/mod.rs -+++ b/compiler/rustc_parse/src/lexer/mod.rs -@@ -1,9 +1,11 @@ --use rustc_ast::ast::AttrStyle; -+use rustc_ast::ast::{self, AttrStyle}; - use rustc_ast::token::{self, CommentKind, Token, TokenKind}; - use rustc_ast::tokenstream::{Spacing, TokenStream}; - use rustc_errors::{error_code, Applicability, DiagnosticBuilder, FatalError, PResult}; - use rustc_lexer::unescape::{self, Mode}; - use rustc_lexer::{Base, DocStyle, RawStrError}; -+use rustc_session::lint::builtin::TEXT_DIRECTION_CODEPOINT_IN_COMMENT; -+use rustc_session::lint::BuiltinLintDiagnostics; - use rustc_session::parse::ParseSess; - use rustc_span::symbol::{sym, Symbol}; - use rustc_span::{BytePos, Pos, Span}; -@@ -127,6 +129,28 @@ fn struct_fatal_span_char( - .struct_span_fatal(self.mk_sp(from_pos, to_pos), &format!("{}: {}", m, escaped_char(c))) - } - -+ /// Detect usages of Unicode codepoints changing the direction of the text on screen and loudly -+ /// complain about it. -+ fn lint_unicode_text_flow(&self, start: BytePos) { -+ // Opening delimiter of the length 2 is not included into the comment text. -+ let content_start = start + BytePos(2); -+ let content = self.str_from(content_start); -+ let span = self.mk_sp(start, self.pos); -+ const UNICODE_TEXT_FLOW_CHARS: &[char] = &[ -+ '\u{202A}', '\u{202B}', '\u{202D}', '\u{202E}', '\u{2066}', '\u{2067}', '\u{2068}', -+ '\u{202C}', '\u{2069}', -+ ]; -+ if content.contains(UNICODE_TEXT_FLOW_CHARS) { -+ self.sess.buffer_lint_with_diagnostic( -+ &TEXT_DIRECTION_CODEPOINT_IN_COMMENT, -+ span, -+ ast::CRATE_NODE_ID, -+ "unicode codepoint changing visible direction of text present in comment", -+ BuiltinLintDiagnostics::UnicodeTextFlow(span, content.to_string()), -+ ); -+ } -+ } -+ - /// Turns simple `rustc_lexer::TokenKind` enum into a rich - /// `rustc_ast::TokenKind`. This turns strings into interned - /// symbols and runs additional validation. -@@ -134,7 +158,12 @@ fn cook_lexer_token(&self, token: rustc_lexer::TokenKind, start: BytePos) -> Opt - Some(match token { - rustc_lexer::TokenKind::LineComment { doc_style } => { - // Skip non-doc comments -- let doc_style = doc_style?; -+ let doc_style = if let Some(doc_style) = doc_style { -+ doc_style -+ } else { -+ self.lint_unicode_text_flow(start); -+ return None; -+ }; - - // Opening delimiter of the length 3 is not included into the symbol. - let content_start = start + BytePos(3); -@@ -156,7 +185,12 @@ fn cook_lexer_token(&self, token: rustc_lexer::TokenKind, start: BytePos) -> Opt - } - - // Skip non-doc comments -- let doc_style = doc_style?; -+ let doc_style = if let Some(doc_style) = doc_style { -+ doc_style -+ } else { -+ self.lint_unicode_text_flow(start); -+ return None; -+ }; - - // Opening delimiter of the length 3 and closing delimiter of the length 2 - // are not included into the symbol. -diff --git a/compiler/rustc_parse/src/lexer/unescape_error_reporting.rs b/compiler/rustc_parse/src/lexer/unescape_error_reporting.rs -index a580f0c55d0e..1e673e03d67f 100644 ---- a/compiler/rustc_parse/src/lexer/unescape_error_reporting.rs -+++ b/compiler/rustc_parse/src/lexer/unescape_error_reporting.rs -@@ -153,9 +153,14 @@ pub(crate) fn emit_unescape_error( - EscapeError::NonAsciiCharInByte => { - assert!(mode.is_bytes()); - let (c, span) = last_char(); -+ let postfix = if unicode_width::UnicodeWidthChar::width(c).unwrap_or(1) == 0 { -+ format!(" but is {:?}", c) -+ } else { -+ String::new() -+ }; - handler - .struct_span_err(span, "non-ASCII character in byte constant") -- .span_label(span, "byte constant must be ASCII") -+ .span_label(span, &format!("byte constant must be ASCII{}", postfix)) - .span_suggestion( - span, - "use a \\xHH escape for a non-ASCII byte", -@@ -166,10 +171,15 @@ pub(crate) fn emit_unescape_error( - } - EscapeError::NonAsciiCharInByteString => { - assert!(mode.is_bytes()); -- let (_c, span) = last_char(); -+ let (c, span) = last_char(); -+ let postfix = if unicode_width::UnicodeWidthChar::width(c).unwrap_or(1) == 0 { -+ format!(" but is {:?}", c) -+ } else { -+ String::new() -+ }; - handler - .struct_span_err(span, "raw byte string must be ASCII") -- .span_label(span, "must be ASCII") -+ .span_label(span, &format!("must be ASCII{}", postfix)) - .emit(); - } - EscapeError::OutOfRangeHexEscape => { -diff --git a/src/test/ui/parser/unicode-control-codepoints.rs b/src/test/ui/parser/unicode-control-codepoints.rs -new file mode 100644 -index 000000000000..5af0b585a127 ---- /dev/null -+++ b/src/test/ui/parser/unicode-control-codepoints.rs -@@ -0,0 +1,39 @@ -+fn main() { -+ // if access_level != "us‫e‪r" { // Check if admin -+ //~^ ERROR unicode codepoint changing visible direction of text present in comment -+ println!("us\u{202B}e\u{202A}r"); -+ println!("{:?}", r#"us\u{202B}e\u{202A}r"#); -+ println!("{:?}", b"us\u{202B}e\u{202A}r"); -+ //~^ ERROR unicode escape in byte string -+ //~| ERROR unicode escape in byte string -+ println!("{:?}", br##"us\u{202B}e\u{202A}r"##); -+ -+ println!("{:?}", "/*‮ } ⁦if isAdmin⁩ ⁦ begin admins only "); -+ //~^ ERROR unicode codepoint changing visible direction of text present in literal -+ -+ println!("{:?}", r##"/*‮ } ⁦if isAdmin⁩ ⁦ begin admins only "##); -+ //~^ ERROR unicode codepoint changing visible direction of text present in literal -+ println!("{:?}", b"/*‮ } ⁦if isAdmin⁩ ⁦ begin admins only "); -+ //~^ ERROR non-ASCII character in byte constant -+ //~| ERROR non-ASCII character in byte constant -+ //~| ERROR non-ASCII character in byte constant -+ //~| ERROR non-ASCII character in byte constant -+ println!("{:?}", br##"/*‮ } ⁦if isAdmin⁩ ⁦ begin admins only "##); -+ //~^ ERROR raw byte string must be ASCII -+ //~| ERROR raw byte string must be ASCII -+ //~| ERROR raw byte string must be ASCII -+ //~| ERROR raw byte string must be ASCII -+ println!("{:?}", '‮'); -+ //~^ ERROR unicode codepoint changing visible direction of text present in literal -+} -+ -+//"/*‮ } ⁦if isAdmin⁩ ⁦ begin admins only */" -+//~^ ERROR unicode codepoint changing visible direction of text present in comment -+ -+/** '‮'); */fn foo() {} -+//~^ ERROR unicode codepoint changing visible direction of text present in doc comment -+ -+/** -+ * -+ * '‮'); */fn bar() {} -+//~^^^ ERROR unicode codepoint changing visible direction of text present in doc comment -diff --git a/src/test/ui/parser/unicode-control-codepoints.stderr b/src/test/ui/parser/unicode-control-codepoints.stderr -new file mode 100644 -index 000000000000..650cc74feed0 ---- /dev/null -+++ b/src/test/ui/parser/unicode-control-codepoints.stderr -@@ -0,0 +1,184 @@ -+error: unicode escape in byte string -+ --> $DIR/unicode-control-codepoints.rs:6:26 -+ | -+LL | println!("{:?}", b"us\u{202B}e\u{202A}r"); -+ | ^^^^^^^^ unicode escape in byte string -+ | -+ = help: unicode escape sequences cannot be used as a byte or in a byte string -+ -+error: unicode escape in byte string -+ --> $DIR/unicode-control-codepoints.rs:6:35 -+ | -+LL | println!("{:?}", b"us\u{202B}e\u{202A}r"); -+ | ^^^^^^^^ unicode escape in byte string -+ | -+ = help: unicode escape sequences cannot be used as a byte or in a byte string -+ -+error: non-ASCII character in byte constant -+ --> $DIR/unicode-control-codepoints.rs:16:26 -+ | -+LL | println!("{:?}", b"/* } if isAdmin begin admins only "); -+ | ^ -+ | | -+ | byte constant must be ASCII but is '\u{202e}' -+ | help: use a \xHH escape for a non-ASCII byte: `\x202E` -+ -+error: non-ASCII character in byte constant -+ --> $DIR/unicode-control-codepoints.rs:16:30 -+ | -+LL | println!("{:?}", b"/* } if isAdmin begin admins only "); -+ | ^ -+ | | -+ | byte constant must be ASCII but is '\u{2066}' -+ | help: use a \xHH escape for a non-ASCII byte: `\x2066` -+ -+error: non-ASCII character in byte constant -+ --> $DIR/unicode-control-codepoints.rs:16:41 -+ | -+LL | println!("{:?}", b"/* } if isAdmin begin admins only "); -+ | ^ -+ | | -+ | byte constant must be ASCII but is '\u{2069}' -+ | help: use a \xHH escape for a non-ASCII byte: `\x2069` -+ -+error: non-ASCII character in byte constant -+ --> $DIR/unicode-control-codepoints.rs:16:43 -+ | -+LL | println!("{:?}", b"/* } if isAdmin begin admins only "); -+ | ^ -+ | | -+ | byte constant must be ASCII but is '\u{2066}' -+ | help: use a \xHH escape for a non-ASCII byte: `\x2066` -+ -+error: raw byte string must be ASCII -+ --> $DIR/unicode-control-codepoints.rs:21:29 -+ | -+LL | println!("{:?}", br##"/* } if isAdmin begin admins only "##); -+ | ^ must be ASCII but is '\u{202e}' -+ -+error: raw byte string must be ASCII -+ --> $DIR/unicode-control-codepoints.rs:21:33 -+ | -+LL | println!("{:?}", br##"/* } if isAdmin begin admins only "##); -+ | ^ must be ASCII but is '\u{2066}' -+ -+error: raw byte string must be ASCII -+ --> $DIR/unicode-control-codepoints.rs:21:44 -+ | -+LL | println!("{:?}", br##"/* } if isAdmin begin admins only "##); -+ | ^ must be ASCII but is '\u{2069}' -+ -+error: raw byte string must be ASCII -+ --> $DIR/unicode-control-codepoints.rs:21:46 -+ | -+LL | println!("{:?}", br##"/* } if isAdmin begin admins only "##); -+ | ^ must be ASCII but is '\u{2066}' -+ -+error: unicode codepoint changing visible direction of text present in comment -+ --> $DIR/unicode-control-codepoints.rs:2:5 -+ | -+LL | // if access_level != "user" { // Check if admin -+ | ^^^^^^^^^^^^^^^^^^^^^^^^^--^^^^^^^^^^^^^^^^^^^^^ -+ | | || -+ | | |'\u{202a}' -+ | | '\u{202b}' -+ | this comment contains invisible unicode text flow control codepoints -+ | -+ = note: `#[deny(text_direction_codepoint_in_comment)]` on by default -+ = note: these kind of unicode codepoints change the way text flows on applications that support them, but can cause confusion because they change the order of characters on the screen -+ = help: if their presence wasn't intentional, you can remove them -+ -+error: unicode codepoint changing visible direction of text present in comment -+ --> $DIR/unicode-control-codepoints.rs:30:1 -+ | -+LL | //"/* } if isAdmin begin admins only */" -+ | ^^^^^-^^-^^^^^^^^^--^^^^^^^^^^^^^^^^^^^^^ -+ | | | | || -+ | | | | |'\u{2066}' -+ | | | | '\u{2069}' -+ | | | '\u{2066}' -+ | | '\u{202e}' -+ | this comment contains invisible unicode text flow control codepoints -+ | -+ = note: these kind of unicode codepoints change the way text flows on applications that support them, but can cause confusion because they change the order of characters on the screen -+ = help: if their presence wasn't intentional, you can remove them -+ -+error: unicode codepoint changing visible direction of text present in literal -+ --> $DIR/unicode-control-codepoints.rs:11:22 -+ | -+LL | println!("{:?}", "/* } if isAdmin begin admins only "); -+ | ^^^-^^-^^^^^^^^^--^^^^^^^^^^^^^^^^^^^ -+ | | | | || -+ | | | | |'\u{2066}' -+ | | | | '\u{2069}' -+ | | | '\u{2066}' -+ | | '\u{202e}' -+ | this literal contains invisible unicode text flow control codepoints -+ | -+ = note: `#[deny(text_direction_codepoint_in_literal)]` on by default -+ = note: these kind of unicode codepoints change the way text flows on applications that support them, but can cause confusion because they change the order of characters on the screen -+ = help: if their presence wasn't intentional, you can remove them -+help: if you want to keep them but make them visible in your source code, you can escape them -+ | -+LL | println!("{:?}", "/*\u{202e} } \u{2066}if isAdmin\u{2069} \u{2066} begin admins only "); -+ | ^^^^^^^^ ^^^^^^^^ ^^^^^^^^ ^^^^^^^^ -+ -+error: unicode codepoint changing visible direction of text present in literal -+ --> $DIR/unicode-control-codepoints.rs:14:22 -+ | -+LL | println!("{:?}", r##"/* } if isAdmin begin admins only "##); -+ | ^^^^^^-^^-^^^^^^^^^--^^^^^^^^^^^^^^^^^^^^^ -+ | | | | || -+ | | | | |'\u{2066}' -+ | | | | '\u{2069}' -+ | | | '\u{2066}' -+ | | '\u{202e}' -+ | this literal contains invisible unicode text flow control codepoints -+ | -+ = note: these kind of unicode codepoints change the way text flows on applications that support them, but can cause confusion because they change the order of characters on the screen -+ = help: if their presence wasn't intentional, you can remove them -+help: if you want to keep them but make them visible in your source code, you can escape them -+ | -+LL | println!("{:?}", r##"/*\u{202e} } \u{2066}if isAdmin\u{2069} \u{2066} begin admins only "##); -+ | ^^^^^^^^ ^^^^^^^^ ^^^^^^^^ ^^^^^^^^ -+ -+error: unicode codepoint changing visible direction of text present in literal -+ --> $DIR/unicode-control-codepoints.rs:26:22 -+ | -+LL | println!("{:?}", ''); -+ | ^- -+ | || -+ | |'\u{202e}' -+ | this literal contains an invisible unicode text flow control codepoint -+ | -+ = note: these kind of unicode codepoints change the way text flows on applications that support them, but can cause confusion because they change the order of characters on the screen -+ = help: if their presence wasn't intentional, you can remove them -+help: if you want to keep them but make them visible in your source code, you can escape them -+ | -+LL | println!("{:?}", '\u{202e}'); -+ | ^^^^^^^^ -+ -+error: unicode codepoint changing visible direction of text present in doc comment -+ --> $DIR/unicode-control-codepoints.rs:33:1 -+ | -+LL | /** ''); */fn foo() {} -+ | ^^^^^^^^^^^^ this doc comment contains an invisible unicode text flow control codepoint -+ | -+ = note: these kind of unicode codepoints change the way text flows on applications that support them, but can cause confusion because they change the order of characters on the screen -+ = note: if their presence wasn't intentional, you can remove them -+ = note: if you want to keep them but make them visible in your source code, you can escape them: '\u{202e}' -+ -+error: unicode codepoint changing visible direction of text present in doc comment -+ --> $DIR/unicode-control-codepoints.rs:36:1 -+ | -+LL | / /** -+LL | | * -+LL | | * ''); */fn bar() {} -+ | |___________^ this doc comment contains an invisible unicode text flow control codepoint -+ | -+ = note: these kind of unicode codepoints change the way text flows on applications that support them, but can cause confusion because they change the order of characters on the screen -+ = note: if their presence wasn't intentional, you can remove them -+ = note: if you want to keep them but make them visible in your source code, you can escape them: '\u{202e}' -+ -+error: aborting due to 17 previous errors -+ --- -2.31.1 - diff --git a/SOURCES/rustc-1.48.0-disable-libssh2.patch b/SOURCES/rustc-1.56.0-disable-libssh2.patch similarity index 66% rename from SOURCES/rustc-1.48.0-disable-libssh2.patch rename to SOURCES/rustc-1.56.0-disable-libssh2.patch index 6916e74..4d9331b 100644 --- a/SOURCES/rustc-1.48.0-disable-libssh2.patch +++ b/SOURCES/rustc-1.56.0-disable-libssh2.patch @@ -1,6 +1,6 @@ ---- rustc-1.48.0-src/Cargo.lock.orig 2020-11-16 06:01:53.000000000 -0800 -+++ rustc-1.48.0-src/Cargo.lock 2020-11-16 09:27:44.425104404 -0800 -@@ -1676,7 +1676,6 @@ +--- rustc-1.56.0-src/Cargo.lock.orig 2021-10-18 02:52:36.000000000 -0700 ++++ rustc-1.56.0-src/Cargo.lock 2021-10-19 18:00:47.999793566 -0700 +@@ -1895,7 +1895,6 @@ dependencies = [ "cc", "libc", @@ -8,7 +8,7 @@ "libz-sys", "openssl-sys", "pkg-config", -@@ -1693,20 +1692,6 @@ +@@ -1918,20 +1917,6 @@ ] [[package]] @@ -27,11 +27,11 @@ - -[[package]] name = "libz-sys" - version = "1.1.2" + version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" ---- rustc-1.48.0-src/vendor/git2/Cargo.toml.orig 2020-11-16 06:27:49.000000000 -0800 -+++ rustc-1.48.0-src/vendor/git2/Cargo.toml 2020-11-16 09:27:44.425104404 -0800 -@@ -49,7 +49,7 @@ +--- rustc-1.56.0-src/vendor/git2/Cargo.toml.orig 2021-10-18 04:05:54.000000000 -0700 ++++ rustc-1.56.0-src/vendor/git2/Cargo.toml 2021-10-19 17:57:37.960500359 -0700 +@@ -52,7 +52,7 @@ version = "0.1.39" [features] diff --git a/SOURCES/rustc-1.53.0-disable-http2.patch b/SOURCES/rustc-1.58.0-disable-http2.patch similarity index 66% rename from SOURCES/rustc-1.53.0-disable-http2.patch rename to SOURCES/rustc-1.58.0-disable-http2.patch index 94040b3..215e0c7 100644 --- a/SOURCES/rustc-1.53.0-disable-http2.patch +++ b/SOURCES/rustc-1.58.0-disable-http2.patch @@ -1,6 +1,6 @@ ---- rustc-beta-src/Cargo.lock.orig 2021-06-04 15:56:04.141227630 -0700 -+++ rustc-beta-src/Cargo.lock 2021-06-04 16:03:04.461396826 -0700 -@@ -885,7 +885,6 @@ +--- rustc-1.58.0-src/Cargo.lock.orig 2022-01-11 16:13:10.125323813 -0800 ++++ rustc-1.58.0-src/Cargo.lock 2022-01-11 16:22:54.313011908 -0800 +@@ -909,7 +909,6 @@ dependencies = [ "cc", "libc", @@ -8,7 +8,7 @@ "libz-sys", "openssl-sys", "pkg-config", -@@ -1904,16 +1903,6 @@ +@@ -1927,16 +1926,6 @@ checksum = "7fc7aa29613bd6a620df431842069224d8bc9011086b1db4c0e0cd47fa03ec9a" [[package]] @@ -23,22 +23,22 @@ - -[[package]] name = "libz-sys" - version = "1.1.2" + version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" ---- rustc-beta-src/src/tools/cargo/Cargo.toml.orig 2021-06-04 15:56:04.143227587 -0700 -+++ rustc-beta-src/src/tools/cargo/Cargo.toml 2021-06-04 15:57:56.931857927 -0700 -@@ -25,7 +25,7 @@ - cargo-util = { path = "crates/cargo-util", version = "0.1.0" } +--- rustc-1.58.0-src/src/tools/cargo/Cargo.toml.orig 2022-01-11 16:13:10.127323771 -0800 ++++ rustc-1.58.0-src/src/tools/cargo/Cargo.toml 2022-01-11 16:14:50.721203730 -0800 +@@ -22,7 +22,7 @@ + cargo-util = { path = "crates/cargo-util", version = "0.1.1" } crates-io = { path = "crates/crates-io", version = "0.33.0" } crossbeam-utils = "0.8" --curl = { version = "0.4.23", features = ["http2"] } -+curl = { version = "0.4.23", features = [] } - curl-sys = "0.4.22" - env_logger = "0.8.1" +-curl = { version = "0.4.41", features = ["http2"] } ++curl = { version = "0.4.41", features = [] } + curl-sys = "0.4.50" + env_logger = "0.9.0" pretty_env_logger = { version = "0.4", optional = true } ---- rustc-beta-src/src/tools/cargo/src/cargo/core/package.rs.orig 2021-05-22 15:22:31.000000000 -0700 -+++ rustc-beta-src/src/tools/cargo/src/cargo/core/package.rs 2021-06-04 16:00:03.903190293 -0700 -@@ -416,14 +416,8 @@ +--- rustc-1.58.0-src/src/tools/cargo/src/cargo/core/package.rs.orig 2022-01-11 03:18:44.000000000 -0800 ++++ rustc-1.58.0-src/src/tools/cargo/src/cargo/core/package.rs 2022-01-11 16:13:10.127323771 -0800 +@@ -419,14 +419,8 @@ // Also note that pipelining is disabled as curl authors have indicated // that it's buggy, and we've empirically seen that it's buggy with HTTP // proxies. @@ -55,7 +55,7 @@ Ok(PackageSet { packages: package_ids -@@ -596,7 +590,7 @@ +@@ -655,7 +649,7 @@ macro_rules! try_old_curl { ($e:expr, $msg:expr) => { let result = $e; diff --git a/SOURCES/rustc-1.58.0-no-default-pie.patch b/SOURCES/rustc-1.58.0-no-default-pie.patch new file mode 100644 index 0000000..67fb0c6 --- /dev/null +++ b/SOURCES/rustc-1.58.0-no-default-pie.patch @@ -0,0 +1,44 @@ +diff --git a/compiler/rustc_codegen_ssa/src/back/link.rs b/compiler/rustc_codegen_ssa/src/back/link.rs +index 638b2a7b5a9f..79d4ecf4cb91 100644 +--- a/compiler/rustc_codegen_ssa/src/back/link.rs ++++ b/compiler/rustc_codegen_ssa/src/back/link.rs +@@ -763,7 +763,7 @@ fn link_natively<'a, B: ArchiveBuilder<'a>>( + && cmd.get_args().iter().any(|e| e.to_string_lossy() == "-no-pie") + { + info!("linker output: {:?}", out); +- warn!("Linker does not support -no-pie command line option. Retrying without."); ++ info!("Linker does not support -no-pie command line option. Retrying without."); + for arg in cmd.take_args() { + if arg.to_string_lossy() != "-no-pie" { + cmd.arg(arg); +@@ -782,7 +782,7 @@ fn link_natively<'a, B: ArchiveBuilder<'a>>( + && cmd.get_args().iter().any(|e| e.to_string_lossy() == "-static-pie") + { + info!("linker output: {:?}", out); +- warn!( ++ info!( + "Linker does not support -static-pie command line option. Retrying with -static instead." + ); + // Mirror `add_(pre,post)_link_objects` to replace CRT objects. +@@ -1507,15 +1507,14 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + } + + fn link_output_kind(sess: &Session, crate_type: CrateType) -> LinkOutputKind { +- let kind = match (crate_type, sess.crt_static(Some(crate_type)), sess.relocation_model()) { ++ // Only use PIE if explicitly specified. ++ let explicit_pic = ++ matches!(sess.opts.cg.relocation_model, Some(RelocModel::Pic | RelocModel::Pie)); ++ let kind = match (crate_type, sess.crt_static(Some(crate_type)), explicit_pic) { + (CrateType::Executable, _, _) if sess.is_wasi_reactor() => LinkOutputKind::WasiReactorExe, +- (CrateType::Executable, false, RelocModel::Pic | RelocModel::Pie) => { +- LinkOutputKind::DynamicPicExe +- } ++ (CrateType::Executable, false, true) => LinkOutputKind::DynamicPicExe, + (CrateType::Executable, false, _) => LinkOutputKind::DynamicNoPicExe, +- (CrateType::Executable, true, RelocModel::Pic | RelocModel::Pie) => { +- LinkOutputKind::StaticPicExe +- } ++ (CrateType::Executable, true, true) => LinkOutputKind::StaticPicExe, + (CrateType::Executable, true, _) => LinkOutputKind::StaticNoPicExe, + (_, true, _) => LinkOutputKind::StaticDylib, + (_, false, _) => LinkOutputKind::DynamicDylib, diff --git a/SPECS/rust.spec b/SPECS/rust.spec index 13a29ae..5b3d412 100644 --- a/SPECS/rust.spec +++ b/SPECS/rust.spec @@ -1,19 +1,18 @@ # Only x86_64 and i686 are Tier 1 platforms at this time. # https://doc.rust-lang.org/nightly/rustc/platform-support.html -#global rust_arches x86_64 i686 armv7hl aarch64 ppc64 ppc64le s390x %global rust_arches x86_64 i686 aarch64 ppc64le s390x # The channel can be stable, beta, or nightly %{!?channel: %global channel stable} -# To bootstrap from scratch, set the channel and date from src/stage0.txt +# To bootstrap from scratch, set the channel and date from src/stage0.json # e.g. 1.10.0 wants rustc: 1.9.0-2016-05-24 # or nightly wants some beta-YYYY-MM-DD # Note that cargo matches the program version here, not its crate version. -%global bootstrap_rust 1.53.0 -%global bootstrap_cargo 1.53.0 -%global bootstrap_channel 1.53.0 -%global bootstrap_date 2021-06-17 +%global bootstrap_rust 1.57.0 +%global bootstrap_cargo 1.57.0 +%global bootstrap_channel 1.57.0 +%global bootstrap_date 2021-12-02 # Only the specified arches will use bootstrap binaries. #global bootstrap_arches %%{rust_arches} @@ -26,25 +25,42 @@ # on certain arches, namely s390x for its lack of lld. So we need to make it an # arch-specific package only for the supported arches. %ifnarch s390x +%if 0%{?fedora} +%global mingw_targets i686-pc-windows-gnu x86_64-pc-windows-gnu +%endif %if 0%{?fedora} || 0%{?rhel} >= 8 -%global cross_targets wasm32-unknown-unknown +%global wasm_targets wasm32-unknown-unknown wasm32-wasi %endif %endif +# We need CRT files for *-wasi targets, at least as new as the commit in +# src/ci/docker/host-x86_64/dist-various-2/build-wasi-toolchain.sh +%global wasi_libc_url https://github.com/WebAssembly/wasi-libc +%global wasi_libc_commit ad5133410f66b93a2381db5b542aad5e0964db96 +%global wasi_libc_name wasi-libc-%{wasi_libc_commit} +%global wasi_libc_source %{wasi_libc_url}/archive/%{wasi_libc_commit}/%{wasi_libc_name}.tar.gz +%global wasi_libc_dir %{_builddir}/%{wasi_libc_name} + # Using llvm-static may be helpful as an opt-in, e.g. to aid LLVM rebases. %bcond_with llvm_static # We can also choose to just use Rust's bundled LLVM, in case the system LLVM -# is insufficient. Rust currently requires LLVM 10.0+. +# is insufficient. Rust currently requires LLVM 12.0+. +%global min_llvm_version 12.0.0 +%global bundled_llvm_version 13.0.0 %bcond_with bundled_llvm -# Requires stable libgit2 1.1 -%if 0%{?fedora} >= 34 +# Requires stable libgit2 1.3 +%global min_libgit2_version 1.3.0 +%global bundled_libgit2_version 1.3.0 +%if 0%{?fedora} >= 36 %bcond_with bundled_libgit2 %else %bcond_without bundled_libgit2 %endif +# needs libssh2_userauth_publickey_frommemory +%global min_libssh2_version 1.6.0 %if 0%{?rhel} # Disable cargo->libgit2->libssh2 on RHEL, as it's not approved for FIPS (rhbz1732949) %bcond_without disabled_libssh2 @@ -66,8 +82,8 @@ %endif Name: rust -Version: 1.54.0 -Release: 3%{?dist} +Version: 1.58.1 +Release: 1%{?dist} Summary: The Rust Programming Language License: (ASL 2.0 or MIT) and (BSD and MIT) # ^ written as: (rust itself) and (bundled libraries) @@ -80,29 +96,24 @@ ExclusiveArch: %{rust_arches} %global rustc_package rustc-%{channel}-src %endif Source0: https://static.rust-lang.org/dist/%{rustc_package}.tar.xz - -# This internal rust-abi change broke s390x -- revert for now. -# https://github.com/rust-lang/rust/issues/80810#issuecomment-781784032 -Patch1: 0001-Revert-Auto-merge-of-79547.patch +Source1: %{wasi_libc_source} +# Sources for bootstrap_arches are inserted by lua below # By default, rust tries to use "rust-lld" as a linker for WebAssembly. -Patch2: 0001-Use-lld-provided-by-system-for-wasm.patch - -# Lint against RTL unicode codepoints in literals and comments -Patch3: rustc-1.54.0-unicode-control-codepoints.patch +Patch1: 0001-Use-lld-provided-by-system-for-wasm.patch ### RHEL-specific patches below ### # Disable cargo->libgit2->libssh2 on RHEL, as it's not approved for FIPS (rhbz1732949) -Patch100: rustc-1.48.0-disable-libssh2.patch +Patch100: rustc-1.56.0-disable-libssh2.patch # libcurl on RHEL7 doesn't have http2, but since cargo requests it, curl-sys # will try to build it statically -- instead we turn off the feature. -Patch101: rustc-1.53.0-disable-http2.patch +Patch101: rustc-1.58.0-disable-http2.patch # kernel rh1410097 causes too-small stacks for PIE. # (affects RHEL6 kernels when building for RHEL7) -Patch102: rustc-1.51.0-no-default-pie.patch +Patch102: rustc-1.58.0-no-default-pie.patch # Get the Rust triple for any arch. @@ -135,6 +146,7 @@ end} .."/rust-%{bootstrap_channel}") local target_arch = rpm.expand("%{_target_cpu}") for i, arch in ipairs(bootstrap_arches) do + i = 100 + i print(string.format("Source%d: %s-%s.tar.xz\n", i, base, rust_triple(arch))) if arch == target_arch then @@ -163,7 +175,6 @@ BuildRequires: make BuildRequires: gcc BuildRequires: gcc-c++ BuildRequires: ncurses-devel -BuildRequires: curl # explicit curl-devel to avoid httpd24-curl (rhbz1540167) BuildRequires: curl-devel BuildRequires: pkgconfig(libcurl) @@ -171,25 +182,29 @@ BuildRequires: pkgconfig(liblzma) BuildRequires: pkgconfig(openssl) BuildRequires: pkgconfig(zlib) -%if %without bundled_libgit2 -BuildRequires: pkgconfig(libgit2) >= 1.1.0 +%if %{without bundled_libgit2} +BuildRequires: pkgconfig(libgit2) >= %{min_libgit2_version} %endif %if %{without disabled_libssh2} -# needs libssh2_userauth_publickey_frommemory -BuildRequires: pkgconfig(libssh2) >= 1.6.0 +BuildRequires: pkgconfig(libssh2) >= %{min_libssh2_version} %endif -%global python python3 -BuildRequires: %{python} +%if 0%{?rhel} == 8 +BuildRequires: platform-python +%else +BuildRequires: python3 +%endif +BuildRequires: python3-rpm-macros %if %with bundled_llvm BuildRequires: cmake3 >= 3.13.4 -Provides: bundled(llvm) = 12.0.0 +BuildRequires: ninja-build +Provides: bundled(llvm) = %{bundled_llvm_version} %else BuildRequires: cmake >= 2.8.11 %if 0%{?epel} == 7 -%global llvm llvm11 +%global llvm llvm13 %endif %if %defined llvm %global llvm_root %{_libdir}/%{llvm} @@ -197,14 +212,14 @@ BuildRequires: cmake >= 2.8.11 %global llvm llvm %global llvm_root %{_prefix} %endif -BuildRequires: %{llvm}-devel >= 10.0 +BuildRequires: %{llvm}-devel >= %{min_llvm_version} %if %with llvm_static BuildRequires: %{llvm}-static BuildRequires: libffi-devel %endif %endif -# make check needs "ps" for src/test/run-pass/wait-forked-but-failed-child.rs +# make check needs "ps" for src/test/ui/wait-forked-but-failed-child.rs BuildRequires: procps-ng # debuginfo-gdb tests need gdb @@ -224,10 +239,17 @@ Requires: /usr/bin/cc %if 0%{?epel} == 7 %global devtoolset_name devtoolset-9 +BuildRequires: %{devtoolset_name}-binutils BuildRequires: %{devtoolset_name}-gcc BuildRequires: %{devtoolset_name}-gcc-c++ -%global __cc /opt/rh/%{devtoolset_name}/root/usr/bin/gcc -%global __cxx /opt/rh/%{devtoolset_name}/root/usr/bin/g++ +%global devtoolset_bindir /opt/rh/%{devtoolset_name}/root/usr/bin +%global __cc %{devtoolset_bindir}/gcc +%global __cxx %{devtoolset_bindir}/g++ +%global __ar %{devtoolset_bindir}/ar +%global __ranlib %{devtoolset_bindir}/ranlib +%global __strip %{devtoolset_bindir}/strip +%else +%global __ranlib %{_bindir}/ranlib %endif # ALL Rust libraries are private, because they don't keep an ABI. @@ -249,9 +271,6 @@ BuildRequires: %{devtoolset_name}-gcc-c++ %global _find_debuginfo_opts --keep-section .rustc %endif -# Use hardening ldflags. -%global rustflags -Clink-arg=-Wl,-z,relro,-z,now - %if %{without bundled_llvm} %if "%{llvm_root}" == "%{_prefix}" || 0%{?scl:1} %global llvm_has_filecheck 1 @@ -263,11 +282,19 @@ BuildRequires: %{devtoolset_name}-gcc-c++ %global common_libdir %{_prefix}/lib %global rustlibdir %{common_libdir}/rustlib -%if %defined cross_targets +%if %defined mingw_targets +BuildRequires: mingw32-filesystem >= 95 +BuildRequires: mingw64-filesystem >= 95 +BuildRequires: mingw32-gcc +BuildRequires: mingw64-gcc +%endif + +%if %defined wasm_targets +BuildRequires: clang # brp-strip-static-archive breaks the archive index for wasm %global __os_install_post \ %__os_install_post \ -find %{buildroot}%{rustlibdir} -type f -path '*/wasm*/lib/*.rlib' -exec llvm-ranlib '{}' ';' \ +find '%{buildroot}%{rustlibdir}' -type f -path '*/wasm*/lib/*.rlib' -print -exec '%{llvm_root}/bin/llvm-ranlib' '{}' ';' \ %{nil} %endif @@ -280,32 +307,69 @@ This package includes the Rust compiler and documentation generator. %package std-static Summary: Standard library for Rust +Requires: %{name} = %{version}-%{release} +Requires: glibc-devel%{?_isa} >= 2.11 %description std-static This package includes the standard libraries for building applications written in Rust. -%if %defined cross_targets +%if %defined mingw_targets %{lua: do - for triple in string.gmatch(rpm.expand("%{cross_targets}"), "%S+") do - local requires = rpm.expand("Requires: rust = %{version}-%{release}") - if string.sub(triple, 1, 4) == "wasm" then - requires = requires .. "\nRequires: lld >= 8.0" - end + for triple in string.gmatch(rpm.expand("%{mingw_targets}"), "%S+") do local subs = { triple = triple, - requires = requires, + name = rpm.expand("%{name}"), + verrel = rpm.expand("%{version}-%{release}"), + mingw = string.sub(triple, 1, 4) == "i686" and "mingw32" or "mingw64", } local s = string.gsub([[ + %package std-static-{{triple}} -Summary: Standard library for Rust -# FIX: we can't be noarch while excluding s390x for lack of lld -# BuildArch: noarch -{{requires}} +Summary: Standard library for Rust {{triple}} +BuildArch: noarch +Provides: {{mingw}}-rust = {{verrel}} +Provides: {{mingw}}-rustc = {{verrel}} +Requires: {{mingw}}-crt +Requires: {{mingw}}-gcc +Requires: {{mingw}}-winpthreads-static +Requires: {{name}} = {{verrel}} %description std-static-{{triple}} This package includes the standard libraries for building applications -written in Rust for the {{triple}} target. +written in Rust for the MinGW target {{triple}}. + +]], "{{(%w+)}}", subs) + print(s) + end +end} +%endif + +%if %defined wasm_targets +%{lua: do + for triple in string.gmatch(rpm.expand("%{wasm_targets}"), "%S+") do + local subs = { + triple = triple, + name = rpm.expand("%{name}"), + verrel = rpm.expand("%{version}-%{release}"), + wasi = string.find(triple, "-wasi") and 1 or 0, + } + local s = string.gsub([[ + +%package std-static-{{triple}} +Summary: Standard library for Rust {{triple}} +# FIX: we can't be noarch while excluding s390x for lack of lld +# BuildArch: noarch +Requires: {{name}} = {{verrel}} +Requires: lld >= 8.0 +%if {{wasi}} +Provides: bundled(wasi-libc) +%endif + +%description std-static-{{triple}} +This package includes the standard libraries for building applications +written in Rust for the WebAssembly target {{triple}}. + ]], "{{(%w+)}}", subs) print(s) end @@ -338,7 +402,7 @@ programs. Summary: LLDB pretty printers for Rust BuildArch: noarch Requires: lldb -Requires: %{python}-lldb +Requires: python3-lldb Requires: %{name}-debugger-common = %{version}-%{release} %description lldb @@ -363,12 +427,12 @@ its standard library. %package -n cargo Summary: Rust's package manager and build tool %if %with bundled_libgit2 -Provides: bundled(libgit2) = 1.1.0 +Provides: bundled(libgit2) = %{bundled_libgit2_version} %endif # For tests: -BuildRequires: git +BuildRequires: git-core # Cargo is not much use without Rust -Requires: rust +Requires: %{name} # "cargo vendor" is a builtin command starting with 1.37. The Obsoletes and # Provides are mostly relevant to RHEL, but harmless to have on Fedora/etc. too @@ -385,7 +449,7 @@ Summary: Documentation for Cargo BuildArch: noarch # Cargo no longer builds its own documentation # https://github.com/rust-lang/cargo/pull/4904 -Requires: rust-doc = %{version}-%{release} +Requires: %{name}-doc = %{version}-%{release} %description -n cargo-doc This package includes HTML documentation for Cargo. @@ -406,9 +470,9 @@ A tool for formatting Rust code according to style guidelines. %package -n rls Summary: Rust Language Server for IDE integration %if %with bundled_libgit2 -Provides: bundled(libgit2) = 1.1.0 +Provides: bundled(libgit2) = %{bundled_libgit2_version} %endif -Requires: rust-analysis +Requires: %{name}-analysis # /usr/bin/rls is dynamically linked against internal rustc libs Requires: %{name}%{?_isa} = %{version}-%{release} @@ -448,7 +512,7 @@ useful as a reference for code completion tools in various editors. %package analysis Summary: Compiler analysis data for the Rust standard library -Requires: rust-std-static%{?_isa} = %{version}-%{release} +Requires: %{name}-std-static%{?_isa} = %{version}-%{release} %description analysis This package contains analysis data files produced with rustc's -Zsave-analysis @@ -466,11 +530,13 @@ test -f '%{local_rust_root}/bin/cargo' test -f '%{local_rust_root}/bin/rustc' %endif +%if %defined wasm_targets +%setup -q -n %{wasi_libc_name} -T -b 1 +%endif + %setup -q -n %{rustc_package} %patch1 -p1 -%patch2 -p1 -%patch3 -p1 %if %with disabled_libssh2 %patch100 -p1 @@ -485,10 +551,8 @@ rm -rf vendor/libnghttp2-sys/ %patch102 -p1 %endif -%if "%{python}" != "python3" -# Use our preferred python first -sed -i.try-python -e '/^try python3 /i try "%{python}" "$@"' ./configure -%endif +# Use our explicit python3 first +sed -i.try-python -e '/^try python3 /i try "%{__python3}" "$@"' ./configure %if %without bundled_llvm rm -rf src/llvm-project/ @@ -539,22 +603,19 @@ find vendor -name .cargo-checksum.json \ find -name '*.rs' -type f -perm /111 -exec chmod -v -x '{}' '+' # Set up shared environment variables for build/install/check -%global rust_env RUSTFLAGS="%{rustflags}" +%global rust_env %{?rustflags:RUSTFLAGS="%{rustflags}"} %if 0%{?cmake_path:1} -%global rust_env %{rust_env} PATH="%{cmake_path}:$PATH" -%endif -%if %without bundled_libgit2 -# convince libgit2-sys to use the distro libgit2 -%global rust_env %{rust_env} LIBGIT2_SYS_USE_PKG_CONFIG=1 +%global rust_env %{?rust_env} PATH="%{cmake_path}:$PATH" %endif %if %without disabled_libssh2 # convince libssh2-sys to use the distro libssh2 -%global rust_env %{rust_env} LIBSSH2_SYS_USE_PKG_CONFIG=1 +%global rust_env %{?rust_env} LIBSSH2_SYS_USE_PKG_CONFIG=1 %endif +%global export_rust_env %{?rust_env:export %{rust_env}} %build -export %{rust_env} +%{export_rust_env} %ifarch %{arm} %{ix86} s390x # full debuginfo is exhausting memory; just do libstd for now @@ -578,13 +639,55 @@ if [ "$max_cpus" -ge 1 -a "$max_cpus" -lt "$ncpus" ]; then ncpus="$max_cpus" fi +%define target_config %{shrink: + --set target.%{rust_triple}.linker=%{__cc} + --set target.%{rust_triple}.cc=%{__cc} + --set target.%{rust_triple}.cxx=%{__cxx} + --set target.%{rust_triple}.ar=%{__ar} + --set target.%{rust_triple}.ranlib=%{__ranlib} +} + +%if %defined mingw_targets +%{lua: do + local cfg = "" + for triple in string.gmatch(rpm.expand("%{mingw_targets}"), "%S+") do + local subs = { + triple = triple, + mingw = string.sub(triple, 1, 4) == "i686" and "mingw32" or "mingw64", + } + local s = string.gsub([[%{shrink: + --set target.{{triple}}.linker=%{{{mingw}}_cc} + --set target.{{triple}}.cc=%{{{mingw}}_cc} + --set target.{{triple}}.ar=%{{{mingw}}_ar} + --set target.{{triple}}.ranlib=%{{{mingw}}_ranlib} + }]], "{{(%w+)}}", subs) + cfg = cfg .. " " .. s + end + rpm.define("mingw_target_config " .. cfg) +end} +%endif + +%if %defined wasm_targets +%make_build --quiet -C %{wasi_libc_dir} +%{lua: do + local wasi_root = rpm.expand("%{wasi_libc_dir}") .. "/sysroot" + local cfg = "" + for triple in string.gmatch(rpm.expand("%{wasm_targets}"), "%S+") do + if string.find(triple, "-wasi") then + cfg = cfg .. " --set target." .. triple .. ".wasi-root=" .. wasi_root + end + end + rpm.define("wasm_target_config "..cfg) +end} +%endif + %configure --disable-option-checking \ --libdir=%{common_libdir} \ --build=%{rust_triple} --host=%{rust_triple} --target=%{rust_triple} \ - --set target.%{rust_triple}.linker=%{__cc} \ - --set target.%{rust_triple}.cc=%{__cc} \ - --set target.%{rust_triple}.cxx=%{__cxx} \ - --python=%{python} \ + %{target_config} \ + %{?mingw_target_config} \ + %{?wasm_target_config} \ + --python=%{__python3} \ --local-rust-root=%{local_rust_root} \ %{!?with_bundled_llvm: --llvm-root=%{llvm_root} \ %{!?llvm_has_filecheck: --disable-codegen-tests} \ @@ -596,29 +699,25 @@ fi --tools=analysis,cargo,clippy,rls,rustfmt,src \ --enable-vendor \ --enable-verbose-tests \ - %{?codegen_units_std} \ + --dist-compression-formats=gz \ --release-channel=%{channel} \ --release-description="%{?fedora:Fedora }%{?rhel:Red Hat }%{version}-%{release}" -%{python} ./x.py build -j "$ncpus" --stage 2 -%{python} ./x.py doc --stage 2 +%{__python3} ./x.py build -j "$ncpus" --stage 2 +%{__python3} ./x.py doc --stage 2 -%if %defined cross_targets -for triple in %{cross_targets}; do - %{python} ./x.py build --stage 2 --target=$triple std +for triple in %{?mingw_targets} %{?wasm_targets}; do + %{__python3} ./x.py build --stage 2 --target=$triple std done -%endif %install -export %{rust_env} +%{export_rust_env} -DESTDIR=%{buildroot} %{python} ./x.py install +DESTDIR=%{buildroot} %{__python3} ./x.py install -%if %defined cross_targets -for triple in %{cross_targets}; do - DESTDIR=%{buildroot} %{python} ./x.py install --target=$triple std +for triple in %{?mingw_targets} %{?wasm_targets}; do + DESTDIR=%{buildroot} %{__python3} ./x.py install --target=$triple std done -%endif # These are transient files used by x.py dist and install rm -rf ./build/dist/ ./build/tmp/ @@ -691,19 +790,28 @@ rm -f %{buildroot}%{rustlibdir}/%{rust_triple}/bin/rust-ll* %check -export %{rust_env} +%{export_rust_env} + +# Sanity-check the installed binaries, debuginfo-stripped and all. +%{buildroot}%{_bindir}/cargo new build/hello-world +env RUSTC=%{buildroot}%{_bindir}/rustc \ + LD_LIBRARY_PATH="%{buildroot}%{_libdir}:$LD_LIBRARY_PATH" \ + %{buildroot}%{_bindir}/cargo run --manifest-path build/hello-world/Cargo.toml # The results are not stable on koji, so mask errors and just log it. # Some of the larger test artifacts are manually cleaned to save space. -%{python} ./x.py test --no-fail-fast --stage 2 || : +%{__python3} ./x.py test --no-fail-fast --stage 2 || : rm -rf "./build/%{rust_triple}/test/" -%{python} ./x.py test --no-fail-fast --stage 2 cargo || : +%{__python3} ./x.py test --no-fail-fast --stage 2 cargo || : rm -rf "./build/%{rust_triple}/stage2-tools/%{rust_triple}/cit/" -%{python} ./x.py test --no-fail-fast --stage 2 clippy || : -%{python} ./x.py test --no-fail-fast --stage 2 rls || : -%{python} ./x.py test --no-fail-fast --stage 2 rustfmt || : +%{__python3} ./x.py test --no-fail-fast --stage 2 clippy || : + +env RLS_TEST_WAIT_FOR_AGES=1 \ +%{__python3} ./x.py test --no-fail-fast --stage 2 rls || : + +%{__python3} ./x.py test --no-fail-fast --stage 2 rustfmt || : %ldconfig_scriptlets @@ -730,19 +838,53 @@ rm -rf "./build/%{rust_triple}/stage2-tools/%{rust_triple}/cit/" %{rustlibdir}/%{rust_triple}/lib/*.rlib -%if %defined cross_targets +%if %defined mingw_targets %{lua: do - for triple in string.gmatch(rpm.expand("%{cross_targets}"), "%S+") do + for triple in string.gmatch(rpm.expand("%{mingw_targets}"), "%S+") do local subs = { triple = triple, rustlibdir = rpm.expand("%{rustlibdir}"), } local s = string.gsub([[ + %files std-static-{{triple}} %dir {{rustlibdir}} %dir {{rustlibdir}}/{{triple}} %dir {{rustlibdir}}/{{triple}}/lib {{rustlibdir}}/{{triple}}/lib/*.rlib +{{rustlibdir}}/{{triple}}/lib/rs*.o +%exclude {{rustlibdir}}/{{triple}}/lib/*.dll +%exclude {{rustlibdir}}/{{triple}}/lib/*.dll.a +%exclude {{rustlibdir}}/{{triple}}/lib/self-contained + +]], "{{(%w+)}}", subs) + print(s) + end +end} +%endif + + +%if %defined wasm_targets +%{lua: do + for triple in string.gmatch(rpm.expand("%{wasm_targets}"), "%S+") do + local subs = { + triple = triple, + rustlibdir = rpm.expand("%{rustlibdir}"), + wasi = string.find(triple, "-wasi") and 1 or 0, + } + local s = string.gsub([[ + +%files std-static-{{triple}} +%dir {{rustlibdir}} +%dir {{rustlibdir}}/{{triple}} +%dir {{rustlibdir}}/{{triple}}/lib +{{rustlibdir}}/{{triple}}/lib/*.rlib +%if {{wasi}} +%dir {{rustlibdir}}/{{triple}}/lib/self-contained +{{rustlibdir}}/{{triple}}/lib/self-contained/crt*.o +{{rustlibdir}}/{{triple}}/lib/self-contained/libc.a +%endif + ]], "{{(%w+)}}", subs) print(s) end @@ -833,8 +975,25 @@ end} %changelog -* Wed Oct 27 2021 Josh Stone - 1.54.0-3 -- Lint against Unicode control codepoints. +* Thu Jan 20 2022 Josh Stone - 1.58.1-1 +- Update to 1.58.1. + +* Thu Jan 13 2022 Josh Stone - 1.58.0-1 +- Update to 1.58.0. + +* Wed Dec 15 2021 Josh Stone - 1.57.0-1 +- Update to 1.57.0. + +* Thu Dec 02 2021 Josh Stone - 1.56.1-2 +- Add rust-std-static-wasm32-wasi + Resolves: rhbz#1980080 + +* Tue Nov 02 2021 Josh Stone - 1.56.0-1 +- Update to 1.56.1. + +* Fri Oct 29 2021 Josh Stone - 1.55.0-1 +- Update to 1.55.0. +- Backport support for LLVM 13. * Tue Aug 17 2021 Josh Stone - 1.54.0-2 - Make std-static-wasm* arch-specific to avoid s390x.