]> git.proxmox.com Git - rustc.git/commitdiff
Use system compiler-rt from libclang-common-*-dev
authorXimin Luo <infinity0@debian.org>
Mon, 20 May 2019 03:09:27 +0000 (20:09 -0700)
committerXimin Luo <infinity0@debian.org>
Mon, 20 May 2019 03:09:27 +0000 (20:09 -0700)
debian/README.source
debian/changelog
debian/control
debian/copyright
debian/patches/d-fix-mips64el-bootstrap.patch
debian/patches/d-use-system-compiler-rt.patch [new file with mode: 0644]
debian/patches/gcc-4.8-aarch64-ice.diff [deleted file]
debian/patches/series
debian/source/lintian-overrides

index e0e6dc6fc2803a9629be99c83aa025034764e37d..63a8d33deda04559186ff62cbf8a680268073e10 100644 (file)
@@ -17,13 +17,6 @@ The upstream source package embeds many external libraries. We make a great
 effort to remove them and use system versions where possible, but there are a
 few more remaining:
 
- * compiler-rt from https://github.com/rust-lang/compiler-rt
-   -> system-wide compiler-rt fails during linkage
-
-   Bug reported upstream, still to be fixed, see:
-    - https://github.com/rust-lang/rust/issues/15054
-    - https://github.com/rust-lang/rust/issues/15708
-
  * vendor/backtrace-sys, vendor/dlmalloc, vendor/walkdir
 
    These are small C libraries designed to be statically linked; their upstream
index ce2147cecc0ae34ee84ab9def0f3454930a54c83..07afd64a7d163bcf3622e41b546b0d2ee2cec706 100644 (file)
@@ -1,6 +1,7 @@
 rustc (1.34.2+dfsg1-1~exp2) UNRELEASED; urgency=medium
 
   * Fix doc build, add version 1 compat mode hack for mdBook 2.
+  * Use system compiler-rt from libclang-common-*-dev.
 
  -- Ximin Luo <infinity0@debian.org>  Sun, 19 May 2019 11:53:46 -0700
 
index 6d8338e786473cbc74fa6271cf581de82525d76b..35eb5c00a59db8f0ef4cb7dab7c4de840fb6b08e 100644 (file)
@@ -15,6 +15,7 @@ Build-Depends: debhelper (>= 9),
                llvm-8-dev:native,
                llvm-8-tools:native,
                libllvm8,
+               libclang-common-8-dev,
                autotools-dev,
                cmake (>= 3.0) | cmake3,
 # needed by some vendor crates
index 9a93d00b696012f6e0976a76b05d8e8f9d314507..bb196c92a649d775f9094ecfb08d08f096b277ab 100644 (file)
@@ -24,21 +24,8 @@ Files-Excluded:
  src/tools/remote-test-server
  src/tools/rustfmt
  src/tools/miri
-# Extraneous stuff from compiler-rt that's not needed by Rust
- vendor/compiler_builtins/compiler-rt/cmake
- vendor/compiler_builtins/compiler-rt/docs
- vendor/compiler_builtins/compiler-rt/include
- vendor/compiler_builtins/compiler-rt/lib/*san
- vendor/compiler_builtins/compiler-rt/lib/fuzzer
- vendor/compiler_builtins/compiler-rt/lib/interception
- vendor/compiler_builtins/compiler-rt/lib/profile
- vendor/compiler_builtins/compiler-rt/lib/sanitizer_common
- vendor/compiler_builtins/compiler-rt/lib/scudo
- vendor/compiler_builtins/compiler-rt/lib/xray
- vendor/compiler_builtins/compiler-rt/test
- vendor/compiler_builtins/compiler-rt/unittests
- vendor/compiler_builtins/compiler-rt/www
 # Embedded C libraries
+ vendor/compiler_builtins/compiler-rt
  vendor/libz-sys/src/zlib*
  vendor/lzma-sys*/xz-*
 # Embedded binary blobs
@@ -224,6 +211,8 @@ Copyright: 2016-2019 Jorge Aparicio <japaricious@gmail.com>
 License: MIT or Apache-2.0
 Comment: see https://github.com/rust-lang-nursery/compiler-builtins
 
