diff options
author | Alex Crichton <alex@alexcrichton.com> | 2018-05-22 19:40:02 -0700 |
---|---|---|
committer | Alex Crichton <alex@alexcrichton.com> | 2018-05-30 05:58:23 -0700 |
commit | 7c14a54bc81d8e259b43ac8077f2e851c7769753 (patch) | |
tree | b2fcc538cd809201463f1ac15c92708bbc0511a2 | |
parent | std: Delete bundled libbacktrace module (diff) | |
download | grust-7c14a54bc81d8e259b43ac8077f2e851c7769753.tar.gz grust-7c14a54bc81d8e259b43ac8077f2e851c7769753.tar.bz2 grust-7c14a54bc81d8e259b43ac8077f2e851c7769753.tar.xz |
Replace libbacktrace with a submodule
While we're at it update the `backtrace` crate from crates.io. It turns out that
the submodule's configure script has gotten a lot more finnicky as of late so
also switch over to using the `cc` crate manually which allows to avoid some
hacks around the configure script as well
-rw-r--r-- | .gitmodules | 3 | ||||
-rw-r--r-- | src/Cargo.lock | 8 | ||||
m--------- | src/libbacktrace | 0 | ||||
-rw-r--r-- | src/libstd/Cargo.toml | 1 | ||||
-rw-r--r-- | src/libstd/build.rs | 75 | ||||
-rw-r--r-- | src/tools/tidy/src/deps.rs | 1 |
6 files changed, 62 insertions, 26 deletions
diff --git a/.gitmodules b/.gitmodules index 55f586389b..f3eb902709 100644 --- a/.gitmodules +++ b/.gitmodules | |||
@@ -53,3 +53,6 @@ | |||
53 | [submodule "src/tools/lld"] | 53 | [submodule "src/tools/lld"] |
54 | path = src/tools/lld | 54 | path = src/tools/lld |
55 | url = https://github.com/rust-lang/lld.git | 55 | url = https://github.com/rust-lang/lld.git |
56 | [submodule "src/libbacktrace"] | ||
57 | path = src/libbacktrace | ||
58 | url = https://github.com/rust-lang-nursery/libbacktrace | ||
diff --git a/src/Cargo.lock b/src/Cargo.lock index d61f007b6a..3a27107f82 100644 --- a/src/Cargo.lock +++ b/src/Cargo.lock | |||
@@ -105,7 +105,7 @@ name = "backtrace" | |||
105 | version = "0.3.6" | 105 | version = "0.3.6" |
106 | source = "registry+https://github.com/rust-lang/crates.io-index" | 106 | source = "registry+https://github.com/rust-lang/crates.io-index" |
107 | dependencies = [ | 107 | dependencies = [ |
108 | "backtrace-sys 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)", | 108 | "backtrace-sys 0.1.22 (registry+https://github.com/rust-lang/crates.io-index)", |
109 | "cfg-if 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", | 109 | "cfg-if 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", |
110 | "libc 0.2.40 (registry+https://github.com/rust-lang/crates.io-index)", | 110 | "libc 0.2.40 (registry+https://github.com/rust-lang/crates.io-index)", |
111 | "rustc-demangle 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", | 111 | "rustc-demangle 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", |
@@ -114,11 +114,12 @@ dependencies = [ | |||
114 | 114 | ||
115 | [[package]] | 115 | [[package]] |
116 | name = "backtrace-sys" | 116 | name = "backtrace-sys" |
117 | version = "0.1.16" | 117 | version = "0.1.22" |
118 | source = "registry+https://github.com/rust-lang/crates.io-index" | 118 | source = "registry+https://github.com/rust-lang/crates.io-index" |
119 | dependencies = [ | 119 | dependencies = [ |
120 | "cc 1.0.15 (registry+https://github.com/rust-lang/crates.io-index)", | 120 | "cc 1.0.15 (registry+https://github.com/rust-lang/crates.io-index)", |
121 | "libc 0.2.40 (registry+https://github.com/rust-lang/crates.io-index)", | 121 | "libc 0.2.40 (registry+https://github.com/rust-lang/crates.io-index)", |
122 | "pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", | ||
122 | ] | 123 | ] |
123 | 124 | ||
124 | [[package]] | 125 | [[package]] |
@@ -2513,6 +2514,7 @@ dependencies = [ | |||
2513 | "alloc_jemalloc 0.0.0", | 2514 | "alloc_jemalloc 0.0.0", |
2514 | "alloc_system 0.0.0", | 2515 | "alloc_system 0.0.0", |
2515 | "build_helper 0.1.0", | 2516 | "build_helper 0.1.0", |
2517 | "cc 1.0.15 (registry+https://github.com/rust-lang/crates.io-index)", | ||
2516 | "compiler_builtins 0.0.0", | 2518 | "compiler_builtins 0.0.0", |
2517 | "core 0.0.0", | 2519 | "core 0.0.0", |
2518 | "libc 0.0.0", | 2520 | "libc 0.0.0", |
@@ -3051,7 +3053,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" | |||
3051 | "checksum assert_cli 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5da59dbd8df54562665b925b427221ceda9b771408cb8a6cbd2125d3b001330b" | 3053 | "checksum assert_cli 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5da59dbd8df54562665b925b427221ceda9b771408cb8a6cbd2125d3b001330b" |
3052 | "checksum atty 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "af80143d6f7608d746df1520709e5d141c96f240b0e62b0aa41bdfb53374d9d4" | 3054 | "checksum atty 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "af80143d6f7608d746df1520709e5d141c96f240b0e62b0aa41bdfb53374d9d4" |
3053 | "checksum backtrace 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "ebbe525f66f42d207968308ee86bc2dd60aa5fab535b22e616323a173d097d8e" | 3055 | "checksum backtrace 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "ebbe525f66f42d207968308ee86bc2dd60aa5fab535b22e616323a173d097d8e" |
3054 | "checksum backtrace-sys 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)" = "44585761d6161b0f57afc49482ab6bd067e4edef48c12a152c237eb0203f7661" | 3056 | "checksum backtrace-sys 0.1.22 (registry+https://github.com/rust-lang/crates.io-index)" = "5fd343a2466c4603f76f38de264bc0526cffc7fa38ba52fb9f13237eccc1ced2" |
3055 | "checksum bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "aad18937a628ec6abcd26d1489012cc0e18c21798210f491af69ded9b881106d" | 3057 | "checksum bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "aad18937a628ec6abcd26d1489012cc0e18c21798210f491af69ded9b881106d" |
3056 | "checksum bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4efd02e230a02e18f92fc2735f44597385ed02ad8f831e7c1c1156ee5e1ab3a5" | 3058 | "checksum bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4efd02e230a02e18f92fc2735f44597385ed02ad8f831e7c1c1156ee5e1ab3a5" |
3057 | "checksum bitflags 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b3c30d3802dfb7281680d6285f2ccdaa8c2d8fee41f93805dba5c4cf50dc23cf" | 3059 | "checksum bitflags 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b3c30d3802dfb7281680d6285f2ccdaa8c2d8fee41f93805dba5c4cf50dc23cf" |
diff --git a/src/libbacktrace b/src/libbacktrace new file mode 160000 | |||
Subproject f4d02bbdbf8a2c5a31f0801dfef597a86caad9e | |||
diff --git a/src/libstd/Cargo.toml b/src/libstd/Cargo.toml index 1201759885..5a2dce5930 100644 --- a/src/libstd/Cargo.toml +++ b/src/libstd/Cargo.toml | |||
@@ -39,6 +39,7 @@ rustc_msan = { path = "../librustc_msan" } | |||
39 | rustc_tsan = { path = "../librustc_tsan" } | 39 | rustc_tsan = { path = "../librustc_tsan" } |
40 | 40 | ||
41 | [build-dependencies] | 41 | [build-dependencies] |
42 | cc = "1.0" | ||
42 | build_helper = { path = "../build_helper" } | 43 | build_helper = { path = "../build_helper" } |
43 | 44 | ||
44 | [features] | 45 | [features] |
diff --git a/src/libstd/build.rs b/src/libstd/build.rs index 6652ff9820..c34877d369 100644 --- a/src/libstd/build.rs +++ b/src/libstd/build.rs | |||
@@ -11,14 +11,14 @@ | |||
11 | #![deny(warnings)] | 11 | #![deny(warnings)] |
12 | 12 | ||
13 | extern crate build_helper; | 13 | extern crate build_helper; |
14 | extern crate cc; | ||
14 | 15 | ||
16 | use build_helper::native_lib_boilerplate; | ||
15 | use std::env; | 17 | use std::env; |
16 | use std::process::Command; | 18 | use std::fs::File; |
17 | use build_helper::{run, native_lib_boilerplate}; | ||
18 | 19 | ||
19 | fn main() { | 20 | fn main() { |
20 | let target = env::var("TARGET").expect("TARGET was not set"); | 21 | let target = env::var("TARGET").expect("TARGET was not set"); |
21 | let host = env::var("HOST").expect("HOST was not set"); | ||
22 | if cfg!(feature = "backtrace") && | 22 | if cfg!(feature = "backtrace") && |
23 | !target.contains("cloudabi") && | 23 | !target.contains("cloudabi") && |
24 | !target.contains("emscripten") && | 24 | !target.contains("emscripten") && |
@@ -26,7 +26,7 @@ fn main() { | |||
26 | !target.contains("msvc") && | 26 | !target.contains("msvc") && |
27 | !target.contains("wasm32") | 27 | !target.contains("wasm32") |
28 | { | 28 | { |
29 | let _ = build_libbacktrace(&host, &target); | 29 | let _ = build_libbacktrace(&target); |
30 | } | 30 | } |
31 | 31 | ||
32 | if target.contains("linux") { | 32 | if target.contains("linux") { |
@@ -84,26 +84,55 @@ fn main() { | |||
84 | } | 84 | } |
85 | } | 85 | } |
86 | 86 | ||
87 | fn build_libbacktrace(host: &str, target: &str) -> Result<(), ()> { | 87 | fn build_libbacktrace(target: &str) -> Result<(), ()> { |
88 | let native = native_lib_boilerplate("libbacktrace", "libbacktrace", "backtrace", ".libs")?; | 88 | let native = native_lib_boilerplate("libbacktrace", "libbacktrace", "backtrace", "")?; |
89 | let cflags = env::var("CFLAGS").unwrap_or_default() + " -fvisibility=hidden -O2"; | ||
90 | 89 | ||
91 | run(Command::new("sh") | 90 | let mut build = cc::Build::new(); |
92 | .current_dir(&native.out_dir) | 91 | build |
93 | .arg(native.src_dir.join("configure").to_str().unwrap() | 92 | .flag("-fvisibility=hidden") |
94 | .replace("C:\\", "/c/") | 93 | .include("../libbacktrace") |
95 | .replace("\\", "/")) | 94 | .include(&native.out_dir) |
96 | .arg("--with-pic") | 95 | .out_dir(&native.out_dir) |
97 | .arg("--disable-multilib") | 96 | .warnings(false) |
98 | .arg("--disable-shared") | 97 | .file("../libbacktrace/alloc.c") |
99 | .arg("--disable-host-shared") | 98 | .file("../libbacktrace/backtrace.c") |
100 | .arg(format!("--host={}", build_helper::gnu_target(target))) | 99 | .file("../libbacktrace/dwarf.c") |
101 | .arg(format!("--build={}", build_helper::gnu_target(host))) | 100 | .file("../libbacktrace/fileline.c") |
102 | .env("CFLAGS", cflags)); | 101 | .file("../libbacktrace/posix.c") |
102 | .file("../libbacktrace/read.c") | ||
103 | .file("../libbacktrace/sort.c") | ||
104 | .file("../libbacktrace/state.c"); | ||
103 | 105 | ||
104 | run(Command::new(build_helper::make(host)) | 106 | if target.contains("darwin") { |
105 | .current_dir(&native.out_dir) | 107 | build.file("../libbacktrace/macho.c"); |
106 | .arg(format!("INCDIR={}", native.src_dir.display())) | 108 | } else if target.contains("windows") { |
107 | .arg("-j").arg(env::var("NUM_JOBS").expect("NUM_JOBS was not set"))); | 109 | build.file("../libbacktrace/pecoff.c"); |
110 | } else { | ||
111 | build.file("../libbacktrace/elf.c"); | ||
112 | |||
113 | if target.contains("64") { | ||
114 | build.define("BACKTRACE_ELF_SIZE", "64"); | ||
115 | } else { | ||
116 | build.define("BACKTRACE_ELF_SIZE", "32"); | ||
117 | } | ||
118 | } | ||
119 | |||
120 | File::create(native.out_dir.join("backtrace-supported.h")).unwrap(); | ||
121 | build.define("BACKTRACE_SUPPORTED", "1"); | ||
122 | build.define("BACKTRACE_USES_MALLOC", "1"); | ||
123 | build.define("BACKTRACE_SUPPORTS_THREADS", "0"); | ||
124 | build.define("BACKTRACE_SUPPORTS_DATA", "0"); | ||
125 | |||
126 | File::create(native.out_dir.join("config.h")).unwrap(); | ||
127 | if !target.contains("apple-ios") && | ||
128 | !target.contains("solaris") && | ||
129 | !target.contains("redox") && | ||
130 | !target.contains("android") { | ||
131 | build.define("HAVE_DL_ITERATE_PHDR", "1"); | ||
132 | } | ||
133 | build.define("_GNU_SOURCE", "1"); | ||
134 | build.define("_LARGE_FILES", "1"); | ||
135 | |||
136 | build.compile("backtrace"); | ||
108 | Ok(()) | 137 | Ok(()) |
109 | } | 138 | } |
diff --git a/src/tools/tidy/src/deps.rs b/src/tools/tidy/src/deps.rs index a4eb784fa7..cef548b0d9 100644 --- a/src/tools/tidy/src/deps.rs +++ b/src/tools/tidy/src/deps.rs | |||
@@ -98,6 +98,7 @@ static WHITELIST: &'static [Crate] = &[ | |||
98 | Crate("parking_lot"), | 98 | Crate("parking_lot"), |
99 | Crate("parking_lot_core"), | 99 | Crate("parking_lot_core"), |
100 | Crate("polonius-engine"), | 100 | Crate("polonius-engine"), |
101 | Crate("pkg-config"), | ||
101 | Crate("quick-error"), | 102 | Crate("quick-error"), |
102 | Crate("rand"), | 103 | Crate("rand"), |
103 | Crate("redox_syscall"), | 104 | Crate("redox_syscall"), |