File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -13,10 +13,16 @@ fn main() -> Result<(), cc::Error> {
1313 . flag_if_supported ( "-pedantic" ) // Strict compliance when supported
1414 . warnings ( false ) ;
1515
16+ // On 32-bit x86, ensure proper stack alignment for floating-point operations
17+ // See: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=38534
18+ let target_arch = std:: env:: var ( "CARGO_CFG_TARGET_ARCH" ) . unwrap_or_default ( ) ;
19+ if target_arch == "x86" {
20+ build. flag_if_supported ( "-mstackrealign" ) ;
21+ build. flag_if_supported ( "-mpreferred-stack-boundary=4" ) ;
22+ }
23+
1624 if let Err ( e) = build. try_compile ( "simsimd" ) {
1725 print ! ( "cargo:warning=Failed to compile with all SIMD backends..." ) ;
18-
19- let target_arch = std:: env:: var ( "CARGO_CFG_TARGET_ARCH" ) . unwrap_or_default ( ) ;
2026 let flags_to_try = match target_arch. as_str ( ) {
2127 "arm" | "aarch64" => vec ! [
2228 "SIMSIMD_TARGET_SVE2" ,
You can’t perform that action at this time.
0 commit comments