Matthias Klose
2018-10-16 13:52:29 UTC
This is seen in a distro upgrade, with a shared library built using GCC 6, which
now fails to dynamically link, when the library is rebuilt using GCC 8.
Details in https://bugs.debian.org/911090
Jonathan pointed me to PR71712, fixing the C++ mangling.
$ cat > foo.C
#include <string>
struct foo {
operator std::string();
};
foo::operator std::string() { return "Hi"; }
$ g++-8 -shared -fPIC -o libfoo.so foo.C && nm -D libfoo.so | grep foo
0000000000001136 T _ZN3foocvNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEv
g++-7 -shared -fPIC -o libfoo.so foo.C && nm -D libfoo.so | grep foo
000000000000115a T
_ZN3foocvNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEB5cxx11Ev
000000000000115a T _ZN3foocvNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEv
$ g++-8 -fabi-version=10 -shared -fPIC -o libfoo.so foo.C && nm -D libfoo.so |
grep foo
0000000000001136 T
_ZN3foocvNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEB5cxx11Ev
0000000000001136 T _ZN3foocvNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEv
GCC 7 emits the old/compat symbol, and GCC 8 emits it when explicitly built with
-fabi-version=10. This ABI change results in silent breakage, maybe in more
libraries than that one. Is there a reason that this compat symbol isn't
emitted anymore in GCC 8?
Matthias
now fails to dynamically link, when the library is rebuilt using GCC 8.
Details in https://bugs.debian.org/911090
Jonathan pointed me to PR71712, fixing the C++ mangling.
$ cat > foo.C
#include <string>
struct foo {
operator std::string();
};
foo::operator std::string() { return "Hi"; }
$ g++-8 -shared -fPIC -o libfoo.so foo.C && nm -D libfoo.so | grep foo
0000000000001136 T _ZN3foocvNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEv
g++-7 -shared -fPIC -o libfoo.so foo.C && nm -D libfoo.so | grep foo
000000000000115a T
_ZN3foocvNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEB5cxx11Ev
000000000000115a T _ZN3foocvNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEv
$ g++-8 -fabi-version=10 -shared -fPIC -o libfoo.so foo.C && nm -D libfoo.so |
grep foo
0000000000001136 T
_ZN3foocvNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEB5cxx11Ev
0000000000001136 T _ZN3foocvNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEv
GCC 7 emits the old/compat symbol, and GCC 8 emits it when explicitly built with
-fabi-version=10. This ABI change results in silent breakage, maybe in more
libraries than that one. Is there a reason that this compat symbol isn't
emitted anymore in GCC 8?
Matthias