Why do we need -rdynamic option in gcc? [duplicate]

那年仲夏 提交于 2019-12-25 01:36:02

问题


By default all symbols are exported to dynamic table, so why would we use -rdynamic flag? Even if we hide some symbols via attributes/-fvisibility=hidden - -rdynamic doesn't change result, it doesn't unhide previously hidden symbols. So what's the point in it?


回答1:


Symbols are only exported by default from shared libraries. -rdynamic tells linker to do the same for executables. Normally that's a bad idea but sometimes you want to provide APIs for dynamically loaded plugins and then this comes handy (even though one much better off using explicit export file).



来源:https://stackoverflow.com/questions/50418941/why-do-we-need-rdynamic-option-in-gcc

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!