auto-linking for functions

(cherry picked from commit a7ad1efeaf5bf5f54bce53e3e83add1badeda366)