From b75204458f6c927dd5127fb7a84c2b6914652c05 Mon Sep 17 00:00:00 2001 From: Igor Pashev Date: Mon, 2 Dec 2019 08:23:42 +0100 Subject: Add a patch for Dyson --- Makefile | 5 +-- rustc-1.29.0.dyson.patch | 91 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 94 insertions(+), 2 deletions(-) create mode 100644 rustc-1.29.0.dyson.patch diff --git a/Makefile b/Makefile index d21b11c8..c45b5c65 100644 --- a/Makefile +++ b/Makefile @@ -207,9 +207,10 @@ $(RUSTC_SRC_TARBALL): $(RUSTC_SRC_DES) @echo [CURL] $@ @rm -f $@ @curl -sS https://static.rust-lang.org/dist/$@ -o $@ -$(RUSTC_SRC_DL): $(RUSTC_SRC_TARBALL) rustc-$(RUSTC_VERSION)-src.patch +$(RUSTC_SRC_DL): $(RUSTC_SRC_TARBALL) rustc-$(RUSTC_VERSION)-src.patch rustc-$(RUSTC_VERSION).dyson.patch tar -xf $(RUSTC_SRC_TARBALL) - cd $(RUSTCSRC) && patch -p0 < ../rustc-$(RUSTC_VERSION)-src.patch; + cd $(RUSTCSRC) && patch -p0 < ../rustc-$(RUSTC_VERSION)-src.patch \ + && patch -p0 < ../rustc-$(RUSTC_VERSION).dyson.patch cat $(RUSTC_SRC_DES) > $(RUSTC_SRC_DL) endif diff --git a/rustc-1.29.0.dyson.patch b/rustc-1.29.0.dyson.patch new file mode 100644 index 00000000..87c8f6d0 --- /dev/null +++ b/rustc-1.29.0.dyson.patch @@ -0,0 +1,91 @@ +diff -Ndubr rustc-1.29.0-src/src/librustc_target/spec/mod.rs mrust/rustc-1.29.0-src/src/librustc_target/spec/mod.rs +--- rustc-1.29.0-src/src/librustc_target/spec/mod.rs 2018-09-11 05:37:38.000000000 +0200 ++++ mrust/rustc-1.29.0-src/src/librustc_target/spec/mod.rs 2019-12-01 14:59:43.464760937 +0100 +@@ -347,6 +347,7 @@ + + ("armebv7r-none-eabihf", armebv7r_none_eabihf), + ++ ("x86_64-pc-solaris2.11", x86_64_pc_solaris), + ("x86_64-sun-solaris", x86_64_sun_solaris), + ("sparcv9-sun-solaris", sparcv9_sun_solaris), + +diff -Ndubr rustc-1.29.0-src/src/librustc_target/spec/x86_64_pc_solaris.rs mrust/rustc-1.29.0-src/src/librustc_target/spec/x86_64_pc_solaris.rs +--- rustc-1.29.0-src/src/librustc_target/spec/x86_64_pc_solaris.rs 1970-01-01 01:00:00.000000000 +0100 ++++ mrust/rustc-1.29.0-src/src/librustc_target/spec/x86_64_pc_solaris.rs 2019-12-01 15:02:06.222678682 +0100 +@@ -0,0 +1,33 @@ ++// Copyright 2014-2015 The Rust Project Developers. See the COPYRIGHT ++// file at the top-level directory of this distribution and at ++// http://rust-lang.org/COPYRIGHT. ++// ++// Licensed under the Apache License, Version 2.0 or the MIT license ++// , at your ++// option. This file may not be copied, modified, or distributed ++// except according to those terms. ++ ++use spec::{LinkerFlavor, Target, TargetResult}; ++ ++pub fn target() -> TargetResult { ++ let mut base = super::solaris_base::opts(); ++ base.pre_link_args.insert(LinkerFlavor::Gcc, vec!["-m64".to_string()]); ++ base.cpu = "x86-64".to_string(); ++ base.max_atomic_width = Some(64); ++ base.stack_probes = true; ++ ++ Ok(Target { ++ llvm_target: "x86_64-pc-solaris".to_string(), ++ target_endian: "little".to_string(), ++ target_pointer_width: "64".to_string(), ++ target_c_int_width: "32".to_string(), ++ data_layout: "e-m:e-i64:64-f80:128-n8:16:32:64-S128".to_string(), ++ arch: "x86_64".to_string(), ++ target_os: "solaris".to_string(), ++ target_env: "gnu".to_string(), ++ target_vendor: "unknown".to_string(), ++ linker_flavor: LinkerFlavor::Gcc, ++ options: base, ++ }) ++} +diff -Ndubr rustc-1.29.0-src/src/vendor/regex/build.rs mrust/rustc-1.29.0-src/src/vendor/regex/build.rs +--- rustc-1.29.0-src/src/vendor/regex/build.rs 2018-09-11 06:49:56.000000000 +0200 ++++ mrust/rustc-1.29.0-src/src/vendor/regex/build.rs 2019-11-29 13:52:13.710194395 +0100 +@@ -3,18 +3,10 @@ + use std::process::Command; + + fn main() { +- let rustc = env::var_os("RUSTC").unwrap_or(OsString::from("rustc")); +- let output = Command::new(&rustc) +- .arg("--version") +- .output() +- .unwrap() +- .stdout; +- let version = String::from_utf8(output).unwrap(); +- +- enable_simd_optimizations(&version); ++ enable_simd_optimizations(); + } + +-fn enable_simd_optimizations(version: &str) { ++fn enable_simd_optimizations() { + // If we're using nightly Rust, then we can enable vector optimizations. + // Note that these aren't actually activated unless the `unstable` feature + // is enabled. +@@ -25,18 +17,8 @@ + if env::var_os("CARGO_CFG_REGEX_DISABLE_AUTO_OPTIMIZATIONS").is_some() { + return; + } +- let parsed = match Version::parse(&version) { +- Ok(parsed) => parsed, +- Err(err) => { +- eprintln!("failed to parse `rustc --version`: {}", err); +- return; +- } +- }; +- let minimum = Version { major: 1, minor: 27, patch: 0 }; +- if version.contains("nightly") || parsed >= minimum { + println!("cargo:rustc-cfg=regex_runtime_teddy_ssse3"); + println!("cargo:rustc-cfg=regex_runtime_teddy_avx2"); +- } + } + + #[derive(Clone, Copy, Debug, Eq, PartialEq, PartialOrd, Ord)] -- cgit v1.2.3