Skip to content

Commit 6b2faa5

Browse files
committed
Auto merge of #42433 - marco-c:profiling, r=alexcrichton
Build instruction profiler runtime as part of compiler-rt r? @alexcrichton This is #38608 with some fixes. Still missing: - [x] testing with profiler enabled on some builders (on which ones? Should I add the option to some of the already existing configurations, or create a new configuration?); - [x] enabling distribution (on which builders?); - [x] documentation.
2 parents 03abb1b + 5c084fd commit 6b2faa5

File tree

38 files changed

+319
-17
lines changed

38 files changed

+319
-17
lines changed

.travis.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ matrix:
5454
# version that we're using, 8.2, cannot compile LLVM for OSX 10.7.
5555
- env: >
5656
RUST_CHECK_TARGET=check
57-
RUST_CONFIGURE_ARGS="--build=x86_64-apple-darwin --enable-sanitizers"
57+
RUST_CONFIGURE_ARGS="--build=x86_64-apple-darwin --enable-sanitizers --enable-profiler"
5858
SRC=.
5959
RUSTC_RETRY_LINKER_ON_SEGFAULT=1
6060
SCCACHE_ERROR_LOG=/tmp/sccache.log
@@ -87,7 +87,7 @@ matrix:
8787
# OSX 10.7 and `xcode7` is the latest Xcode able to compile LLVM for 10.7.
8888
- env: >
8989
RUST_CHECK_TARGET=dist
90-
RUST_CONFIGURE_ARGS="--build=i686-apple-darwin --enable-extended"
90+
RUST_CONFIGURE_ARGS="--build=i686-apple-darwin --enable-extended --enable-profiler"
9191
SRC=.
9292
DEPLOY=1
9393
RUSTC_RETRY_LINKER_ON_SEGFAULT=1
@@ -101,7 +101,7 @@ matrix:
101101
- *osx_install_sccache
102102
- env: >
103103
RUST_CHECK_TARGET=dist
104-
RUST_CONFIGURE_ARGS="--target=aarch64-apple-ios,armv7-apple-ios,armv7s-apple-ios,i386-apple-ios,x86_64-apple-ios --enable-extended --enable-sanitizers"
104+
RUST_CONFIGURE_ARGS="--target=aarch64-apple-ios,armv7-apple-ios,armv7s-apple-ios,i386-apple-ios,x86_64-apple-ios --enable-extended --enable-sanitizers --enable-profiler"
105105
SRC=.
106106
DEPLOY=1
107107
RUSTC_RETRY_LINKER_ON_SEGFAULT=1

appveyor.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ environment:
77
matrix:
88
# 32/64 bit MSVC tests
99
- MSYS_BITS: 64
10-
RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-msvc
10+
RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-msvc --enable-profiler
1111
SCRIPT: python x.py test
1212
- MSYS_BITS: 32
1313
RUST_CONFIGURE_ARGS: --build=i686-pc-windows-msvc --target=i586-pc-windows-msvc
@@ -48,12 +48,14 @@ environment:
4848
- RUST_CONFIGURE_ARGS: >
4949
--build=x86_64-pc-windows-msvc
5050
--enable-extended
51+
--enable-profiler
5152
SCRIPT: python x.py dist
5253
DEPLOY: 1
5354
- RUST_CONFIGURE_ARGS: >
5455
--build=i686-pc-windows-msvc
5556
--target=i586-pc-windows-msvc
5657
--enable-extended
58+
--enable-profiler
5759
SCRIPT: python x.py dist
5860
DEPLOY: 1
5961
- MSYS_BITS: 32

configure

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -452,6 +452,7 @@ opt vendor 0 "enable usage of vendored Rust crates"
452452
opt sanitizers 0 "build the sanitizer runtimes (asan, lsan, msan, tsan)"
453453
opt dist-src 1 "when building tarballs enables building a source tarball"
454454
opt cargo-openssl-static 0 "static openssl in cargo"
455+
opt profiler 0 "build the profiler runtime"
455456

456457
# Optimization and debugging options. These may be overridden by the release channel, etc.
457458
opt_nosave optimize 1 "build optimized rust code"

src/Cargo.lock

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/bootstrap/check.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,10 @@ pub fn compiletest(build: &Build,
299299
cmd.env("SANITIZER_SUPPORT", "1");
300300
}
301301

302+
if build.config.profiler {
303+
cmd.env("PROFILER_SUPPORT", "1");
304+
}
305+
302306
cmd.arg("--adb-path").arg("adb");
303307
cmd.arg("--adb-test-dir").arg(ADB_TEST_DIR);
304308
if target.contains("android") {

src/bootstrap/config.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ pub struct Config {
5050
pub full_bootstrap: bool,
5151
pub extended: bool,
5252
pub sanitizers: bool,
53+
pub profiler: bool,
5354

5455
// llvm codegen options
5556
pub llvm_assertions: bool,
@@ -162,6 +163,7 @@ struct Build {
162163
extended: Option<bool>,
163164
verbose: Option<usize>,
164165
sanitizers: Option<bool>,
166+
profiler: Option<bool>,
165167
openssl_static: Option<bool>,
166168
}
167169

@@ -318,6 +320,7 @@ impl Config {
318320
set(&mut config.extended, build.extended);
319321
set(&mut config.verbose, build.verbose);
320322
set(&mut config.sanitizers, build.sanitizers);
323+
set(&mut config.profiler, build.profiler);
321324
set(&mut config.openssl_static, build.openssl_static);
322325

323326
if let Some(ref install) = toml.install {
@@ -471,6 +474,7 @@ impl Config {
471474
("FULL_BOOTSTRAP", self.full_bootstrap),
472475
("EXTENDED", self.extended),
473476
("SANITIZERS", self.sanitizers),
477+
("PROFILER", self.profiler),
474478
("DIST_SRC", self.rust_dist_src),
475479
("CARGO_OPENSSL_STATIC", self.openssl_static),
476480
}

src/bootstrap/config.toml.example

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,9 @@
147147
# Build the sanitizer runtimes
148148
#sanitizers = false
149149

150+
# Build the profiler runtime
151+
#profiler = false
152+
150153
# Indicates whether the OpenSSL linked into Cargo will be statically linked or
151154
# not. If static linkage is specified then the build system will download a
152155
# known-good version of OpenSSL, compile it, and link it to Cargo.

src/bootstrap/dist.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -570,6 +570,7 @@ pub fn rust_src(build: &Build) {
570570
"src/libgetopts",
571571
"src/compiler-rt",
572572
"src/jemalloc",
573+
"src/libprofiler_builtins",
573574
];
574575
let std_src_dirs_exclude = [
575576
"src/compiler-rt/test",

src/bootstrap/lib.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -594,6 +594,9 @@ impl Build {
594594
if self.config.backtrace {
595595
features.push_str(" backtrace");
596596
}
597+
if self.config.profiler {
598+
features.push_str(" profiler");
599+
}
597600
return features
598601
}
599602

src/ci/docker/dist-i686-linux/Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,8 @@ ENV HOSTS=i686-unknown-linux-gnu
9090
ENV RUST_CONFIGURE_ARGS \
9191
--host=$HOSTS \
9292
--enable-extended \
93-
--enable-sanitizers
93+
--enable-sanitizers \
94+
--enable-profiler
9495
ENV SCRIPT python2.7 ../x.py dist --host $HOSTS --target $HOSTS
9596

9697
# This is the only builder which will create source tarballs

0 commit comments

Comments
 (0)