+# TODO: below entries for compiler-rt can be removed on next source re-pack
+
 Files: vendor/compiler_builtins/compiler-rt/*
 Copyright: 2009-2015 Howard Hinnant
            2009-2015 The CompileRT Developers (see src/compiler-rt/CREDITS.TXT)
index 3239d1a8ec9accc34750672550f3fd77ec3facd1..3b6347ee4ef8b579edf062f8eb7ec34c5d26d399 100644 (file)
@@ -1,7 +1,7 @@
 Bug: https://github.com/rust-lang/rust/issues/52108
 --- a/src/bootstrap/bootstrap.py
 +++ b/src/bootstrap/bootstrap.py
-@@ -620,6 +620,8 @@
+@@ -617,6 +617,8 @@
              (os.pathsep + env["LIBRARY_PATH"]) \
              if "LIBRARY_PATH" in env else ""
          env["RUSTFLAGS"] = "-Cdebuginfo=2 "
diff --git a/debian/patches/d-use-system-compiler-rt.patch b/debian/patches/d-use-system-compiler-rt.patch
new file mode 100644 (file)
index 0000000..9cc0348
--- /dev/null
@@ -0,0 +1,154 @@
+commit 484e4a2e83ca6cbfb96957996d57262792da0a30
+Author: Ximin Luo <infinity0@debian.org>
+Date:   Sun May 19 19:15:20 2019 -0700
+
+    Use system compiler-rt from clang
+
+--- a/vendor/compiler_builtins/build.rs
++++ b/vendor/compiler_builtins/build.rs
+@@ -68,6 +68,8 @@
+     use std::collections::BTreeMap;
+     use std::env;
+     use std::path::Path;
++    use std::process::Command;
++    use std::str;
+     struct Sources {
+         // SYMBOL -> PATH TO SOURCE
+@@ -113,33 +115,6 @@
+         let target_env = env::var("CARGO_CFG_TARGET_ENV").unwrap();
+         let target_os = env::var("CARGO_CFG_TARGET_OS").unwrap();
+         let target_vendor = env::var("CARGO_CFG_TARGET_VENDOR").unwrap();
+-        let cfg = &mut cc::Build::new();
+-
+-        cfg.warnings(false);
+-
+-        if target_env == "msvc" {
+-            // Don't pull in extra libraries on MSVC
+-            cfg.flag("/Zl");
+-
+-            // Emulate C99 and C++11's __func__ for MSVC prior to 2013 CTP
+-            cfg.define("__func__", Some("__FUNCTION__"));
+-        } else {
+-            // Turn off various features of gcc and such, mostly copying
+-            // compiler-rt's build system already
+-            cfg.flag("-fno-builtin");
+-            cfg.flag("-fvisibility=hidden");
+-            cfg.flag("-ffreestanding");
+-            // Avoid the following warning appearing once **per file**:
+-            // clang: warning: optimization flag '-fomit-frame-pointer' is not supported for target 'armv7' [-Wignored-optimization-argument]
+-            //
+-            // Note that compiler-rt's build system also checks
+-            //
+-            // `check_cxx_compiler_flag(-fomit-frame-pointer COMPILER_RT_HAS_FOMIT_FRAME_POINTER_FLAG)`
+-            //
+-            // in https://github.com/rust-lang/compiler-rt/blob/c8fbcb3/cmake/config-ix.cmake#L19.
+-            cfg.flag_if_supported("-fomit-frame-pointer");
+-            cfg.define("VISIBILITY_HIDDEN", None);
+-        }
+         let mut sources = Sources::new();
+         sources.extend(
+@@ -438,10 +413,23 @@
+         let src_dir = root.join("compiler-rt/lib/builtins");
+         for src in sources.map.values() {
+             let src = src_dir.join(src);
+-            cfg.file(&src);
+-            println!("cargo:rerun-if-changed={}", src.display());
+         }
+-        cfg.compile("libcompiler-rt.a");
++        // rustc sets this during the build
++        let llvm_config = env::var("LLVM_CONFIG").expect("LLVM_CONFIG not set");
++        let cmd = format!("ls -1d $({} --libdir)/clang/*/lib/linux", llvm_config);
++        let output = Command::new("sh")
++            .args(&["-ec", &cmd])
++            .output()
++            .expect("failed to find clang lib dir");
++        let status = output.status;
++        if !status.success() {
++            panic!(format!("failed to find clang lib dir: {:?}", status.code()));
++        }
++        for search_dir in str::from_utf8(&output.stdout).unwrap().lines() {
++            println!("cargo:rustc-link-search=native={}", search_dir);
++        }
++        let arch = llvm_target[0];
++        println!("cargo:rustc-link-lib=static=clang_rt.builtins-{}", arch);
+     }
+ }
+--- a/src/bootstrap/compile.rs
++++ b/src/bootstrap/compile.rs
+@@ -164,6 +164,12 @@
+     } else {
+         let features = builder.std_features();
++        // In Debian this is always available
++        let llvm_config = builder.ensure(native::Llvm {
++            target: builder.config.build,
++            emscripten: false,
++        });
++        cargo.env("LLVM_CONFIG", llvm_config);
+         if compiler.stage != 0 && builder.config.sanitizers {
+             // This variable is used by the sanitizer runtime crates, e.g.
+             // rustc_lsan, to build the sanitizer runtime from C code
+@@ -172,11 +178,7 @@
+             // missing
+             // We also only build the runtimes when --enable-sanitizers (or its
+             // config.toml equivalent) is used
+-            let llvm_config = builder.ensure(native::Llvm {
+-                target: builder.config.build,
+-                emscripten: false,
+-            });
+-            cargo.env("LLVM_CONFIG", llvm_config);
++            cargo.env("RUSTC_BUILD_SANITIZERS", "1");
+         }
+         cargo.arg("--features").arg(features)
+--- a/src/librustc_asan/build.rs
++++ b/src/librustc_asan/build.rs
+@@ -4,6 +4,9 @@
+ use cmake::Config;
+ fn main() {
++    if env::var("RUSTC_BUILD_SANITIZERS") != Ok("1".to_string()) {
++        return;
++    }
+     if let Some(llvm_config) = env::var_os("LLVM_CONFIG") {
+         build_helper::restore_library_path();
+--- a/src/librustc_lsan/build.rs
++++ b/src/librustc_lsan/build.rs
+@@ -4,6 +4,9 @@
+ use cmake::Config;
+ fn main() {
++    if env::var("RUSTC_BUILD_SANITIZERS") != Ok("1".to_string()) {
++        return;
++    }
+     if let Some(llvm_config) = env::var_os("LLVM_CONFIG") {
+         build_helper::restore_library_path();
+--- a/src/librustc_msan/build.rs
++++ b/src/librustc_msan/build.rs
+@@ -4,6 +4,9 @@
+ use cmake::Config;
+ fn main() {
++    if env::var("RUSTC_BUILD_SANITIZERS") != Ok("1".to_string()) {
++        return;
++    }
+     if let Some(llvm_config) = env::var_os("LLVM_CONFIG") {
+         build_helper::restore_library_path();
+--- a/src/librustc_tsan/build.rs
++++ b/src/librustc_tsan/build.rs
+@@ -4,6 +4,9 @@
+ use cmake::Config;
+ fn main() {
++    if env::var("RUSTC_BUILD_SANITIZERS") != Ok("1".to_string()) {
++        return;
++    }
+     if let Some(llvm_config) = env::var_os("LLVM_CONFIG") {
+         build_helper::restore_library_path();
diff --git a/debian/patches/gcc-4.8-aarch64-ice.diff b/debian/patches/gcc-4.8-aarch64-ice.diff
deleted file mode 100644 (file)
index aaa4d7b..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-Index: rustc/vendor/compiler_builtins/compiler-rt/lib/builtins/trunctfdf2.c
-===================================================================
---- rustc.orig/vendor/compiler_builtins/compiler-rt/lib/builtins/trunctfdf2.c
-+++ rustc/vendor/compiler_builtins/compiler-rt/lib/builtins/trunctfdf2.c
-@@ -7,6 +7,12 @@
- //
- //===----------------------------------------------------------------------===//
-+#if defined(__aarch64__) && (__GNUC__ <= 4) && (__GNUC_MINOR__ <= 8)
-+// work around https://launchpad.net/bugs/1667761
-+#pragma GCC push_options
-+#pragma GCC optimize "O1"
-+#endif
-+
- #define QUAD_PRECISION
- #include "fp_lib.h"
-@@ -20,3 +26,7 @@ COMPILER_RT_ABI double __trunctfdf2(long
- }
- #endif
-+#if defined(__aarch64__) && (__GNUC__ <= 4) && (__GNUC_MINOR__ <= 8)
-+#pragma GCC pop_options
-+#endif
-+
index f0ae927aa907d6322c78dd4e5bac019e80b59a8f..f0ebf9895c2070c5b0349b165e170820706a1712 100644 (file)
@@ -12,8 +12,6 @@ u-mips-fixes.diff
 # not forwarded, or forwarded but unlikely to be merged
 u-reproducible-dl-stage0.patch
 
-gcc-4.8-aarch64-ice.diff
-
 # Debian-specific patches, not suitable for upstream
 # Patches needed by debian/prune-unused-deps
 d-0000-ignore-removed-submodules.patch
@@ -22,6 +20,7 @@ d-0002-pkg-config-no-special-snowflake.patch
 d-0003-mdbook-strip-embedded-libs.patch
 d-0004-mdbook-2-1-compat.patch
 # Other patches needed by the full Debian build
+d-use-system-compiler-rt.patch
 d-ignore-error-detail-diff.patch
 d-disable-cargo-vendor.patch
 d-rust-gdb-paths
index 732a73a8813d1c2ba5dc5fff71acacf354a8db74..dda0650ff5007fa88e840f490b7ca777875a03ac 100644 (file)
@@ -1 +1,3 @@
 rustc source: source-is-missing src/stdsimd/crates/stdsimd-verify/arm-intrinsics.html line length is * characters (>*)
+# TODO: can be removed on next source repack
+rustc source: source-includes-file-in-files-excluded vendor/compiler_builtins/compiler-rt/*