From 9404e9f892eda018634ed35c67c7d92b42f0324d Mon Sep 17 00:00:00 2001 From: bjorn3 <17426603+bjorn3@users.noreply.github.com> Date: Thu, 25 Jan 2024 11:50:47 +0100 Subject: [PATCH] Mark the sections used by alternative!() as allocated This prevents the linker from discarding any function which uses the alternative!() macro which would result in runtime relocation crashing. --- src/arch/x86_64/macros.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/arch/x86_64/macros.rs b/src/arch/x86_64/macros.rs index 936e1a205c..5b165f9001 100644 --- a/src/arch/x86_64/macros.rs +++ b/src/arch/x86_64/macros.rs @@ -72,16 +72,16 @@ macro_rules! alternative2( macro_rules! alternative_auto( ($first_digit:literal, $feature:literal, [$($then:expr),*]) => { concat!( ".if ", expand_bool!(cfg!(cpu_feature_auto = $feature)), " - .pushsection .altcode.", $feature, " + .pushsection .altcode.", $feature, ",\"a\" ", $first_digit, "0: ", $($then,)* " ", $first_digit, "1: .popsection - .pushsection .altfeatures.", $feature, " + .pushsection .altfeatures.", $feature, ",\"a\" 70: .ascii \"", $feature, "\" 71: .popsection - .pushsection .altrelocs.", $feature, " + .pushsection .altrelocs.", $feature, ",\"a\" .quad 70b .quad 71b - 70b .quad 40b