Create the indirect function table based on symbols rather
than just duplicating the input entries. This has the
effect of de-duplicating the table.
This is a followup to the equivalent change made for globals:
https://reviews.llvm.org/D40859
Parially based on a patch by Nicholas Wilson:
https://reviews.llvm.org/D40845
This function is getting longer. Please consider splitting it into multiple functions in a follow-up patch.