| 1 |
/* |
| 2 |
* This file is used to test dsymutil support for call site entries with tail |
| 3 |
* calls (DW_AT_call_pc). |
| 4 |
* |
| 5 |
* Instructions for regenerating binaries (on Darwin/x86_64): |
| 6 |
* |
| 7 |
* 1. Copy the source to a top-level directory to work around having absolute |
| 8 |
* paths in the symtab's OSO entries. |
| 9 |
* |
| 10 |
* mkdir -p /Inputs/ && cp tail-call.c /Inputs && cd /Inputs |
| 11 |
* |
| 12 |
* 2. Compile with call site info enabled. -O2 is used to get tail call |
| 13 |
* promotion. |
| 14 |
* |
| 15 |
* clang -g -O2 tail-call.c -c -o tail-call.macho.x86_64.o |
| 16 |
* clang tail-call.macho.x86_64.o -o tail-call.macho.x86_64 |
| 17 |
* |
| 18 |
* 3. Copy the binaries back into the repo's Inputs directory. You'll need |
| 19 |
* -oso-prepend-path=%p to link. |
| 20 |
*/ |
| 21 |
|
| 22 |
volatile int x; |
| 23 |
|
| 24 |
__attribute__((disable_tail_calls, noinline)) void func2() { x++; } |
| 25 |
|
| 26 |
__attribute__((noinline)) void func1() { func2(); /* tail */ } |
| 27 |
|
| 28 |
__attribute__((disable_tail_calls)) int main() { func1(); /* regular */ } |