TCC always uses %rbp frames, so we can use that one.
Unified · Split
| @@ -216,6 +216,14 @@ BOUND_PTR_INDIR(16) · 215 unmodified lines | ||
| 216 | 216 | __asm__ __volatile__ ("movl %%ebp,%0" :"=g" (fp1));\ |
| 217 | 217 | fp = fp1[0];\ |
| 218 | 218 | } |
| 219 | +#elif defined(__x86_64__) | |
| 220 | +/* TCC always creates %rbp frames also on x86_64, so use them. */ | |
| 221 | +#define GET_CALLER_FP(fp)\ | |
| 222 | +{\ | |
| 223 | + unsigned long *fp1;\ | |
| 224 | + __asm__ __volatile__ ("movq %%rbp,%0" :"=g" (fp1));\ | |
| 225 | + fp = fp1[0];\ | |
| 226 | +} | |
| 219 | 227 | #else |
| 220 | 228 | #error put code to extract the calling frame pointer |
| 221 | 229 | #endif |