help-gplusplus
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

problem with -fPIC and __asm__


From: Whisonant, Timothy S
Subject: problem with -fPIC and __asm__
Date: Wed, 31 Jan 2001 05:46:16 -0800

Hi,
        I'm having the following strange problem
with gcc 2.96 on RedHat 7, and I hope someone can
help me out.

I'm trying to compile some C code to place in a
shared library file. When issuing the following
gcc command on one of the source files:

gcc -c -fPIC -o cpuapi.o cpuapi.c

gcc complains:

cpuapi.c: In function `cpuid':
cpuapi.c:199: fixed or forbidden register 3 (bx) was spilled for class BREG.
This may be due to a compiler bug or to impossible asm
statements or clauses.

Here, cpuid is the following function from
asm/processor.h:

void cpuid(int op, int *eax, int *ebx, int *ecx, int *edx)
{
    __asm__("cpuid"
        : "=a" (*eax),
          "=b" (*ebx),
          "=c" (*ecx),
          "=d" (*edx)
        : "a" (op)
        : "cc");
}

I've tried all sorts of things to remedy this, but the only
thing that works is removing -fPIC from the compile options.
This is unacceptable, though, because I need to generate
position independent code for the shared library I'm trying
to create!

Any help will be greatly appreciated.

Tim Whisonant
timothy.s.whisonant@intel.com




reply via email to

[Prev in Thread] Current Thread [Next in Thread]