29 lines · cpp
1/*2 * This file is used to test dsymutil support for call site entries with tail3 * 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 absolute8 * paths in the symtab's OSO entries.9 *10 * mkdir -p /Inputs/ && cp tail-call.c /Inputs && cd /Inputs11 *12 * 2. Compile with call site info enabled. -O2 is used to get tail call13 * promotion.14 *15 * clang -g -O2 tail-call.c -c -o tail-call.macho.x86_64.o16 * clang tail-call.macho.x86_64.o -o tail-call.macho.x86_6417 *18 * 3. Copy the binaries back into the repo's Inputs directory. You'll need19 * -oso-prepend-path=%p to link.20 */21 22volatile 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 */ }29