私は最近、リンカオプションGNU ldの中に「-Bsymbolic-機能」を発見:-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
の逆のようだ、という点ではなく、他に参照される関数の輸出を防止その関数へのライブラリー内部参照が、別の共用オブジェクトのエクスポートされた関数にバインドされないようにします。私は-Bsymbolic-functions
が機能のためのPLTエントリーの作成を妨げることを自分自身に知らせました。これは素晴らしい副作用です。
しかし、私は、ライブラリーの個々の関数定義のための
-Bsymbolic
を上書きするように、おそらくこれ以上の細かな制御があるかどうかを疑問に思いました。-Bsymbolic-functions
の落とし穴に気づくべきですか?-Bsymbolic
が例外を壊すので、私はそれを使用する予定です(typeinfoオブジェクトへの参照が統一されていないようにすると思います)。
ありがとう!
あなたは私にとってリンカ地獄の時間に栄光のある、幸せな解決でした。私はちょっとあなたを愛しています。 –