rdrand generated with march=winchip-c6 in systemd-241

Segher Boessenkool segher@kernel.crashing.org
Tue May 7 14:27:00 GMT 2019


On Tue, May 07, 2019 at 08:50:07AM -0400, tedheadster wrote:
>   I compiled systemd-241 and expressly set march=winchip-c6 (an i486
> class cpu). It generated illegal instructions (rdrand) in the code.

But it should not execute it, it is guarded by some cpuid things.

If the assembler does not like the insn, first do (in the same asm) an
assembler pseudo-instruction to select a CPU that does have that insn,
then the rdrand, and then the original CPU again.  Or write the bytes
of the instruction encoding directly.


Segher



More information about the Gcc-help mailing list