- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我最近在 GNU ld 中发现了链接器选项“-Bsymbolic-functions”:
-Bsymbolic
When creating a shared library, bind references to global symbols to the
definition within the shared library, if any. Normally, it is possible
for a program linked against a shared library to override the definition
within the shared library.
This option is only meaningful on ELF platforms which support shared libraries.
-Bsymbolic-functions
When creating a shared library, bind references to global function symbols
to the definition within the shared library, if any.
This option is only meaningful on ELF platforms which support shared libraries.
这似乎是 GCC 选项 -fvisibility=hidden
的反面,因为它不是阻止将引用的函数导出到其他共享对象,而是阻止库内部对该函数的引用避免绑定(bind)到不同共享对象的导出函数。我告诉自己,-Bsymbolic-functions
将阻止为函数创建 PLT 条目,这是一个很好的副作用。
但我想知道是否可以对此进行更细粒度的控制,例如覆盖库的各个函数定义的 -Bsymbolic
。
我应该注意使用 -Bsymbolic-functions
的任何陷阱吗?我打算只使用它,因为我认为 -Bsymbolic 会中断异常(我认为它会使对 typeinfo 对象的引用不统一)。
谢谢!
最佳答案
回答我自己的问题,因为我刚刚为此获得了风滚草徽章......我随后发现了
But I was wondering whether there is perhaps a finer-grained control over this, like overwriting
-Bsymbolic
for individual function definitions of a library.
是的,有一个选项--dynamic-list
可以做到这一点
Should I be aware of any pitfalls of using
-Bsymbolic-functions
? I plan to only use that, because the -Bsymbolic will break exceptions, I think (it will make it so that references to typeinfo objects are not unified, I think).
我仔细看了下,好像没有什么问题。 libstdc++ 库显然做到了这一点,或者至少考虑过它,他们只需要添加 --dynamic-list-cpp-new
即可保持 operator new
统一(以防止程序中混合多个分配器/解除分配器的问题,但我认为此类程序无论如何都会被破坏)。 Ubuntu使用它或者默认使用它,似乎它会导致与某些软件包发生冲突。但总的来说,我期望它应该工作得很好。
关于linker - 使用 -Bsymbolic-functions 有缺点吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7216973/
我在共享库中替换了 operator new 和 operator delete。我希望当我在这个共享库上执行 dlopen 替换共享库中的 operator new 和 operator delet
我最近在 GNU ld 中发现了链接器选项“-Bsymbolic-functions”: -Bsymbolic When creating a shared library, bind refer
我相信“-Bsymbolic”选项在共享对象的 ELF 动态符号表中添加了一个标志。 有没有什么方法可以使用像 objcopy 这样的工具来删除这个标志,让它表现得像一个没有“-Bsymbolic”标
我正在尝试构建 http://github.com/ndevilla/iniparser在 OSX 上,但得到: ~/ make compiling src/iniparser.c ... compi
我是一名优秀的程序员,十分优秀!