Please try the attached patch.

On Fri, Jul 02, 2004 at 12:35:20PM +0100, James Vanns wrote:
> All,
> 
> When trying to compile integer.cpp with the following:
> 
> g++ -pipe -msse2 -march=i386 -O1 -fPIC -c integer.cpp
> 
> I get the error:
> 
> integer.cpp: In function `void CryptoPP::CpuId(unsigned int, word32*)':
> integer.cpp:877: error: can't find a register in class `BREG' while
> reloading
>    `asm'
> 
> Now, I know it's because of fPIC but I'd like to try and build this as a
> shared library. Anyone know of any workarounds for this? The code g++ is
> complaining about is:
> 
> __asm__
> (
>    "cpuid"
>    : "=a" (output[0]), "=b" (output[1]), "=c" (output[2]), "=d"
> (output[3])
>    : "a" (input)
> );
> 
> I'm afraid I know next to nothing about embedded/inline ASM!
> 
> Cheers
> 
> Jim Vanns
> 
> -- 
> James Vanns BSc (Hons) MCP
> Senior Software Engineer (Linux / C & C++)
> Canterbury Christ Church University College
> Public Key: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x24045370
> 
Index: integer.cpp
===================================================================
RCS file: /cvsroot/cryptopp/c5/integer.cpp,v
retrieving revision 1.23
diff -c -r1.23 integer.cpp
*** integer.cpp 19 Jun 2004 11:00:52 -0000      1.23
--- integer.cpp 3 Jul 2004 02:00:24 -0000
***************
*** 876,883 ****
  #ifdef __GNUC__
        __asm__
        (
!               "cpuid"
!               : "=a" (output[0]), "=b" (output[1]), "=c" (output[2]), "=d" 
(output[3])
                : "a" (input)
        );
  #else
--- 876,883 ----
  #ifdef __GNUC__
        __asm__
        (
!               "push %%ebx; cpuid; mov %%ebx, %%edi; pop %%ebx"
!               : "=a" (output[0]), "=D" (output[1]), "=c" (output[2]), "=d" 
(output[3])
                : "a" (input)
        );
  #else

Reply via email to