replacement for "fvtable-gc" in GCC
Asked Answered
V

1

4

Is there any replacement for 'fvtable-gc' options in GCCv4.7.1 (it was supported in GCCv3.x)? I want to remove unused virtual functions during linkage process.

fvtable-gc 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.

Vercelli answered 3/7, 2013 at 10:44 Comment(0)
K
1

Looks like the feature was too buggy, so it has been removed several years ago. I don't think there is an equivalent replacement.

Though I haven't found an official statement, there are several comments that fvtable-gc is broken at least in the GCC 3.x series, maybe earlier. For example (source: cris.h; claiming to be part of GCC):

... When bugs are removed from -fvtable-gc (-fforce-addr causes invalid .vtable_entry asm in tinfo.cc and nothing at all works in GCC 3.0-pre) ...

Today, many years later, the compilers should be far more advanced. Maybe GCC's whole program optimizer is smart enough to detect and eliminate unused virtual functions, but I'm not sure.

Knightly answered 29/1, 2014 at 2:49 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.