On Thu, Feb 13, 2025 at 05:41:12PM +0100, Samuel Thibault wrote:
> Simon McVittie, le jeu. 13 févr. 2025 16:32:30 +0000, a ecrit:
> > The options as I see them, *including* the options that I would personally
> > prefer to rule out, are:
> > 
> > - Status quo: don't change anything. As Fabian says, Rust code on i386
> >   will sometimes be miscompiled and might crash.
> > 
> > - Raise baseline to i686+SSE2+MMX and make gcc require/assume this
> > 
> > - Raise "official" baseline to i686+SSE2+MMX, leave gcc producing
> >   code that would have worked with the previous baseline by default,
> >   but rustc/LLVM may require/assume i686+SSE2+MMX
> 
> Are rustc and LLVM necessarily coupled? AIUI the rustc baseline is
> configured in rustc itself, in
> ./compiler/rustc_target/src/spec/targets/i686_unknown_linux_gnu.rs :
> 
>     base.cpu = "pentiumpro".into();
> 
> vs
> 
>     base.cpu = "pentium4".into();
> 
> So we could raise the baseline only in rustc.

rustc uses LLVM as its backend compiler, and LLVM on its own is affected
by the same issue as LLVM internally assumes Pentium 4 semantics for
i686 targets when it does its optimization passes[0]. LLVM in Debian
carries a similar patch downgrading the definition of its i686
targets[1]:

-    // Fallback to p4.
-    return "pentium4";
+    // Fallback to i686.
+    return "i686";

it just downgrades further (to the pre-bookworm baseline, and not the
bookworm and later one).

0: https://github.com/llvm/llvm-project/issues/89885
1: 
https://salsa.debian.org/pkg-llvm-team/llvm-toolchain/-/blob/19/debian/patches/clang-baseline-fix-i386.patch

Reply via email to