Re: [PATCH] x86/build/64: Prevent native builds from generating APX instructions

From: Miguel Ojeda

Date: Wed Jul 15 2026 - 06:35:46 EST


On Wed, Jul 15, 2026 at 12:15 AM Chang S. Bae <chang.seok.bae@xxxxxxxxx> wrote:
>
> JSON avoids the warning but Rust versions prior to 1.93 instead
> produce another noise:
>
> '-apxf' is not a recognized feature for this target ...

I think that warning may be coming from LLVM, not Rust, so it may
depend not on the Rust version, but on the LLVM backend being used
(Rust compilers support several major LLVM versions).

So I would recommend double-checking that -- and if so, perhaps you
may need to restrict the LLVM backend version. In case you need them,
we have nowadays e.g.

CONFIG_RUSTC_LLVM_VERSION
CONFIG_RUSTC_LLVM_MAJOR_VERSION

Also, from that
https://github.com/intel/apx/blob/study_rust-apxf/study_rust-apxf.md,
I notice you checked object files, which is a good check, but what I
meant is to check the LLVM module attributes in the LLVM IR emitted
from the Rust compiler.

For instance, if I do:

https://godbolt.org/z/sMaajjYao

I see:

+egpr,+push2pop2,+ppx,+ndd,+ccmp,+cf,+nf,+zu

being added to the LLVM module attributes when I pass a `+apxf`.

Also, I saw in your file:

"The generated `rust/core.o` object was selected as the insepction target
because it appears to represent the core Rust support built into
the kernel."

To clarify, that object file is "just" the standard library. Which is
definitely a good target to inspect, but since you scripted this
anyway, I would suggest checking others. In fact, you could even
inspect all and filter them out by the language DWARF tag. Or perhaps
you can just do it for every single object, since the C ones are
expected to behave the same, no?

I hope that helps!

> Indeed. This is very helpful!

You're welcome!

Cheers,
Miguel