Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

libprofiler_builtins is missing compile-time flags #59531

Closed
michaelwoerister opened this issue Mar 29, 2019 · 3 comments · Fixed by #60402
Closed

libprofiler_builtins is missing compile-time flags #59531

michaelwoerister opened this issue Mar 29, 2019 · 3 comments · Fixed by #60402
Labels
A-runtime Area: std's runtime and "pre-main" init for handling backtraces, unwinds, stack overflows C-bug Category: This is a bug. E-help-wanted Call for participation: Help is requested to fix this issue. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-infra Relevant to the infrastructure team, which will review and decide on the PR/issue.

Comments

@michaelwoerister
Copy link
Member

For example COMPILER_RT_HAS_FCNTL_LCK and COMPILER_RT_HAS_ATOMICS are not being set. Would it be possible to use cmake (i.e. compiler-rt's regular build system) to find out which flags to set?

cc @rust-lang/infra @rust-lang/compiler

@michaelwoerister michaelwoerister added A-runtime Area: std's runtime and "pre-main" init for handling backtraces, unwinds, stack overflows T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. E-help-wanted Call for participation: Help is requested to fix this issue. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-infra Relevant to the infrastructure team, which will review and decide on the PR/issue. C-bug Category: This is a bug. labels Mar 29, 2019
@michaelwoerister
Copy link
Member Author

@alexcrichton I wonder if I can somehow use cfg!(target_has_atomic = "cas") for detecting whether to set the COMPILER_RT_HAS_ATOMICS flags. I guess that executing this in the build script would only tell me about the host platform, right? Is there a way to query rustc's target platform spec?

@alexcrichton
Copy link
Member

If you execute rustc +nightly --print cfg Cargo will use that to set env vars for the build script. When a build script is executed the env vars match the target we're executing the script for, so Cargo should set CARGO_CFG_TARGET_HAS_ATOMIC=cas (IIRC).

Either that should be fine or just simply enabling it via a whitelist of platforms would be fine by me personally

@michaelwoerister
Copy link
Member Author

Indeed: CARGO_CFG_TARGET_HAS_ATOMIC = "16,32,64,8,cas,ptr" ❤️

Centril added a commit to Centril/rust that referenced this issue Apr 30, 2019
…-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 rust-lang#59531.
kennytm added a commit to kennytm/rust that referenced this issue May 2, 2019
…-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 rust-lang#59531.
bors added a commit that referenced this issue May 8, 2019
…lexcrichton

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-runtime Area: std's runtime and "pre-main" init for handling backtraces, unwinds, stack overflows C-bug Category: This is a bug. E-help-wanted Call for participation: Help is requested to fix this issue. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-infra Relevant to the infrastructure team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants