• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Inline assembly code error: expression must be absolute ???
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Inline assembly code error: expression must be absolute ???


  • Subject: Re: Inline assembly code error: expression must be absolute ???
  • From: Steve Checkoway <email@hidden>
  • Date: Wed, 25 Jan 2006 04:12:26 -0800


On Jan 25, 2006, at 12:33 AM, rohit dhamija wrote:
unsigned long x, carry;
x = 20;

asm ("li %1,%0" : "=r" (carry) : "r" (x) );    //=======> Error


//asm ("li %0,10" : "=r" (carry)); //=====> this works fine


///////////////////////////

I am moving value of "x" to "carry" but the compiler throws following error:

"Parameter error: expression must be absolute (parameter 2)". But if i specify some values instead of passing x, the instruction works fine.

What can be the issue ? All suggestions/comments are welcome.

li is load immediate which means it must be an immediate value. Try mr (move register) instead.


$ gcc -x c -Wall - <<EOF
> #include <stdio.h>
> int main()
> {
> unsigned long x, carry;
> x = 20;
> asm( "mr %1,%0" : "=r" (carry) : "r" (x) );
> printf( "%lu\n", carry );
> return 0;
> }
> EOF
$ ./a.out
20

- Steve

Attachment: smime.p7s
Description: S/MIME cryptographic signature

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >Inline assembly code error: expression must be absolute ??? (From: rohit dhamija <email@hidden>)

  • Prev by Date: Inline assembly code error: expression must be absolute ???
  • Next by Date: Re: Obtaining an IOSCSIMultimediaCommandsDevice instance
  • Previous by thread: Inline assembly code error: expression must be absolute ???
  • Next by thread: i386 and source releases
  • Index(es):
    • Date
    • Thread