Skip to content

Commit

Permalink
rustbuild: Tweak CFLAGS to various libstd pieces
Browse files Browse the repository at this point in the history
* Pass `opt_level(2)` when calculating CFLAGS to get the right flags on iOS
* Unconditionally pass `-O2` when compiling libbacktrace

This should...

Close #48903
Close #48906
  • Loading branch information
alexcrichton committed Mar 13, 2018
1 parent e65547d commit 1999a3f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/bootstrap/cc_detect.rs
Expand Up @@ -77,7 +77,7 @@ pub fn find(build: &mut Build) {
.collect::<HashSet<_>>();
for target in targets.into_iter() {
let mut cfg = cc::Build::new();
cfg.cargo_metadata(false).opt_level(0).warnings(false).debug(false)
cfg.cargo_metadata(false).opt_level(2).warnings(false).debug(false)
.target(&target).host(&build.build);
if target.contains("msvc") {
cfg.static_crt(true);
Expand Down Expand Up @@ -109,7 +109,7 @@ pub fn find(build: &mut Build) {
let hosts = build.hosts.iter().cloned().chain(iter::once(build.build)).collect::<HashSet<_>>();
for host in hosts.into_iter() {
let mut cfg = cc::Build::new();
cfg.cargo_metadata(false).opt_level(0).warnings(false).debug(false).cpp(true)
cfg.cargo_metadata(false).opt_level(2).warnings(false).debug(false).cpp(true)
.target(&host).host(&build.build);
let config = build.config.target_config.get(&host);
if let Some(cxx) = config.and_then(|c| c.cxx.as_ref()) {
Expand Down
2 changes: 1 addition & 1 deletion src/libstd/build.rs
Expand Up @@ -98,7 +98,7 @@ fn build_libbacktrace(host: &str, target: &str) -> Result<(), ()> {
.arg("--disable-host-shared")
.arg(format!("--host={}", build_helper::gnu_target(target)))
.arg(format!("--build={}", build_helper::gnu_target(host)))
.env("CFLAGS", env::var("CFLAGS").unwrap_or_default() + " -fvisibility=hidden"));
.env("CFLAGS", env::var("CFLAGS").unwrap_or_default() + " -fvisibility=hidden -O2"));

run(Command::new(build_helper::make(host))
.current_dir(&native.out_dir)
Expand Down

0 comments on commit 1999a3f

Please sign in to comment.