From cccd970829624763587ced01c013d0f6f24e7fab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Kr=C3=B6ning?= Date: Mon, 4 Dec 2023 15:49:59 +0100 Subject: [PATCH] fix(build.rs): always compile staticlib with release profile --- rftrace/build.rs | 8 ++------ rftrace/staticlib/Cargo.nottoml | 3 --- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/rftrace/build.rs b/rftrace/build.rs index 9f6cdc9..cb6b3b0 100755 --- a/rftrace/build.rs +++ b/rftrace/build.rs @@ -31,7 +31,6 @@ fn build_backend() { // Get envvars from cargo let out_dir = env::var("OUT_DIR").unwrap(); let full_target_dir = format!("{}/target_static", out_dir); - let profile = env::var("PROFILE").expect("PROFILE was not set"); let target = "x86_64-unknown-none"; @@ -71,10 +70,7 @@ fn build_backend() { "-Zbuild-std-features=compiler-builtins-mem", ]); - // Compile staticlib as release if included in release build. - if profile == "release" { - cmd.arg("--release"); - } + cmd.arg("--release"); // Ensure rustflags does NOT contain instrument-mcount! let rustflags = env::var("RUSTFLAGS").unwrap_or_default(); @@ -96,7 +92,7 @@ fn build_backend() { assert!(status.success(), "Unable to build tracer's static lib!"); println!("Sub-cargo successful!"); - let dist_dir = format!("{}/{}/{}", &full_target_dir, &target, &profile); + let dist_dir = format!("{}/{}/release", &full_target_dir, &target); retain_symbols( Path::new(&format!("{}/librftrace_backend.a", &dist_dir)), diff --git a/rftrace/staticlib/Cargo.nottoml b/rftrace/staticlib/Cargo.nottoml index 2816c2f..713af09 100755 --- a/rftrace/staticlib/Cargo.nottoml +++ b/rftrace/staticlib/Cargo.nottoml @@ -17,9 +17,6 @@ path = "../src/lib.rs" [profile.dev] panic = "abort" - # we have to build with at least opt-level 1. Might aswell do always 3, since mcount() is in the hotpath! -opt-level = 3 [profile.release] panic = "abort" -opt-level = 3 \ No newline at end of file