[Bug libstdc++/100912] powerpc64le: ieee128 long double incorrectly printed when using shared libstdc++

qiu.chaofan at outlook dot com gcc-bugzilla@gcc.gnu.org
Mon Oct 11 10:08:24 GMT 2021


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100912

Qiu Chaofan <qiu.chaofan at outlook dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |qiu.chaofan at outlook dot com

--- Comment #5 from Qiu Chaofan <qiu.chaofan at outlook dot com> ---
Hi, I encountered the same problem when dynamically linking against libstdcxx,
while static linking works fine. The HEAD of git history is 8f323c712 (early
Sep.) so it shouldn't be old.

The configure option is: --enable-languages=c,c++ --disable-nls
--disable-bootstrap --with-long-double-format=ieee --disable-libgomp
--enable-multilib --with-cpu=power9 --with-advance-toolchain=at15.0

(Disabling multilib still has this issue)

By digging into make log, I found something interesting (some omitted):

libtool: link:  /build/./gcc/xgcc -shared-libgcc ... -fPIC -DPIC
-D_GLIBCXX_SHARED -shared -nostdlib /opt/at15.0/lib/../lib64/crti.o
/build/./gcc/crtbeginS.o  .libs/compatibility.o
.libs/compatibility-debug_list.o .libs/compatibility-debug_list-2.o
.libs/compatibility-ldbl.o .libs/compatibility-c++0x.o
.libs/compatibility-atomic-c++0x.o .libs/compatibility-thread-c++0x.o
.libs/compatibility-chrono.o .libs/compatibility-condvar.o
.libs/compatibility-ldbl-alt128.o .libs/compatibility-ldbl-alt128-cxx11.o 
-Wl,--whole-archive ../libsupc++/.libs/libsupc++convenience.a
../src/c++98/.libs/libc++98convenience.a
../src/c++11/.libs/libc++11convenience.a
../src/c++17/.libs/libc++17convenience.a
../src/c++20/.libs/libc++20convenience.a ... -Wl,-soname -Wl,libstdc++.so.6 -o
.libs/libstdc++.so.6.0.29

Only the 'compatibility' objects joined the link, and they're built using
`-mabi=ibmlongdouble`, not IEEE. Manually adding `c++11/wlocale-inst.o`
produces error complaining about multiple definition.


While libstdc++.a contains all of these definitions, actually seven
(compatibility-ldbl.o compatibility-ldbl-alt128.o
compatibility-ldbl-alt128-cxx11.o cxx11-locale-inst.o cxx11-wlocale-inst.o
locale-inst.o wlocale-inst.o
), so ld can find the correct one properly. (although I'm still not clear how
ld does it)

If I understood correctly, the reason why result is incorrect is that the
`libstdc++.so` only contains symbols built for compatibility. Maybe something
went wrong in the build scripts?


More information about the Gcc-bugs mailing list