Skip to content

Commit 1999a3f

Browse files
committed
rustbuild: Tweak CFLAGS to various libstd pieces
* 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
1 parent e65547d commit 1999a3f

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/bootstrap/cc_detect.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ pub fn find(build: &mut Build) {
7777
.collect::<HashSet<_>>();
7878
for target in targets.into_iter() {
7979
let mut cfg = cc::Build::new();
80-
cfg.cargo_metadata(false).opt_level(0).warnings(false).debug(false)
80+
cfg.cargo_metadata(false).opt_level(2).warnings(false).debug(false)
8181
.target(&target).host(&build.build);
8282
if target.contains("msvc") {
8383
cfg.static_crt(true);
@@ -109,7 +109,7 @@ pub fn find(build: &mut Build) {
109109
let hosts = build.hosts.iter().cloned().chain(iter::once(build.build)).collect::<HashSet<_>>();
110110
for host in hosts.into_iter() {
111111
let mut cfg = cc::Build::new();
112-
cfg.cargo_metadata(false).opt_level(0).warnings(false).debug(false).cpp(true)
112+
cfg.cargo_metadata(false).opt_level(2).warnings(false).debug(false).cpp(true)
113113
.target(&host).host(&build.build);
114114
let config = build.config.target_config.get(&host);
115115
if let Some(cxx) = config.and_then(|c| c.cxx.as_ref()) {

src/libstd/build.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ fn build_libbacktrace(host: &str, target: &str) -> Result<(), ()> {
9898
.arg("--disable-host-shared")
9999
.arg(format!("--host={}", build_helper::gnu_target(target)))
100100
.arg(format!("--build={}", build_helper::gnu_target(host)))
101-
.env("CFLAGS", env::var("CFLAGS").unwrap_or_default() + " -fvisibility=hidden"));
101+
.env("CFLAGS", env::var("CFLAGS").unwrap_or_default() + " -fvisibility=hidden -O2"));
102102

103103
run(Command::new(build_helper::make(host))
104104
.current_dir(&native.out_dir)

0 commit comments

Comments
 (0)