[Bug target/104713] gcc does not reject -march=i686 -fcf-protection

bunk at stusta dot de gcc-bugzilla@gcc.gnu.org
Mon Feb 28 11:42:12 GMT 2022


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104713

--- Comment #4 from Adrian Bunk <bunk at stusta dot de> ---
(In reply to Jakub Jelinek from comment #3)
> Just build for those as -march=i586.

There is no "for those" in Debian.
There is one build of all packages for one i386 Debian release architecture.

Building the Debian i386 architecture with -march=i586 would also remove CMOV
support.

> i686 is what is used as the supported lowest
> common denominator of 32-bit code.

This is not true.

The lowest common denominator of 32-bit x86 code on Linux is -march=i486, since
the 486 is the lowest supported CPU in the kernel.

Distributions usually use various baselines higher than 486 for their 32-bit
x86 ports.
E.g. for distributions dropping support for actual 32-bit hardware (keeping
only multiarch/multilib support), using -march=x86-64 (or whatever higher they
are using for their 64bit x86) might make more sense since it also brings
MMX/SSE/SSE2 which are not in -march=i686 (this also allows using SSE instead
of the x87 FPU with its excess precision oddity).

> preventing -fcf-protection with
> -march=i686 would be a really bad idea, that would basically prevent all of
> CET protection for 32-bit code,

The toolchain emitting instructions not supported by the selected target is
also a really bad idea.

gcc rejecting -fcf-protection for < 686 indicates that this option was not
intended to enable emitting instructions not already supported by the -march
setting.

The proper solution might be a -mmultibyte-nops option?


More information about the Gcc-bugs mailing list