Skip to content

bootstrap should set optimization level when calculating cflags #48906

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

Closed
comex opened this issue Mar 10, 2018 · 0 comments
Closed

bootstrap should set optimization level when calculating cflags #48906

comex opened this issue Mar 10, 2018 · 0 comments
Labels
C-enhancement Category: An issue proposing an enhancement or a PR with one. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)

Comments

@comex
Copy link
Contributor

comex commented Mar 10, 2018

bootstrap/builder.rs uses cc-rs to get a list of cflags for the target, which it then passes to cargo build as CFLAGS_<target>. As of rust-lang/cc-rs#294, the flags can depend on the optimization level: on iOS, with optimization disabled it passes -fembed-bitcode -fembed-bitcode-marker, but with optimization enabled it passes only -fembed-bitcode. However, bootstrap seems to always pass -fembed-bitcode-marker.

Note that some of the crates in the build, such as libcompiler_builtins and libbacktrace, use cc-rs themselves, causing a second set of cflags to be appended to the cc command line, identical except for respecting the optimization level. This seems odd, although it doesn't seem to cause any problems in itself.

Example build log:

OPT_LEVEL = Some("2")
TARGET = Some("aarch64-apple-ios")
CC_aarch64-apple-ios = Some("cc")
CFLAGS_aarch64-apple-ios = Some("-fPIC -arch arm64
-miphoneos-version-min=7.0 -isysroot
/Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.3.sdk
-fembed-bitcode -fembed-bitcode-marker")
Detecting iOS SDK path for iphoneos
running: "cc" "-O2" "-fPIC" "-fPIC" "-arch" "arm64"
"-miphoneos-version-min=7.0" "-isysroot"
"/Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.3.sdk"
"-fembed-bitcode" "-fembed-bitcode-marker" "-arch" "arm64"
"-miphoneos-version-min=7.0" "-isysroot"
"/Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.3.sdk"
"-fembed-bitcode" "-fno-builtin" "-fvisibility=hidden" "-ffreestanding"
"-fomit-frame-pointer" "-DVISIBILITY_HIDDEN" "-o"
"/tmp/build/x86_64-apple-darwin/stage2-std/aarch64-apple-ios/release/build/compiler_builtins-d5d18ec9ecb6ca67/out/../../libcompiler_builtins/compiler-rt/lib/builtins/absvdi2.o"
"-c" "../../libcompiler_builtins/compiler-rt/lib/builtins/absvdi2.c"
@kennytm kennytm added C-enhancement Category: An issue proposing an enhancement or a PR with one. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) labels Mar 10, 2018
@bors bors closed this as completed in 1999a3f Mar 16, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-enhancement Category: An issue proposing an enhancement or a PR with one. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)
Projects
None yet
Development

No branches or pull requests

2 participants