I have a primitive understanding of how the linker does dead-code elimination of unused functions and data segments. If you use the proper compiler and linker flags it puts each function and data member into it's own section, then when the linker goes to link them it will see that, if not referenced directly, nothing links into that section and then it will not link that section into the final elf.
I'm trying to reconcile how that works with function pointers. You could, for example, have a function pointer whose value is based on user input. Probably not a safe thing to do, but how would the compiler and linker handle that?