Open vfdff opened 2 weeks ago
test: https://gcc.godbolt.org/z/e1c1qMTTM
void _mcount(uint64_t caller_ra){ uint64_t rbp=0; uint64_t rsp=0; __asm__ __volatile__("mov x0, fp\n" "mov %1, sp \n" :"=g"(rbp),"=g"(rsp) :); printf("rbp = 0x%llx , rsp=0x%llx\n" , rbp , rsp); }
I except the register value sp will be saved in local variable rsp. But it is only accept by gcc
gcc -c -o testhello.o testhello.c -pg -g
<source>:9:27: error: invalid operand for instruction 9 | "mov %1, sp \n"
This looks like a duplicate of #20571.
test: https://gcc.godbolt.org/z/e1c1qMTTM
I except the register value sp will be saved in local variable rsp. But it is only accept by gcc