From 732fad0593544ed671a60bc85dd9bd39903bbbd5 Mon Sep 17 00:00:00 2001 From: bjorn3 <17426603+bjorn3@users.noreply.github.com> Date: Wed, 24 Jan 2024 14:07:57 +0100 Subject: [PATCH] Fix disabling the self_modifying feature --- build.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/build.rs b/build.rs index 3b68df9eb5..24f48b3730 100644 --- a/build.rs +++ b/build.rs @@ -23,10 +23,16 @@ fn parse_kconfig(arch: &str) -> Option<()> { .as_table() .unwrap(); + let self_modifying = env::var("CARGO_FEATURE_SELF_MODIFYING").is_ok(); + for (name, value) in altfeatures { - let choice = value.as_str().unwrap(); + let mut choice = value.as_str().unwrap(); assert!(matches!(choice, "always" | "never" | "auto")); + if !self_modifying && choice == "auto" { + choice = "never"; + } + println!("cargo:rustc-cfg=cpu_feature_{choice}=\"{name}\""); }