Assembly error on Sun Studio 11 - Solaris 10/amd64
Hi All
I am compiling my source code using cc. My cc version is
cc: Sun C 5.8 2005/10/13
I am using Sun Studio 11 and Solaris 10 on amd64 for my build.
I am getting following Assemply errors when compiling my code.
cc -xarch=amd64 -Kpic gptas.c
Assembler:
"/tmp/yabeAAALdaqGz", line 31 : Illegal mnemonic
"/tmp/yabeAAALdaqGz", line 34 : Syntax error
"/tmp/yabeAAALdaqGz", line 37 : Syntax error
"/tmp/yabeAAALdaqGz", line 50 : Illegal mnemonic
Failure in /opt/ss11/SUNWspro/prod/bin/fbe, status = 0x7f00
Fatal Error exec'ing /opt/ss11/SUNWspro/prod/bin/fbe
cc: acomp failed for gptas.c
The c code which I'm trying to compile:
/*ARGSUSED*/
int
#if defined(__STDC__) || defined(__cplusplus)
_gp_tas(unsigned *x, short flag)
#else
_gp_tas(x,flag)
unsigned *x;
short flag;
#endif
{
#ifdef __STDC__
volatile int r; /* volatile so optimizers won't get
* rid of variable - some assembly code
* depends on offsets with this on
* the stack.
*/
#else
int r; /* var to return explicitly */
#endif
r = 0; /* always set return to 0*/
asm("movl$1,%eax");/* this 1 inworking reg will set *x */
asm("pushl%ebx"); /* save the register; eax already saved */
asm("movl8(%ebp),%ebx"); /* move the address of x */
asm("xchg%eax,(%ebx)"); /* atomic swap a one with *x */
asm("cmp$0,%eax");/* test what was in *x */
asm("jnz.A9999");/* jump if *x was already set */
r = 1; /* indicate set occurred */
asm(".A9999:");
asm("popl%ebx"); /* restore the register */
return(r);
}
Can someone let me know if this is a Compiler issue or it has something to do with my code .
I'll Appreciate any help on this.
Thanks in Advance
Somak

