From 6eda7ff2a78a77f3225c6c19b9474baf4cbed97f Mon Sep 17 00:00:00 2001 From: renoseven Date: Tue, 12 Aug 2025 17:18:26 +0800 Subject: [PATCH] upatch-helper: stop compiler replacing atomic ops with function calls on aarch64 Signed-off-by: renoseven --- upatch-helper/src/main.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/upatch-helper/src/main.rs b/upatch-helper/src/main.rs index 7c7b2b8b..36eb3b01 100644 --- a/upatch-helper/src/main.rs +++ b/upatch-helper/src/main.rs @@ -66,6 +66,16 @@ const COMPILE_OPTIONS_CLANG: &[&str] = &[ const UPATCH_ID_PREFIX: &str = ".upatch_"; +#[cfg(target_arch = "aarch64")] +fn arch_specific_args() -> &'static [&'static str] { + &["-mno-outline-atomics"] +} + +#[cfg(not(any(target_arch = "aarch64")))] +fn arch_specific_args() -> &'static [&'static str] { + &[] +} + #[inline(always)] fn is_compilation(args: &[OsString]) -> bool { /* check exclude flags */ @@ -167,6 +177,7 @@ fn add_compile_options(command: &mut Command) { }; let assembler_arg = format!("-Wa,--defsym,{}{}=0", UPATCH_ID_PREFIX, Uuid::new_v4()); + command.args(self::arch_specific_args()); command.args(compiler_args); command.arg(assembler_arg); } -- Gitee