替换“fvtable-gc”在GCC [英] replacement for "fvtable-gc" in GCC

查看:338
本文介绍了替换“fvtable-gc”在GCC的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

GCCv4.7.1中的'fvtable-gc'选项有什么替代品(它在GCCv3.x中支持)?我想在链接过程中删除未使用的虚拟函数。

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
发出vtables和虚函数引用的特殊重定位链接器可以识别未使用的虚拟函数并清空引用它们的vtable插槽。这对于-ffunction-sections和-Wl,-gc-sections最有用,以便也放弃函数本身。

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.


推荐答案

看起来这个功能太多了,所以几年前已被移除。我不认为有一个等价替换。

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

虽然我没有找到一个官方声明,有几个意见, fvtable-gc 至少在GCC 3.x系列,也许更早。例如(来源:cris.h;声称是GCC的一部分)

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):


...当错误从-fvtable-gc(-fforce- addr在tinfo.cc中导致无效的.vtable_entry asm并且在GCC 3.0-pre中没有任何工作原理)...

... 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) ...

几年后,编译器应该更加先进。也许GCC的整个程序优化器足够聪明,可以检测和消除未使用的虚拟函数,但我不知道。

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.

这篇关于替换“fvtable-gc”在GCC的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