I recently stumbled on -fvtable-gc
which in gcc 3 did the following:
Emit special relocations for vtables and virtual function references so that the linker can identify unused virtual functions and zero out vtable slots that refer to them. This is most useful with -ffunction-sections and -Wl,--gc-sections, in order to also discard the functions themselves.
This optimization requires GNU as and GNU ld. Not all systems support this option. -Wl,--gc-sections is ignored without -static.
Abstractly, removing unused virtual functions seems pretty good, but it looks like this feature was removed some time back for maintenance reasons. I was wondering if it would be worthwhile re-implementing this for clang. Some things I think would be nice to know are what type of relocation was emitted, and I guess what made the original feature buggy.