public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "cvs-commit at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/108969] [13/14 Regression] Initializing iostreams in the library needs a GLIBCXX_3.4.31 versioned symbol Date: Fri, 28 Apr 2023 08:50:53 +0000 [thread overview] Message-ID: <bug-108969-4-oP9Ntet41G@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-108969-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108969 --- Comment #27 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Jakub Jelinek <jakub@gcc.gnu.org>: https://gcc.gnu.org/g:9a41d2cdbcd2af77a3a91a840a3a13f0eb39971b commit r14-321-g9a41d2cdbcd2af77a3a91a840a3a13f0eb39971b Author: Jakub Jelinek <jakub@redhat.com> Date: Fri Apr 28 10:49:40 2023 +0200 libstdc++: Another attempt to ensure g++ 13+ compiled programs enforce gcc 13.2+ libstdc++.so.6 [PR108969] GCC used to emit an instance of an empty ios_base::Init class in every TU which included <iostream> to ensure it is std::cout etc. is initialized, but thanks to Patrick work on some targets (which have init_priority attribute support) it is now initialized only inside of libstdc++.so.6/libstdc++.a. This causes a problem if people do something that has never been supported, try to run GCC 13 compiled C++ code against GCC 12 or earlier libstdc++.so.6 - std::cout etc. are then never initialized because code including <iostream> expects the library to initialize it and the library expects code including <iostream> to do that. The following patch is second attempt to make this work cheaply as the earlier attempt of aliasing the std::cout etc. symbols with another symbol version didn't work out due to copy relocation breaking the aliases appart. The patch forces just a _ZSt21ios_base_library_initv undefined symbol into all *.o files which include <iostream> and while there is no runtime relocation against that, it seems to enforce the right version of libstdc++.so.6. /home/jakub/src/gcc/obj08i/usr/local/ is the install directory of trunk patched with this patch, /home/jakub/src/gcc/obj06/ is builddir of trunk without this patch, system g++ is GCC 12.1.1. $ cat /tmp/hw.C #include <iostream> int main () { std::cout << "Hello, world!" << std::endl; } $ cd /home/jakub/src/gcc/obj08i/usr/local/bin $ ./g++ -o /tmp/hw /tmp/hw.C $ readelf -Wa /tmp/hw 2>/dev/null | grep initv 4: 0000000000000000 0 FUNC GLOBAL DEFAULT UND _ZSt21ios_base_library_initv@GLIBCXX_3.4.32 (4) 71: 0000000000000000 0 FUNC GLOBAL DEFAULT UND _ZSt21ios_base_library_initv@GLIBCXX_3.4.32 $ /tmp/hw /tmp/hw: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.32' not found (required by /tmp/hw) $ LD_LIBRARY_PATH=/home/jakub/src/gcc/obj08i/usr/local/lib64/ /tmp/hw Hello, world! $ LD_LIBRARY_PATH=/home/jakub/src/gcc/obj06/x86_64-pc-linux-gnu/libstdc++-v3/src/.libs/ /tmp/hw /tmp/hw: /home/jakub/src/gcc/obj06/x86_64-pc-linux-gnu/libstdc++-v3/src/.libs/libstdc++.so.6: version `GLIBCXX_3.4.32' not found (required by /tmp/hw) $ g++ -o /tmp/hw /tmp/hw.C $ /tmp/hw Hello, world! $ LD_LIBRARY_PATH=/home/jakub/src/gcc/obj06/x86_64-pc-linux-gnu/libstdc++-v3/src/.libs/ /tmp/hw Hello, world! $ LD_LIBRARY_PATH=/home/jakub/src/gcc/obj08i/usr/local/lib64/ /tmp/hw Hello, world! On sparc-sun-solaris2.11 one I've actually checked a version which had defined(_GLIBCXX_SYMVER_SUN) next to defined(_GLIBCXX_SYMVER_GNU), but init_priority attribute doesn't seem to be supported there and so I couldn't actually test how this works there. Using gas and Sun ld, Rainer, does one need to use gas + gld for init_priority or something else? 2023-04-28 Jakub Jelinek <jakub@redhat.com> PR libstdc++/108969 * config/abi/pre/gnu.ver (GLIBCXX_3.4.32): Export _ZSt21ios_base_library_initv. * testsuite/util/testsuite_abi.cc (check_version): Add GLIBCXX_3.4.32 symver and make it the latestp. * src/c++98/ios_init.cc (ios_base_library_init): New alias. * acinclude.m4 (libtool_VERSION): Change to 6:32:0. * include/std/iostream: If init_priority attribute is supported and _GLIBCXX_SYMVER_GNU, force undefined _ZSt21ios_base_library_initv symbol into the object. * configure: Regenerated.
next prev parent reply other threads:[~2023-04-28 8:50 UTC|newest] Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-02-28 13:08 [Bug libstdc++/108969] New: [13 " redi at gcc dot gnu.org 2023-02-28 13:09 ` [Bug libstdc++/108969] " redi at gcc dot gnu.org 2023-02-28 13:21 ` jakub at gcc dot gnu.org 2023-02-28 13:22 ` redi at gcc dot gnu.org 2023-02-28 13:25 ` jakub at gcc dot gnu.org 2023-02-28 13:28 ` redi at gcc dot gnu.org 2023-02-28 13:30 ` jakub at gcc dot gnu.org 2023-02-28 13:34 ` fw at gcc dot gnu.org 2023-02-28 13:36 ` redi at gcc dot gnu.org 2023-02-28 13:51 ` jakub at gcc dot gnu.org 2023-02-28 13:54 ` rguenth at gcc dot gnu.org 2023-02-28 14:09 ` redi at gcc dot gnu.org 2023-03-03 17:25 ` ppalka at gcc dot gnu.org 2023-03-08 9:20 ` rguenth at gcc dot gnu.org 2023-03-08 9:28 ` jakub at gcc dot gnu.org 2023-03-27 10:55 ` rguenth at gcc dot gnu.org 2023-04-18 15:58 ` [Bug libstdc++/108969] [13/14 " cvs-commit at gcc dot gnu.org 2023-04-18 16:00 ` cvs-commit at gcc dot gnu.org 2023-04-18 16:00 ` redi at gcc dot gnu.org 2023-04-18 16:31 ` cvs-commit at gcc dot gnu.org 2023-04-18 16:31 ` cvs-commit at gcc dot gnu.org 2023-04-19 14:17 ` jakub at gcc dot gnu.org 2023-04-19 14:17 ` sjames at gcc dot gnu.org 2023-04-19 14:25 ` jakub at gcc dot gnu.org 2023-04-19 14:45 ` fw at gcc dot gnu.org 2023-04-19 14:48 ` jakub at gcc dot gnu.org 2023-04-26 6:57 ` rguenth at gcc dot gnu.org 2023-04-26 18:15 ` xry111 at gcc dot gnu.org 2023-04-28 8:50 ` cvs-commit at gcc dot gnu.org [this message] 2023-04-28 20:57 ` romain.geissler at amadeus dot com 2023-04-28 20:58 ` romain.geissler at amadeus dot com 2023-04-28 21:16 ` redi at gcc dot gnu.org 2023-04-28 21:21 ` romain.geissler at amadeus dot com 2023-05-04 7:44 ` cvs-commit at gcc dot gnu.org 2023-05-04 7:49 ` jakub at gcc dot gnu.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-108969-4-oP9Ntet41G@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).