c++ - Android source code compilation error: impossible constraint in 'asm' -
for project must use inline assembly instructions such rdtsc calculate execution time of android 4.3 c++ instruction in stack. found similar problem in stackoverflow such 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 non of them solve problem have.
i used following code:
{unsigned a, d;asm volatile("rdtsc" : "=a" (a), "=d" (d)); t0 = ((unsigned long)a) | (((unsigned long)d) << 32);} //the c++ statement measure execution time {unsigned a, d;asm volatile("rdtsc" : "=a" (a), "=d" (d)); t1 = ((unsigned long)a) | (((unsigned long)d) << 32);} time = (t1-t0)/2-20;
but i'm getting error message:
error: impossible constraint in 'asm'
my build environment are:
- ubuntu 14.04.5 lts
- android 4.3
- gcc 4.8.5
- g++ 4.8.5
- target: x86_64-linux-gnu
i have tried above code in standalone c program (in same environment) , working fine no problem once embed above code in android source code, error message.
my target:
i'm building image android emulator qemu on x86_64-linux-gnu platform.
Comments
Post a Comment