Skip to content

Commit 3f5152e

Browse files
committed
Auto merge of #60402 - michaelwoerister:update-profiler-rt-build, r=alexcrichton
libprofiler_builtins: Set compilation flags more correctly for C code. In particular, set `COMPILER_RT_HAS_FCNTL_LCK` and `COMPILER_RT_HAS_ATOMICS` as appropriate. This should get rid of the various runtime warnings when executing instrumented binaries. The build script is using a heuristic here that hopefully is sufficient for the time being. r? @alexcrichton Fixes #59531.
2 parents e630580 + 0ffc573 commit 3f5152e

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

appveyor.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -158,9 +158,9 @@ install:
158158
# Note that the LLVM installer is an NSIS installer
159159
#
160160
# Original downloaded here came from
161-
# http://releases.llvm.org/7.0.0/LLVM-7.0.0-win64.exe
162-
- if NOT defined MINGW_URL appveyor-retry appveyor DownloadFile https://s3-us-west-1.amazonaws.com/rust-lang-ci2/rust-ci-mirror/LLVM-7.0.0-win64.exe
163-
- if NOT defined MINGW_URL .\LLVM-7.0.0-win64.exe /S /NCRC /D=C:\clang-rust
161+
# http://releases.llvm.org/8.0.0/LLVM-8.0.0-win64.exe
162+
- if NOT defined MINGW_URL appveyor-retry appveyor DownloadFile https://s3-us-west-1.amazonaws.com/rust-lang-ci2/rust-ci-mirror/LLVM-8.0.0-win64.exe
163+
- if NOT defined MINGW_URL .\LLVM-8.0.0-win64.exe /S /NCRC /D=C:\clang-rust
164164
- if NOT defined MINGW_URL set RUST_CONFIGURE_ARGS=%RUST_CONFIGURE_ARGS% --set llvm.clang-cl=C:\clang-rust\bin\clang-cl.exe
165165

166166
# Here we do a pretty heinous thing which is to mangle the MinGW installation

src/libprofiler_builtins/build.rs

+13
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,19 @@ fn main() {
4444
cfg.define("COMPILER_RT_HAS_UNAME", Some("1"));
4545
}
4646

47+
// Assume that the Unixes we are building this for have fnctl() available
48+
if env::var_os("CARGO_CFG_UNIX").is_some() {
49+
cfg.define("COMPILER_RT_HAS_FCNTL_LCK", Some("1"));
50+
}
51+
52+
// This should be a pretty good heuristic for when to set
53+
// COMPILER_RT_HAS_ATOMICS
54+
if env::var_os("CARGO_CFG_TARGET_HAS_ATOMIC").map(|features| {
55+
features.to_string_lossy().to_lowercase().contains("cas")
56+
}).unwrap_or(false) {
57+
cfg.define("COMPILER_RT_HAS_ATOMICS", Some("1"));
58+
}
59+
4760
// The source for `compiler-rt` comes from the `compiler-builtins` crate, so
4861
// load our env var set by cargo to find the source code.
4962
let root = env::var_os("DEP_COMPILER_RT_COMPILER_RT").unwrap();

0 commit comments

Comments
 (0)