If you want the end of foo(), call foo2(), and within foo2() (anywhere in foo2) call __builtin_return_address, and that will be the address of the end of foo().