Ajay Garg
Ajay Garg

Reputation: 99

Unable to pass input-argument to assembly-statement

I got stuck when porting our codebase from GCC => LLVM/CLANG. After much attempts, I have narrowed the problem to a trivial reproducer. Surprisingly, I can't even seem to make things work with GCC :(

Following is the (trivial) code :

ajay.c

#define TEST_VALUE 0x1234

__asm__("mov r3, %0" : : "r" (TEST_VALUE));

Compiling it, gives the following :

[ajay@dev-ajay-1 simple]$ gcc -c ajay.c
ajay.c:3:21: error: expected ‘)’ before ‘:’ token
 __asm__("mov r3, %0" : : "r" (TEST_VALUE));
        ~            ^~
                     )
[ajay@dev-ajay-1 simple]$

No matter what permutations I try, I always get the missing ) error.

Will be grateful for pointers on what stupidity am I making.

Thanks and Regards, Ajay

Upvotes: 1

Views: 33

Answers (0)

Related Questions