http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54419

--- Comment #26 from Jack Howarth <howarth at nitro dot med.uc.edu> 2012-09-04 
16:37:07 UTC ---
(In reply to comment #23)
> Why do you talk about clang?  This has nothing to do with it.  And, there is
> already runtime check for whether RDRAND can be used in random.cc (though,
> apparently insufficient for i?86 - it should use either __get_cpuid, or
> __get_cpuid_max before __cpuid).  Not sure if on x86_64 it is guaranteed that
> max basic level is always >= 1, if not, it also needs to test __get_cpuid_max.

I mention clang because it is the system compiler on both Lion and Mountain
Lion
as of Xcode 4.4. The Apple clang 4.0 compiler defaults to its integrated
assembler
such that the simple test case...


int
main ()
{
  asm("rdrand %eax");
  return 0;
}

is compiled without errors into the assembly....


        .section        __TEXT,__text,regular,pure_instructions
        .globl  _main
        .align  4, 0x90
_main:                                  ## @main
        .cfi_startproc
## BB#0:
        pushq   %rbp
Ltmp2:
        .cfi_def_cfa_offset 16
Ltmp3:
        .cfi_offset %rbp, -16
        movq    %rsp, %rbp
Ltmp4:
        .cfi_def_cfa_register %rbp
        movl    $0, %eax
        movl    $0, -4(%rbp)
        ## InlineAsm Start
        rdrand %eax
        ## InlineAsm End
        popq    %rbp
        ret
        .cfi_endproc


.subsections_via_symbols

This leaves config.log with ac_cv_x86_rdrand=yes which fails later in the
bootstrap when the newly built FSF gcc compiler is used and the legacy system
assembler is used.

Reply via email to