c – 替换GCC中的“fvtable-gc”

c – 替换GCC中的“fvtable-gc”,第1张

概述是否有替换GCCv4.7.1中的’fvtable-gc’选项(GCCv3.x支持)?我想在链接过程中删除未使用的虚函数. fvtable-gc Emit special relocations for vtables and virtual function references so that the linker can identify unused virtual functions an 是否有替换GCCv4.7.1中的’fvtable-gc’选项(GCCv3.x支持)?我想在链接过程中删除未使用的虚函数.

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.

解决方法 看起来这个功能太多了,所以它已经在几年前删除了.我认为没有相应的替代品.

虽然我还没有找到官方声明,但有几条评论说fvtable-gc至少在GCC 3.x系列中被打破,可能更早.例如(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) …

多年以后的今天,编译器应该更加先进.也许GCC的整个程序优化器足够聪明,可以检测并消除未使用的虚函数,但我不确定.

总结

以上是内存溢出为你收集整理的c – 替换GCC中的“fvtable-gc”全部内容,希望文章能够帮你解决c – 替换GCC中的“fvtable-gc”所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/langs/1226773.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-06-05
下一篇 2022-06-05

发表评论

登录后才能评论

评论列表(0条)

保存