[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: stdc++ symbol resolution on Solaris
From: |
Maxim Yegorushkin |
Subject: |
Re: stdc++ symbol resolution on Solaris |
Date: |
Sun, 12 Aug 2007 10:48:01 -0700 |
User-agent: |
G2/1.0 |
On 9 Aug, 15:06, hemant.r...@gmail.com wrote:
> We have a C++ shared library that statically links-in g++ 4.1.1 libstdc
> ++.a on Solaris 8. It is completely self-contained library; symbols
> are resolved at link-time using the -Bdirect/-Bsymbolic option.
>
> When this C++ shared library is loaded by an application (which has
> pre-loaded g++ 3.2.3 libstdc++.so), the C++ symbols from the C++
> shared library seem to get resolved to the C++ symbols from libstdc+
> +.so. Given that the C++ shared library has been compiled w/ -Bdirect/-
> Bsymbolic, this resolution seems to be unexpected. Any ideas?
You may like to check which symbols bound to which libraries by using
LD_DEBUG environment variable. The following example runs on Linux,
you may need to check Solaris ld.so man page:
[max@k-pax test]$ cat test.cc
#include <iostream>
int main() { std::cout << "hi\n"; }
[max@k-pax test]$ g++ -Wall -o test test.cc
[max@k-pax test]$ ./test
hi
[max@k-pax test]$ LD_DEBUG=bindings ./test 2>&1 | c++filt | grep cout
10314: binding file /usr/lib/libstdc++.so.6 [0] to /usr/lib/
libstdc++.so.6 [0]: normal symbol `std::wcout' [GLIBCXX_3.4]
10314: binding file /usr/lib/libstdc++.so.6 [0] to ./test [0]:
normal symbol `std::cout' [GLIBCXX_3.4]
10314: binding file ./test [0] to /usr/lib/libstdc++.so.6 [0]:
normal symbol `std::cout' [GLIBCXX_3.4]