[botan-devel] rdrand unknown on older gcc

Jack Lloyd lloyd at randombit.net
Mon May 7 14:33:22 EDT 2012

On Mon, May 07, 2012 at 07:49:14PM +0200, Markus Wanner wrote:
> Hi,
> just as a heads-up: to be able to compile botan (rev 98e7cfc5..) I had
> to disable the rdrand module, because gcc 4.4.7 doesn't know that asm
> instruction, yet (nor the intrinsic method _rdrand32_step). I've been
> unable to quickly figure out what gcc version it got introduced.

It's probably a binutils issue actually since for an inline asm GCC
just passes it through to the .s output. Unfortunately that makes it
even more difficult to check on at compile time. It looks like the
intrinsic support was added in GCC 4.6, fwiw. I'm not sure about the
binutils side.

The real solution is to use .byte to emit the opcode directly. Doesn't
play as nicely with the register allocator as we have to hardcode the
destination register instead of using whatever is free, but works even
on old versions. Try rev 2742a02a7e794679b7bfc16fd5f2e5d84efc0ec3,
just pushed out, and see if it helps.


More information about the botan-devel mailing list