[tbb-commits] [tor-browser-build/master] Bug 30376: Use Rust 1.34 for Tor Browser 9
gk at torproject.org
gk at torproject.org
Wed Aug 7 19:38:06 UTC 2019
commit d4f7c37aefc702fb9a66604cdf05bd8977036fc8
Author: Georg Koppen <gk at torproject.org>
Date: Wed Aug 7 19:34:23 2019 +0000
Bug 30376: Use Rust 1.34 for Tor Browser 9
Use 1.34 for tor Rust support on nightly builds as well.
---
projects/rust/build | 15 +---
projects/rust/config | 19 ++---
projects/rust/unwind.patch | 102 +++++++++++++-------------
projects/rust/unwind_128.patch | 161 -----------------------------------------
projects/tor/config | 6 --
5 files changed, 61 insertions(+), 242 deletions(-)
diff --git a/projects/rust/build b/projects/rust/build
index 0df84a1..633604c 100644
--- a/projects/rust/build
+++ b/projects/rust/build
@@ -59,11 +59,7 @@ cd /var/tmp/build/rustc-[% c('version') %]-src
# See: https://github.com/rust-lang/rust/issues/12859 for discussion about
# that and https://github.com/rust-lang/rust/pull/49633 for a newer attempt to
# fix this problem. We apply the patch from neersighted.
- [% IF !c("input_file_var/unwind_128") %]
- patch -p1 < $rootdir/unwind.patch
- [% ELSE %]
- patch -p1 < $rootdir/unwind_128.patch
- [% END %]
+ patch -p1 < $rootdir/unwind.patch
[% END %]
[% IF c("var/android") %]
@@ -78,15 +74,6 @@ mkdir build
cd build
../configure --prefix=$distdir [% c("var/configure_opt") %]
-# We need to disable Thin LTO due to reproducibility issues on macOS and
-# probably Linux. Alas, there is no direct option available in the config.toml
-# in 1.26.1 yet, so we need to toggle this indirectly via `codegen-units`.
-[% IF c("var/osx") || c("var/linux") %]
- # It seems hard to pass the proper value via ./configure so we resort to our
- # old friend `sed`.
- sed -i 's/#codegen-units = 1/codegen-units = 1/' config.toml
-[% END %]
-
make -j[% c("buildconf/num_procs") %]
make install
cd /var/tmp/dist
diff --git a/projects/rust/config b/projects/rust/config
index d784d39..011920b 100644
--- a/projects/rust/config
+++ b/projects/rust/config
@@ -1,15 +1,9 @@
# vim: filetype=yaml sw=2
filename: '[% project %]-[% c("version") %]-[% c("var/build_id") %].tar.gz'
-version: '[% c("input_file_var/rust_version") %]'
-
-# those values can be changed from the input_files section of other
-# projects. See projects/tor/config and bug 28260.
-input_file_var:
- rust_version: 1.26.1
- prev_version: 1.25.0
+version: 1.34.2
var:
- prev_version: '[% c("input_file_var/prev_version") %]'
+ prev_version: 1.33.0
rust_arch: '[% c("arch") %]'
container:
use_container: 1
@@ -55,6 +49,9 @@ targets:
#
# `--enable-extended` to build not only rustc but cargo as well
#
+ # `--enable-llvm-static-stdccp` to take a libstdc++ on Wheezy into account
+ # which is too old and if used gives undefined reference errors
+ #
# `--release-channel=stable` to just include stable features in the
# compiler
#
@@ -72,7 +69,7 @@ targets:
# version mismatch. We avoid that with this configure option. We need to
# build our own GCC in the first place as 4.7.2 is too old to get all the
# Rust pieces compiled.
- configure_opt: --enable-local-rust --enable-vendor --enable-extended --release-channel=stable --sysconfdir=etc --target=x86_64-unknown-linux-gnu,i686-unknown-linux-gnu --set=target.x86_64-unknown-linux-gnu.cc=gcc --set=target.i686-unknown-linux-gnu.cc=gcc
+ configure_opt: --enable-local-rust --enable-vendor --enable-extended --enable-llvm-static-stdcpp --release-channel=stable --sysconfdir=etc --target=x86_64-unknown-linux-gnu,i686-unknown-linux-gnu --set=target.x86_64-unknown-linux-gnu.cc=gcc --set=target.i686-unknown-linux-gnu.cc=gcc
osx-x86_64:
var:
@@ -107,9 +104,7 @@ input_files:
file_gpg_id: 1
gpg_keyring: rust.gpg
- filename: unwind.patch
- enable: '[% c("var/windows-i686") && !c("input_file_var/unwind_128") %]'
- - filename: unwind_128.patch
- enable: '[% c("input_file_var/unwind_128") %]'
+ enable: '[% c("var/windows-i686") %]'
- filename: replace_pagesize_in_mmap.patch
enable: '[% c("var/android") %]'
- filename: 0001-Make-sure-dl_iterate_phdr-is-undefined-on-Android.patch
diff --git a/projects/rust/unwind.patch b/projects/rust/unwind.patch
index 3a191b9..7b22dcb 100644
--- a/projects/rust/unwind.patch
+++ b/projects/rust/unwind.patch
@@ -1,6 +1,6 @@
-From dd808373aefe6247975455006bbfb89aa6410ed9 Mon Sep 17 00:00:00 2001
+From b3bea7008ece7a5bdf9b5a5dcc95e82febad1854 Mon Sep 17 00:00:00 2001
From: Bjorn Neergaard <bjorn at neersighted.com>
-Date: Tue, 3 Apr 2018 19:01:07 -0600
+Date: Sat, 9 Feb 2019 19:39:23 +0000
Subject: [PATCH] Fix cross-compiling i686-pc-windows-gnu from Linux
This is still very rough and serves as a proof-of-concept for fixing
@@ -32,49 +32,49 @@ rethinking of how iOS is special-cased above, to avoid further
duplication. Input on how to best structure this file is requested.
diff --git a/src/bootstrap/compile.rs b/src/bootstrap/compile.rs
-index e6aa78fba5..624f2ccfbe 100644
+index 249a183189..df08d6eb0c 100644
--- a/src/bootstrap/compile.rs
+++ b/src/bootstrap/compile.rs
-@@ -146,6 +146,11 @@ pub fn std_cargo(build: &Builder,
- cargo.env("MACOSX_DEPLOYMENT_TARGET", target);
- }
-
-+ // FIXME: Temporary detection of SJLJ MinGW compilers.
-+ if build.build.build.contains("linux") && target == "i686-pc-windows-gnu" {
-+ features.push_str(" sjlj_eh");
-+ }
+@@ -162,7 +162,12 @@ pub fn std_cargo(builder: &Builder<'_>,
+ .arg("--features")
+ .arg("compiler-builtins-mem");
+ } else {
+- let features = builder.std_features();
++ let mut features = builder.std_features();
+
- // When doing a local rebuild we tell cargo that we're stage1 rather than
- // stage0. This works fine if the local rust and being-built rust have the
- // same view of what the default allocator is, but fails otherwise. Since
++ // FIXME: Temporary detection of SJLJ MinGW compilers.
++ if builder.config.build.contains("linux") && target == "i686-pc-windows-gnu" {
++ features.push_str(" sjlj_eh");
++ }
+
+ if compiler.stage != 0 && builder.config.sanitizers {
+ // This variable is used by the sanitizer runtime crates, e.g.
diff --git a/src/libstd/Cargo.toml b/src/libstd/Cargo.toml
-index 1201759885..a06ef7e0e6 100644
+index 7d60a17042..d876d0b89a 100644
--- a/src/libstd/Cargo.toml
+++ b/src/libstd/Cargo.toml
-@@ -49,3 +49,4 @@ force_alloc_system = []
- panic-unwind = ["panic_unwind"]
- profiler = ["profiler_builtins"]
- wasm_syscall = []
+@@ -71,3 +71,4 @@ wasm-bindgen-threads = []
+ # https://github.com/rust-lang-nursery/stdsimd/blob/master/crates/std_detect/Cargo.toml
+ std_detect_file_io = []
+ std_detect_dlsym_getauxval = []
+sjlj_eh = ["unwind/sjlj_eh"]
diff --git a/src/libunwind/Cargo.toml b/src/libunwind/Cargo.toml
-index fbd9789d2f..15a20d7ff4 100644
+index 2378b0a315..0b5979ed62 100644
--- a/src/libunwind/Cargo.toml
+++ b/src/libunwind/Cargo.toml
-@@ -14,3 +14,7 @@ doc = false
- [dependencies]
+@@ -16,3 +16,6 @@ doc = false
core = { path = "../libcore" }
- libc = { path = "../rustc/libc_shim" }
+ libc = { version = "0.2.43", features = ['rustc-dep-of-std'], default-features = false }
+ compiler_builtins = "0.1.0"
+
+[features]
+sjlj_eh = []
-+
diff --git a/src/libunwind/libunwind.rs b/src/libunwind/libunwind.rs
-index aa73b11fb3..16c21be736 100644
+index 339b554ed6..ec2f93ed60 100644
--- a/src/libunwind/libunwind.rs
+++ b/src/libunwind/libunwind.rs
-@@ -10,11 +10,6 @@
-
- #![allow(bad_style)]
+@@ -1,10 +1,5 @@
+ #![allow(nonstandard_style)]
-macro_rules! cfg_if {
- ( $( if #[cfg( $meta:meta )] { $($it1:item)* } else { $($it2:item)* } )* ) =>
@@ -84,15 +84,18 @@ index aa73b11fb3..16c21be736 100644
use libc::{c_int, c_void, uintptr_t};
#[repr(C)]
-@@ -85,7 +80,6 @@ pub type _Unwind_Exception_Cleanup_Fn = extern "C" fn(unwind_code: _Unwind_Reaso
+@@ -73,8 +68,8 @@ pub enum _Unwind_Context {}
+ pub type _Unwind_Exception_Cleanup_Fn = extern "C" fn(unwind_code: _Unwind_Reason_Code,
+ exception: *mut _Unwind_Exception);
extern "C" {
- #[cfg_attr(stage0, unwind)]
- #[cfg_attr(not(stage0), unwind(allowed))]
+- #[unwind(allowed)]
- pub fn _Unwind_Resume(exception: *mut _Unwind_Exception) -> !;
++ #[cfg_attr(stage0, unwind)]
++ #[cfg_attr(not(stage0), unwind(allowed))]
pub fn _Unwind_DeleteException(exception: *mut _Unwind_Exception);
pub fn _Unwind_GetLanguageSpecificData(ctx: *mut _Unwind_Context) -> *mut c_void;
pub fn _Unwind_GetRegionStart(ctx: *mut _Unwind_Context) -> _Unwind_Ptr;
-@@ -217,28 +211,52 @@ if #[cfg(all(any(target_os = "ios", not(target_arch = "arm"))))] {
+@@ -206,26 +201,52 @@ if #[cfg(all(any(target_os = "ios", target_os = "netbsd", not(target_arch = "arm
pc
}
}
@@ -104,17 +107,13 @@ index aa73b11fb3..16c21be736 100644
+if #[cfg(all(target_os = "ios", target_arch = "arm"))] {
+ // 32-bit iOS uses SjLj and does not provide _Unwind_Backtrace()
extern "C" {
- #[cfg_attr(stage0, unwind)]
- #[cfg_attr(not(stage0), unwind(allowed))]
+- #[unwind(allowed)]
- pub fn _Unwind_RaiseException(exception: *mut _Unwind_Exception) -> _Unwind_Reason_Code;
-- pub fn _Unwind_Backtrace(trace: _Unwind_Trace_Fn,
-- trace_argument: *mut c_void)
-- -> _Unwind_Reason_Code;
++ #[cfg_attr(stage0, unwind)]
++ #[cfg_attr(not(stage0), unwind(allowed))]
+ pub fn _Unwind_Resume(exception: *mut _Unwind_Exception) -> !;
+ pub fn _Unwind_SjLj_RaiseException(e: *mut _Unwind_Exception) -> _Unwind_Reason_Code;
- }
--} else {
-- // 32-bit iOS uses SjLj and does not provide _Unwind_Backtrace()
++ }
+
+ #[inline]
+ pub unsafe fn _Unwind_RaiseException(exc: *mut _Unwind_Exception) -> _Unwind_Reason_Code {
@@ -122,15 +121,20 @@ index aa73b11fb3..16c21be736 100644
+ }
+
+} else if #[cfg(feature = "sjlj_eh")] {
- extern "C" {
- #[cfg_attr(stage0, unwind)]
- #[cfg_attr(not(stage0), unwind(allowed))]
++ extern "C" {
++ #[cfg_attr(stage0, unwind)]
++ #[cfg_attr(not(stage0), unwind(allowed))]
+ pub fn _Unwind_SjLj_Resume(e: *mut _Unwind_Exception) -> !;
- pub fn _Unwind_SjLj_RaiseException(e: *mut _Unwind_Exception) -> _Unwind_Reason_Code;
-+ pub fn _Unwind_Backtrace(trace: _Unwind_Trace_Fn,
-+ trace_argument: *mut c_void)
-+ -> _Unwind_Reason_Code;
-+ }
++ pub fn _Unwind_SjLj_RaiseException(e: *mut _Unwind_Exception) -> _Unwind_Reason_Code;
+ pub fn _Unwind_Backtrace(trace: _Unwind_Trace_Fn,
+ trace_argument: *mut c_void)
+ -> _Unwind_Reason_Code;
+ }
+-} else {
+- // 32-bit iOS uses SjLj and does not provide _Unwind_Backtrace()
+- extern "C" {
+- #[unwind(allowed)]
+- pub fn _Unwind_SjLj_RaiseException(e: *mut _Unwind_Exception) -> _Unwind_Reason_Code;
+
+ #[inline]
+ pub unsafe fn _Unwind_Resume(exc: *mut _Unwind_Exception) -> ! {
@@ -154,5 +158,5 @@ index aa73b11fb3..16c21be736 100644
}
} // cfg_if!
--
-2.17.1
+2.23.0.rc0
diff --git a/projects/rust/unwind_128.patch b/projects/rust/unwind_128.patch
deleted file mode 100644
index 93528c9..0000000
--- a/projects/rust/unwind_128.patch
+++ /dev/null
@@ -1,161 +0,0 @@
-From 0a186eafebf26ca01879827a4cc95cc274791334 Mon Sep 17 00:00:00 2001
-From: Bjorn Neergaard <bjorn at neersighted.com>
-Date: Sat, 9 Feb 2019 19:39:23 +0000
-Subject: [PATCH] Fix cross-compiling i686-pc-windows-gnu from Linux
-
-This is still very rough and serves as a proof-of-concept for fixing
-Linux -> 32-bit MinGW cross compilation workflow. Currently, clang and
-GCC's MinGW targets both only support DW2 (DWARF) or SJLJ (Set Jump Long
-Jump) unwinding on 32-bit Windows.
-
-The default for GCC (and the way it is shipped on every major distro) is
-to use SJLJ on Windows, as DWARF cannot traverse non-DWARF frames. This
-would work fine, except for the fact that libgcc (our C runtime on the
-MinGW platform) exports symbols under a different name when configured
-to use SJLJ-style unwinding, and uses a preprocessor macro internally to
-alias them.
-
-Because of this, we have to detect this scenario and link to the correct
-symbols ourselves. Linking has been tested with a full bootstrap on both
-x86_64-unknown-linux-gnu and i686-pc-windows-gnu, as well as
-cross-compilation of some of my own projects.
-
-Obviously, the detection is a bit unrefined. Right now we
-unconditionally use SJLJ when compiling Linux -> MinGW. I'd like to add
-feature detection using compiler build flags or autotools-style
-compilation and object analysis. Input on the best way to proceed here
-is welcome.
-
-Also, currently there is copy-pasted/duplicated code in libunwind.
-Ideally, this could be reduced, but this would likely require a
-rethinking of how iOS is special-cased above, to avoid further
-duplication. Input on how to best structure this file is requested.
-
-diff --git a/src/bootstrap/compile.rs b/src/bootstrap/compile.rs
-index 11d9154ba6..bd8ff844f7 100644
---- a/src/bootstrap/compile.rs
-+++ b/src/bootstrap/compile.rs
-@@ -154,6 +154,11 @@ pub fn std_cargo(builder: &Builder,
- } else {
- let mut features = builder.std_features();
-
-+ // FIXME: Temporary detection of SJLJ MinGW compilers.
-+ if builder.config.build.contains("linux") && target == "i686-pc-windows-gnu" {
-+ features.push_str(" sjlj_eh");
-+ }
-+
- // When doing a local rebuild we tell cargo that we're stage1 rather than
- // stage0. This works fine if the local rust and being-built rust have the
- // same view of what the default allocator is, but fails otherwise. Since
-diff --git a/src/libstd/Cargo.toml b/src/libstd/Cargo.toml
-index 5a2dce5930..e1c876f503 100644
---- a/src/libstd/Cargo.toml
-+++ b/src/libstd/Cargo.toml
-@@ -50,3 +50,4 @@ force_alloc_system = []
- panic-unwind = ["panic_unwind"]
- profiler = ["profiler_builtins"]
- wasm_syscall = []
-+sjlj_eh = ["unwind/sjlj_eh"]
-diff --git a/src/libunwind/Cargo.toml b/src/libunwind/Cargo.toml
-index 4760461df6..27c7303604 100644
---- a/src/libunwind/Cargo.toml
-+++ b/src/libunwind/Cargo.toml
-@@ -15,3 +15,6 @@ doc = false
- core = { path = "../libcore" }
- libc = { path = "../rustc/libc_shim" }
- compiler_builtins = { path = "../rustc/compiler_builtins_shim" }
-+
-+[features]
-+sjlj_eh = []
-diff --git a/src/libunwind/libunwind.rs b/src/libunwind/libunwind.rs
-index 73a259bd44..ff3404864f 100644
---- a/src/libunwind/libunwind.rs
-+++ b/src/libunwind/libunwind.rs
-@@ -10,11 +10,6 @@
-
- #![allow(bad_style)]
-
--macro_rules! cfg_if {
-- ( $( if #[cfg( $meta:meta )] { $($it1:item)* } else { $($it2:item)* } )* ) =>
-- ( $( $( #[cfg($meta)] $it1)* $( #[cfg(not($meta))] $it2)* )* )
--}
--
- use libc::{c_int, c_void, uintptr_t};
-
- #[repr(C)]
-@@ -83,8 +78,8 @@ pub enum _Unwind_Context {}
- pub type _Unwind_Exception_Cleanup_Fn = extern "C" fn(unwind_code: _Unwind_Reason_Code,
- exception: *mut _Unwind_Exception);
- extern "C" {
-- #[unwind(allowed)]
-- pub fn _Unwind_Resume(exception: *mut _Unwind_Exception) -> !;
-+ #[cfg_attr(stage0, unwind)]
-+ #[cfg_attr(not(stage0), unwind(allowed))]
- pub fn _Unwind_DeleteException(exception: *mut _Unwind_Exception);
- pub fn _Unwind_GetLanguageSpecificData(ctx: *mut _Unwind_Context) -> *mut c_void;
- pub fn _Unwind_GetRegionStart(ctx: *mut _Unwind_Context) -> _Unwind_Ptr;
-@@ -216,26 +211,52 @@ if #[cfg(all(any(target_os = "ios", target_os = "netbsd", not(target_arch = "arm
- pc
- }
- }
-+} // cfg_if!
-
--if #[cfg(not(all(target_os = "ios", target_arch = "arm")))] {
-- // Not 32-bit iOS
-+cfg_if! {
-+if #[cfg(all(target_os = "ios", target_arch = "arm"))] {
-+ // 32-bit iOS uses SjLj and does not provide _Unwind_Backtrace()
- extern "C" {
-- #[unwind(allowed)]
-- pub fn _Unwind_RaiseException(exception: *mut _Unwind_Exception) -> _Unwind_Reason_Code;
-+ #[cfg_attr(stage0, unwind)]
-+ #[cfg_attr(not(stage0), unwind(allowed))]
-+ pub fn _Unwind_Resume(exception: *mut _Unwind_Exception) -> !;
-+ pub fn _Unwind_SjLj_RaiseException(e: *mut _Unwind_Exception) -> _Unwind_Reason_Code;
-+ }
-+
-+ #[inline]
-+ pub unsafe fn _Unwind_RaiseException(exc: *mut _Unwind_Exception) -> _Unwind_Reason_Code {
-+ _Unwind_SjLj_RaiseException(exc)
-+ }
-+
-+} else if #[cfg(feature = "sjlj_eh")] {
-+ extern "C" {
-+ #[cfg_attr(stage0, unwind)]
-+ #[cfg_attr(not(stage0), unwind(allowed))]
-+ pub fn _Unwind_SjLj_Resume(e: *mut _Unwind_Exception) -> !;
-+ pub fn _Unwind_SjLj_RaiseException(e: *mut _Unwind_Exception) -> _Unwind_Reason_Code;
- pub fn _Unwind_Backtrace(trace: _Unwind_Trace_Fn,
- trace_argument: *mut c_void)
- -> _Unwind_Reason_Code;
- }
--} else {
-- // 32-bit iOS uses SjLj and does not provide _Unwind_Backtrace()
-- extern "C" {
-- #[unwind(allowed)]
-- pub fn _Unwind_SjLj_RaiseException(e: *mut _Unwind_Exception) -> _Unwind_Reason_Code;
-+
-+ #[inline]
-+ pub unsafe fn _Unwind_Resume(exc: *mut _Unwind_Exception) -> ! {
-+ _Unwind_SjLj_Resume(exc)
- }
-
- #[inline]
- pub unsafe fn _Unwind_RaiseException(exc: *mut _Unwind_Exception) -> _Unwind_Reason_Code {
- _Unwind_SjLj_RaiseException(exc)
- }
-+} else {
-+ extern "C" {
-+ #[cfg_attr(stage0, unwind)]
-+ #[cfg_attr(not(stage0), unwind(allowed))]
-+ pub fn _Unwind_Resume(exception: *mut _Unwind_Exception) -> !;
-+ pub fn _Unwind_RaiseException(exception: *mut _Unwind_Exception) -> _Unwind_Reason_Code;
-+ pub fn _Unwind_Backtrace(trace: _Unwind_Trace_Fn,
-+ trace_argument: *mut c_void)
-+ -> _Unwind_Reason_Code;
-+ }
- }
- } // cfg_if!
---
-2.20.1
-
diff --git a/projects/tor/config b/projects/tor/config
index 35b37ce..682cfd3 100644
--- a/projects/tor/config
+++ b/projects/tor/config
@@ -59,10 +59,4 @@ input_files:
project: '[% c("var/compiler") %]'
- name: rust
project: rust
- # Tor needs rust >= 1.28.0
- # See bug 28260
- input_file_var:
- rust_version: 1.28.0
- prev_version: 1.27.2
- unwind_128: '[% c("var/windows-i686") %]'
enable: '[% !c("var/android") && c("var/nightly") %]'
More information about the tbb-commits
mailing list