From 762be0646bf96761ce68a9e06ab60c453e0963d0 Mon Sep 17 00:00:00 2001 From: Jonathan Wakely <jwakely@redhat.com> Date: Tue, 18 Apr 2023 14:37:38 +0100 Subject: [PATCH] libstdc++: Export global iostreams with GLIBCXX_3.4.31 symver [PR108969] Since GCC 13 the global iostream objects are only initialized once in libstdc++, and not by a std::ios::Init object in every translation unit that includes <iostream>. To avoid using uninitialized streams defined in an older libstdc++.so, translation units using the global iostreams should depend on the GLIBCXX_3.4.31 symver. Define std::cin as std::__io::cin and then export it as std::cin@@GLIBCXX_3.4.31 so that references to std::cin bind to the new symver. Also export it as @GLIBCXX_3.4 for backwards compatibility libstdc++-v3/ChangeLog: PR libstdc++/108969 * src/Makefile.am: Move globals_io.cc to here. * src/Makefile.in: Regenerate. * src/c++98/Makefile.am: Remove globals_io.cc from here. * src/c++98/Makefile.in: Regenerate. * src/c++98/globals_io.cc [_GLIBCXX_SYMVER_GNU] (cin): Adjust symbol name and then export with GLIBCXX_3.4.31 symver. (cout, cerr, clog, wcin, wcout, wcerr, wclog): Likewise. * config/abi/post/aarch64-linux-gnu/baseline_symbols.txt: Regenerate. * config/abi/post/i486-linux-gnu/baseline_symbols.txt: Regenerate. * config/abi/post/m68k-linux-gnu/baseline_symbols.txt: Regenerate. * config/abi/post/powerpc64-linux-gnu/baseline_symbols.txt: Regenerate. * config/abi/post/riscv64-linux-gnu/baseline_symbols.txt: Regenerate. * config/abi/post/x86_64-linux-gnu/32/baseline_symbols.txt: Regenerate. * config/abi/post/s390x-linux-gnu/baseline_symbols.txt: Regenerate. * config/abi/post/x86_64-linux-gnu/baseline_symbols.txt: Regenerate. * config/abi/pre/gnu.ver: Add iostream objects to new symver. --- .../aarch64-linux-gnu/baseline_symbols.txt | 24 +++++++++----- .../post/i486-linux-gnu/baseline_symbols.txt | 24 +++++++++----- .../post/m68k-linux-gnu/baseline_symbols.txt | 24 +++++++++----- .../powerpc64-linux-gnu/baseline_symbols.txt | 24 +++++++++----- .../riscv64-linux-gnu/baseline_symbols.txt | 24 +++++++++----- .../post/s390x-linux-gnu/baseline_symbols.txt | 24 +++++++++----- .../x86_64-linux-gnu/32/baseline_symbols.txt | 24 +++++++++----- .../x86_64-linux-gnu/baseline_symbols.txt | 24 +++++++++----- libstdc++-v3/config/abi/pre/gnu.ver | 14 ++++++++ libstdc++-v3/src/Makefile.am | 1 + libstdc++-v3/src/Makefile.in | 3 +- libstdc++-v3/src/c++98/Makefile.am | 1 - libstdc++-v3/src/c++98/Makefile.in | 16 ++++------ libstdc++-v3/src/c++98/globals_io.cc | 32 ++++++++++++++----- 14 files changed, 176 insertions(+), 83 deletions(-) diff --git a/libstdc++-v3/config/abi/post/aarch64-linux-gnu/baseline_symbols.txt b/libstdc++-v3/config/abi/post/aarch64-linux-gnu/baseline_symbols.txt index 9be3453d6ed5..d2cf0d41ab5b 100644 --- a/libstdc++-v3/config/abi/post/aarch64-linux-gnu/baseline_symbols.txt +++ b/libstdc++-v3/config/abi/post/aarch64-linux-gnu/baseline_symbols.txt @@ -5258,15 +5258,23 @@ OBJECT:25:_ZTSNSt7__cxx118numpunctIcEE@@GLIBCXX_3.4.21 OBJECT:25:_ZTSNSt7__cxx118numpunctIwEE@@GLIBCXX_3.4.21 OBJECT:25:_ZTSSt20bad_array_new_length@@CXXABI_1.3.8 OBJECT:26:_ZTSNSt3pmr15memory_resourceE@@GLIBCXX_3.4.28 -OBJECT:272:_ZSt4cerr@@GLIBCXX_3.4 -OBJECT:272:_ZSt4clog@@GLIBCXX_3.4 -OBJECT:272:_ZSt4cout@@GLIBCXX_3.4 -OBJECT:272:_ZSt5wcerr@@GLIBCXX_3.4 -OBJECT:272:_ZSt5wclog@@GLIBCXX_3.4 -OBJECT:272:_ZSt5wcout@@GLIBCXX_3.4 +OBJECT:272:_ZSt4cerr@@GLIBCXX_3.4.31 +OBJECT:272:_ZSt4cerr@GLIBCXX_3.4 +OBJECT:272:_ZSt4clog@@GLIBCXX_3.4.31 +OBJECT:272:_ZSt4clog@GLIBCXX_3.4 +OBJECT:272:_ZSt4cout@@GLIBCXX_3.4.31 +OBJECT:272:_ZSt4cout@GLIBCXX_3.4 +OBJECT:272:_ZSt5wcerr@@GLIBCXX_3.4.31 +OBJECT:272:_ZSt5wcerr@GLIBCXX_3.4 +OBJECT:272:_ZSt5wclog@@GLIBCXX_3.4.31 +OBJECT:272:_ZSt5wclog@GLIBCXX_3.4 +OBJECT:272:_ZSt5wcout@@GLIBCXX_3.4.31 +OBJECT:272:_ZSt5wcout@GLIBCXX_3.4 OBJECT:27:_ZTSSt19__codecvt_utf8_baseIwE@@GLIBCXX_3.4.21 -OBJECT:280:_ZSt3cin@@GLIBCXX_3.4 -OBJECT:280:_ZSt4wcin@@GLIBCXX_3.4 +OBJECT:280:_ZSt3cin@@GLIBCXX_3.4.31 +OBJECT:280:_ZSt3cin@GLIBCXX_3.4 +OBJECT:280:_ZSt4wcin@@GLIBCXX_3.4.31 +OBJECT:280:_ZSt4wcin@GLIBCXX_3.4 OBJECT:28:_ZTSSt19__codecvt_utf8_baseIDiE@@GLIBCXX_3.4.21 OBJECT:28:_ZTSSt19__codecvt_utf8_baseIDsE@@GLIBCXX_3.4.21 OBJECT:28:_ZTSSt20__codecvt_utf16_baseIwE@@GLIBCXX_3.4.21 diff --git a/libstdc++-v3/config/abi/post/i486-linux-gnu/baseline_symbols.txt b/libstdc++-v3/config/abi/post/i486-linux-gnu/baseline_symbols.txt index ed8966b9c7b5..35436370a588 100644 --- a/libstdc++-v3/config/abi/post/i486-linux-gnu/baseline_symbols.txt +++ b/libstdc++-v3/config/abi/post/i486-linux-gnu/baseline_symbols.txt @@ -4769,14 +4769,22 @@ OBJECT:13:_ZTSSt9exception@@GLIBCXX_3.4 OBJECT:13:_ZTSSt9strstream@@GLIBCXX_3.4 OBJECT:13:_ZTSSt9time_base@@GLIBCXX_3.4 OBJECT:13:_ZTSSt9type_info@@GLIBCXX_3.4 -OBJECT:140:_ZSt4cerr@@GLIBCXX_3.4 -OBJECT:140:_ZSt4clog@@GLIBCXX_3.4 -OBJECT:140:_ZSt4cout@@GLIBCXX_3.4 -OBJECT:144:_ZSt3cin@@GLIBCXX_3.4 -OBJECT:144:_ZSt5wcerr@@GLIBCXX_3.4 -OBJECT:144:_ZSt5wclog@@GLIBCXX_3.4 -OBJECT:144:_ZSt5wcout@@GLIBCXX_3.4 -OBJECT:148:_ZSt4wcin@@GLIBCXX_3.4 +OBJECT:140:_ZSt4cerr@@GLIBCXX_3.4.31 +OBJECT:140:_ZSt4cerr@GLIBCXX_3.4 +OBJECT:140:_ZSt4clog@@GLIBCXX_3.4.31 +OBJECT:140:_ZSt4clog@GLIBCXX_3.4 +OBJECT:140:_ZSt4cout@@GLIBCXX_3.4.31 +OBJECT:140:_ZSt4cout@GLIBCXX_3.4 +OBJECT:144:_ZSt3cin@@GLIBCXX_3.4.31 +OBJECT:144:_ZSt3cin@GLIBCXX_3.4 +OBJECT:144:_ZSt5wcerr@@GLIBCXX_3.4.31 +OBJECT:144:_ZSt5wcerr@GLIBCXX_3.4 +OBJECT:144:_ZSt5wclog@@GLIBCXX_3.4.31 +OBJECT:144:_ZSt5wclog@GLIBCXX_3.4 +OBJECT:144:_ZSt5wcout@@GLIBCXX_3.4.31 +OBJECT:144:_ZSt5wcout@GLIBCXX_3.4 +OBJECT:148:_ZSt4wcin@@GLIBCXX_3.4.31 +OBJECT:148:_ZSt4wcin@GLIBCXX_3.4 OBJECT:14:_ZTSSt7collateIcE@@GLIBCXX_3.4 OBJECT:14:_ZTSSt7collateIwE@@GLIBCXX_3.4 OBJECT:15:_ZTSSt10bad_typeid@@GLIBCXX_3.4 diff --git a/libstdc++-v3/config/abi/post/m68k-linux-gnu/baseline_symbols.txt b/libstdc++-v3/config/abi/post/m68k-linux-gnu/baseline_symbols.txt index be21567821ca..865a4ce79752 100644 --- a/libstdc++-v3/config/abi/post/m68k-linux-gnu/baseline_symbols.txt +++ b/libstdc++-v3/config/abi/post/m68k-linux-gnu/baseline_symbols.txt @@ -4759,19 +4759,27 @@ OBJECT:12:_ZTSSt5ctypeIcE@@GLIBCXX_3.4 OBJECT:12:_ZTSSt5ctypeIwE@@GLIBCXX_3.4 OBJECT:12:_ZTSSt8bad_cast@@GLIBCXX_3.4 OBJECT:12:_ZTSSt8ios_base@@GLIBCXX_3.4 -OBJECT:138:_ZSt4cerr@@GLIBCXX_3.4 -OBJECT:138:_ZSt4clog@@GLIBCXX_3.4 -OBJECT:138:_ZSt4cout@@GLIBCXX_3.4 +OBJECT:138:_ZSt4cerr@@GLIBCXX_3.4.31 +OBJECT:138:_ZSt4cerr@GLIBCXX_3.4 +OBJECT:138:_ZSt4clog@@GLIBCXX_3.4.31 +OBJECT:138:_ZSt4clog@GLIBCXX_3.4 +OBJECT:138:_ZSt4cout@@GLIBCXX_3.4.31 +OBJECT:138:_ZSt4cout@GLIBCXX_3.4 OBJECT:13:_ZTSSt9bad_alloc@@GLIBCXX_3.4 OBJECT:13:_ZTSSt9exception@@GLIBCXX_3.4 OBJECT:13:_ZTSSt9strstream@@GLIBCXX_3.4 OBJECT:13:_ZTSSt9time_base@@GLIBCXX_3.4 OBJECT:13:_ZTSSt9type_info@@GLIBCXX_3.4 -OBJECT:142:_ZSt3cin@@GLIBCXX_3.4 -OBJECT:142:_ZSt5wcerr@@GLIBCXX_3.4 -OBJECT:142:_ZSt5wclog@@GLIBCXX_3.4 -OBJECT:142:_ZSt5wcout@@GLIBCXX_3.4 -OBJECT:146:_ZSt4wcin@@GLIBCXX_3.4 +OBJECT:142:_ZSt3cin@@GLIBCXX_3.4.31 +OBJECT:142:_ZSt3cin@GLIBCXX_3.4 +OBJECT:142:_ZSt5wcerr@@GLIBCXX_3.4.31 +OBJECT:142:_ZSt5wcerr@GLIBCXX_3.4 +OBJECT:142:_ZSt5wclog@@GLIBCXX_3.4.31 +OBJECT:142:_ZSt5wclog@GLIBCXX_3.4 +OBJECT:142:_ZSt5wcout@@GLIBCXX_3.4.31 +OBJECT:142:_ZSt5wcout@GLIBCXX_3.4 +OBJECT:146:_ZSt4wcin@@GLIBCXX_3.4.31 +OBJECT:146:_ZSt4wcin@GLIBCXX_3.4 OBJECT:14:_ZTSSt7collateIcE@@GLIBCXX_3.4 OBJECT:14:_ZTSSt7collateIwE@@GLIBCXX_3.4 OBJECT:15:_ZTSSt10bad_typeid@@GLIBCXX_3.4 diff --git a/libstdc++-v3/config/abi/post/powerpc64-linux-gnu/baseline_symbols.txt b/libstdc++-v3/config/abi/post/powerpc64-linux-gnu/baseline_symbols.txt index f4ae6d46f7e9..9b4ec7120cdc 100644 --- a/libstdc++-v3/config/abi/post/powerpc64-linux-gnu/baseline_symbols.txt +++ b/libstdc++-v3/config/abi/post/powerpc64-linux-gnu/baseline_symbols.txt @@ -5771,15 +5771,23 @@ OBJECT:25:_ZTSNSt7__cxx118numpunctIcEE@@GLIBCXX_3.4.21 OBJECT:25:_ZTSNSt7__cxx118numpunctIwEE@@GLIBCXX_3.4.21 OBJECT:25:_ZTSSt20bad_array_new_length@@CXXABI_1.3.8 OBJECT:26:_ZTSNSt3pmr15memory_resourceE@@GLIBCXX_3.4.28 -OBJECT:272:_ZSt4cerr@@GLIBCXX_3.4 -OBJECT:272:_ZSt4clog@@GLIBCXX_3.4 -OBJECT:272:_ZSt4cout@@GLIBCXX_3.4 -OBJECT:272:_ZSt5wcerr@@GLIBCXX_3.4 -OBJECT:272:_ZSt5wclog@@GLIBCXX_3.4 -OBJECT:272:_ZSt5wcout@@GLIBCXX_3.4 +OBJECT:272:_ZSt4cerr@@GLIBCXX_3.4.31 +OBJECT:272:_ZSt4cerr@GLIBCXX_3.4 +OBJECT:272:_ZSt4clog@@GLIBCXX_3.4.31 +OBJECT:272:_ZSt4clog@GLIBCXX_3.4 +OBJECT:272:_ZSt4cout@@GLIBCXX_3.4.31 +OBJECT:272:_ZSt4cout@GLIBCXX_3.4 +OBJECT:272:_ZSt5wcerr@@GLIBCXX_3.4.31 +OBJECT:272:_ZSt5wcerr@GLIBCXX_3.4 +OBJECT:272:_ZSt5wclog@@GLIBCXX_3.4.31 +OBJECT:272:_ZSt5wclog@GLIBCXX_3.4 +OBJECT:272:_ZSt5wcout@@GLIBCXX_3.4.31 +OBJECT:272:_ZSt5wcout@GLIBCXX_3.4 OBJECT:27:_ZTSSt19__codecvt_utf8_baseIwE@@GLIBCXX_3.4.21 -OBJECT:280:_ZSt3cin@@GLIBCXX_3.4 -OBJECT:280:_ZSt4wcin@@GLIBCXX_3.4 +OBJECT:280:_ZSt3cin@@GLIBCXX_3.4.31 +OBJECT:280:_ZSt3cin@GLIBCXX_3.4 +OBJECT:280:_ZSt4wcin@@GLIBCXX_3.4.31 +OBJECT:280:_ZSt4wcin@GLIBCXX_3.4 OBJECT:28:_ZTSSt19__codecvt_utf8_baseIDiE@@GLIBCXX_3.4.21 OBJECT:28:_ZTSSt19__codecvt_utf8_baseIDsE@@GLIBCXX_3.4.21 OBJECT:28:_ZTSSt20__codecvt_utf16_baseIwE@@GLIBCXX_3.4.21 diff --git a/libstdc++-v3/config/abi/post/riscv64-linux-gnu/baseline_symbols.txt b/libstdc++-v3/config/abi/post/riscv64-linux-gnu/baseline_symbols.txt index 876565bfa541..ca7f3666f778 100644 --- a/libstdc++-v3/config/abi/post/riscv64-linux-gnu/baseline_symbols.txt +++ b/libstdc++-v3/config/abi/post/riscv64-linux-gnu/baseline_symbols.txt @@ -5253,15 +5253,23 @@ OBJECT:25:_ZTSNSt7__cxx118numpunctIcEE@@GLIBCXX_3.4.21 OBJECT:25:_ZTSNSt7__cxx118numpunctIwEE@@GLIBCXX_3.4.21 OBJECT:25:_ZTSSt20bad_array_new_length@@CXXABI_1.3.8 OBJECT:26:_ZTSNSt3pmr15memory_resourceE@@GLIBCXX_3.4.28 -OBJECT:272:_ZSt4cerr@@GLIBCXX_3.4 -OBJECT:272:_ZSt4clog@@GLIBCXX_3.4 -OBJECT:272:_ZSt4cout@@GLIBCXX_3.4 -OBJECT:272:_ZSt5wcerr@@GLIBCXX_3.4 -OBJECT:272:_ZSt5wclog@@GLIBCXX_3.4 -OBJECT:272:_ZSt5wcout@@GLIBCXX_3.4 +OBJECT:272:_ZSt4cerr@@GLIBCXX_3.4.31 +OBJECT:272:_ZSt4cerr@GLIBCXX_3.4 +OBJECT:272:_ZSt4clog@@GLIBCXX_3.4.31 +OBJECT:272:_ZSt4clog@GLIBCXX_3.4 +OBJECT:272:_ZSt4cout@@GLIBCXX_3.4.31 +OBJECT:272:_ZSt4cout@GLIBCXX_3.4 +OBJECT:272:_ZSt5wcerr@@GLIBCXX_3.4.31 +OBJECT:272:_ZSt5wcerr@GLIBCXX_3.4 +OBJECT:272:_ZSt5wclog@@GLIBCXX_3.4.31 +OBJECT:272:_ZSt5wclog@GLIBCXX_3.4 +OBJECT:272:_ZSt5wcout@@GLIBCXX_3.4.31 +OBJECT:272:_ZSt5wcout@GLIBCXX_3.4 OBJECT:27:_ZTSSt19__codecvt_utf8_baseIwE@@GLIBCXX_3.4.21 -OBJECT:280:_ZSt3cin@@GLIBCXX_3.4 -OBJECT:280:_ZSt4wcin@@GLIBCXX_3.4 +OBJECT:280:_ZSt3cin@@GLIBCXX_3.4.31 +OBJECT:280:_ZSt3cin@GLIBCXX_3.4 +OBJECT:280:_ZSt4wcin@@GLIBCXX_3.4.31 +OBJECT:280:_ZSt4wcin@GLIBCXX_3.4 OBJECT:28:_ZTSSt19__codecvt_utf8_baseIDiE@@GLIBCXX_3.4.21 OBJECT:28:_ZTSSt19__codecvt_utf8_baseIDsE@@GLIBCXX_3.4.21 OBJECT:28:_ZTSSt20__codecvt_utf16_baseIwE@@GLIBCXX_3.4.21 diff --git a/libstdc++-v3/config/abi/post/s390x-linux-gnu/baseline_symbols.txt b/libstdc++-v3/config/abi/post/s390x-linux-gnu/baseline_symbols.txt index 5e532850ee16..7be951d5d5f4 100644 --- a/libstdc++-v3/config/abi/post/s390x-linux-gnu/baseline_symbols.txt +++ b/libstdc++-v3/config/abi/post/s390x-linux-gnu/baseline_symbols.txt @@ -5534,14 +5534,22 @@ OBJECT:25:_ZTSNSt7__cxx118numpunctIcEE@@GLIBCXX_3.4.21 OBJECT:25:_ZTSNSt7__cxx118numpunctIwEE@@GLIBCXX_3.4.21 OBJECT:25:_ZTSSt20bad_array_new_length@@CXXABI_1.3.8 OBJECT:26:_ZTSNSt3pmr15memory_resourceE@@GLIBCXX_3.4.28 -OBJECT:272:_ZSt4cerr@@GLIBCXX_3.4 -OBJECT:272:_ZSt4clog@@GLIBCXX_3.4 -OBJECT:272:_ZSt4cout@@GLIBCXX_3.4 -OBJECT:272:_ZSt5wcerr@@GLIBCXX_3.4 -OBJECT:272:_ZSt5wclog@@GLIBCXX_3.4 -OBJECT:272:_ZSt5wcout@@GLIBCXX_3.4 -OBJECT:27:_ZTSSt19__codecvt_utf8_baseIwE@@GLIBCXX_3.4.21 -OBJECT:280:_ZSt3cin@@GLIBCXX_3.4 +OBJECT:272:_ZSt4cerr@@GLIBCXX_3.4.31 +OBJECT:272:_ZSt4cerr@GLIBCXX_3.4 +OBJECT:272:_ZSt4clog@@GLIBCXX_3.4.31 +OBJECT:272:_ZSt4clog@GLIBCXX_3.4 +OBJECT:272:_ZSt4cout@@GLIBCXX_3.4.31 +OBJECT:272:_ZSt4cout@GLIBCXX_3.4 +OBJECT:272:_ZSt5wcerr@@GLIBCXX_3.4.31 +OBJECT:272:_ZSt5wcerr@GLIBCXX_3.4 +OBJECT:272:_ZSt5wclog@@GLIBCXX_3.4.31 +OBJECT:272:_ZSt5wclog@GLIBCXX_3.4 +OBJECT:272:_ZSt5wcout@@GLIBCXX_3.4.31 +OBJECT:272:_ZSt5wcout@GLIBCXX_3.4 +OBJECT:280:_ZSt3cin@@GLIBCXX_3.4.31 +OBJECT:280:_ZSt3cin@GLIBCXX_3.4 +OBJECT:280:_ZSt4wcin@@GLIBCXX_3.4.31 +OBJECT:280:_ZSt4wcin@GLIBCXX_3.4 OBJECT:280:_ZSt4wcin@@GLIBCXX_3.4 OBJECT:28:_ZTSSt19__codecvt_utf8_baseIDiE@@GLIBCXX_3.4.21 OBJECT:28:_ZTSSt19__codecvt_utf8_baseIDsE@@GLIBCXX_3.4.21 diff --git a/libstdc++-v3/config/abi/post/x86_64-linux-gnu/32/baseline_symbols.txt b/libstdc++-v3/config/abi/post/x86_64-linux-gnu/32/baseline_symbols.txt index ed8966b9c7b5..35436370a588 100644 --- a/libstdc++-v3/config/abi/post/x86_64-linux-gnu/32/baseline_symbols.txt +++ b/libstdc++-v3/config/abi/post/x86_64-linux-gnu/32/baseline_symbols.txt @@ -4769,14 +4769,22 @@ OBJECT:13:_ZTSSt9exception@@GLIBCXX_3.4 OBJECT:13:_ZTSSt9strstream@@GLIBCXX_3.4 OBJECT:13:_ZTSSt9time_base@@GLIBCXX_3.4 OBJECT:13:_ZTSSt9type_info@@GLIBCXX_3.4 -OBJECT:140:_ZSt4cerr@@GLIBCXX_3.4 -OBJECT:140:_ZSt4clog@@GLIBCXX_3.4 -OBJECT:140:_ZSt4cout@@GLIBCXX_3.4 -OBJECT:144:_ZSt3cin@@GLIBCXX_3.4 -OBJECT:144:_ZSt5wcerr@@GLIBCXX_3.4 -OBJECT:144:_ZSt5wclog@@GLIBCXX_3.4 -OBJECT:144:_ZSt5wcout@@GLIBCXX_3.4 -OBJECT:148:_ZSt4wcin@@GLIBCXX_3.4 +OBJECT:140:_ZSt4cerr@@GLIBCXX_3.4.31 +OBJECT:140:_ZSt4cerr@GLIBCXX_3.4 +OBJECT:140:_ZSt4clog@@GLIBCXX_3.4.31 +OBJECT:140:_ZSt4clog@GLIBCXX_3.4 +OBJECT:140:_ZSt4cout@@GLIBCXX_3.4.31 +OBJECT:140:_ZSt4cout@GLIBCXX_3.4 +OBJECT:144:_ZSt3cin@@GLIBCXX_3.4.31 +OBJECT:144:_ZSt3cin@GLIBCXX_3.4 +OBJECT:144:_ZSt5wcerr@@GLIBCXX_3.4.31 +OBJECT:144:_ZSt5wcerr@GLIBCXX_3.4 +OBJECT:144:_ZSt5wclog@@GLIBCXX_3.4.31 +OBJECT:144:_ZSt5wclog@GLIBCXX_3.4 +OBJECT:144:_ZSt5wcout@@GLIBCXX_3.4.31 +OBJECT:144:_ZSt5wcout@GLIBCXX_3.4 +OBJECT:148:_ZSt4wcin@@GLIBCXX_3.4.31 +OBJECT:148:_ZSt4wcin@GLIBCXX_3.4 OBJECT:14:_ZTSSt7collateIcE@@GLIBCXX_3.4 OBJECT:14:_ZTSSt7collateIwE@@GLIBCXX_3.4 OBJECT:15:_ZTSSt10bad_typeid@@GLIBCXX_3.4 diff --git a/libstdc++-v3/config/abi/post/x86_64-linux-gnu/baseline_symbols.txt b/libstdc++-v3/config/abi/post/x86_64-linux-gnu/baseline_symbols.txt index 6d48d7b7fd7e..fc0d96282b01 100644 --- a/libstdc++-v3/config/abi/post/x86_64-linux-gnu/baseline_symbols.txt +++ b/libstdc++-v3/config/abi/post/x86_64-linux-gnu/baseline_symbols.txt @@ -5264,15 +5264,23 @@ OBJECT:25:_ZTSNSt7__cxx118numpunctIcEE@@GLIBCXX_3.4.21 OBJECT:25:_ZTSNSt7__cxx118numpunctIwEE@@GLIBCXX_3.4.21 OBJECT:25:_ZTSSt20bad_array_new_length@@CXXABI_1.3.8 OBJECT:26:_ZTSNSt3pmr15memory_resourceE@@GLIBCXX_3.4.28 -OBJECT:272:_ZSt4cerr@@GLIBCXX_3.4 -OBJECT:272:_ZSt4clog@@GLIBCXX_3.4 -OBJECT:272:_ZSt4cout@@GLIBCXX_3.4 -OBJECT:272:_ZSt5wcerr@@GLIBCXX_3.4 -OBJECT:272:_ZSt5wclog@@GLIBCXX_3.4 -OBJECT:272:_ZSt5wcout@@GLIBCXX_3.4 +OBJECT:272:_ZSt4cerr@@GLIBCXX_3.4.31 +OBJECT:272:_ZSt4cerr@GLIBCXX_3.4 +OBJECT:272:_ZSt4clog@@GLIBCXX_3.4.31 +OBJECT:272:_ZSt4clog@GLIBCXX_3.4 +OBJECT:272:_ZSt4cout@@GLIBCXX_3.4.31 +OBJECT:272:_ZSt4cout@GLIBCXX_3.4 +OBJECT:272:_ZSt5wcerr@@GLIBCXX_3.4.31 +OBJECT:272:_ZSt5wcerr@GLIBCXX_3.4 +OBJECT:272:_ZSt5wclog@@GLIBCXX_3.4.31 +OBJECT:272:_ZSt5wclog@GLIBCXX_3.4 +OBJECT:272:_ZSt5wcout@@GLIBCXX_3.4.31 +OBJECT:272:_ZSt5wcout@GLIBCXX_3.4 OBJECT:27:_ZTSSt19__codecvt_utf8_baseIwE@@GLIBCXX_3.4.21 -OBJECT:280:_ZSt3cin@@GLIBCXX_3.4 -OBJECT:280:_ZSt4wcin@@GLIBCXX_3.4 +OBJECT:280:_ZSt3cin@@GLIBCXX_3.4.31 +OBJECT:280:_ZSt3cin@GLIBCXX_3.4 +OBJECT:280:_ZSt4wcin@@GLIBCXX_3.4.31 +OBJECT:280:_ZSt4wcin@GLIBCXX_3.4 OBJECT:28:_ZTSSt19__codecvt_utf8_baseIDiE@@GLIBCXX_3.4.21 OBJECT:28:_ZTSSt19__codecvt_utf8_baseIDsE@@GLIBCXX_3.4.21 OBJECT:28:_ZTSSt20__codecvt_utf16_baseIwE@@GLIBCXX_3.4.21 diff --git a/libstdc++-v3/config/abi/pre/gnu.ver b/libstdc++-v3/config/abi/pre/gnu.ver index 4ae63094eb7d..7c015524b62b 100644 --- a/libstdc++-v3/config/abi/pre/gnu.ver +++ b/libstdc++-v3/config/abi/pre/gnu.ver @@ -2512,6 +2512,20 @@ GLIBCXX_3.4.31 { _ZNKSt12__shared_ptrINSt10filesystem28recursive_directory_iterator10_Dir_stackELN9__gnu_cxx12_Lock_policyE[012]EEcvbEv; _ZNKSt12__shared_ptrINSt10filesystem7__cxx1128recursive_directory_iterator10_Dir_stackELN9__gnu_cxx12_Lock_policyE[012]EEcvbEv; +#if defined(_GLIBCXX_SYMVER_GNU) && defined(_GLIBCXX_SHARED) \ + && defined(_GLIBCXX_HAVE_AS_SYMVER_DIRECTIVE) \ + && defined(_GLIBCXX_HAVE_SYMVER_SYMBOL_RENAMING_RUNTIME_SUPPORT) + # See src/c++98/globals_io.cc + _ZSt3cin; + _ZSt4cout; + _ZSt4cerr; + _ZSt4clog; + _ZSt4wcin; + _ZSt5wcout; + _ZSt5wcerr; + _ZSt5wclog; +#endif + } GLIBCXX_3.4.30; # Symbols in the support library (libsupc++) have their own tag. diff --git a/libstdc++-v3/src/Makefile.am b/libstdc++-v3/src/Makefile.am index 5b9af41cdb91..3229f902ad78 100644 --- a/libstdc++-v3/src/Makefile.am +++ b/libstdc++-v3/src/Makefile.am @@ -122,6 +122,7 @@ cxx98_sources = \ compatibility.cc \ compatibility-debug_list.cc \ compatibility-debug_list-2.cc \ + globals_io.cc \ ${ldbl_compat_sources} cxx11_sources = \ diff --git a/libstdc++-v3/src/Makefile.in b/libstdc++-v3/src/Makefile.in index f42d957af36c..d145a7b4d3aa 100644 --- a/libstdc++-v3/src/Makefile.in +++ b/libstdc++-v3/src/Makefile.in @@ -151,7 +151,7 @@ LTLIBRARIES = $(toolexeclib_LTLIBRARIES) am__DEPENDENCIES_1 = @GLIBCXX_LDBL_COMPAT_TRUE@am__objects_1 = compatibility-ldbl.lo am__objects_2 = compatibility.lo compatibility-debug_list.lo \ - compatibility-debug_list-2.lo $(am__objects_1) + compatibility-debug_list-2.lo globals_io.lo $(am__objects_1) @ENABLE_SYMVERS_GNU_NAMESPACE_FALSE@am__objects_3 = compatibility-atomic-c++0x.lo \ @ENABLE_SYMVERS_GNU_NAMESPACE_FALSE@ compatibility-c++0x.lo \ @ENABLE_SYMVERS_GNU_NAMESPACE_FALSE@ compatibility-chrono.lo \ @@ -534,6 +534,7 @@ cxx98_sources = \ compatibility.cc \ compatibility-debug_list.cc \ compatibility-debug_list-2.cc \ + globals_io.cc \ ${ldbl_compat_sources} cxx11_sources = \ diff --git a/libstdc++-v3/src/c++98/Makefile.am b/libstdc++-v3/src/c++98/Makefile.am index 284ffda34435..2570f90b9723 100644 --- a/libstdc++-v3/src/c++98/Makefile.am +++ b/libstdc++-v3/src/c++98/Makefile.am @@ -118,7 +118,6 @@ sources = \ mt_allocator.cc \ codecvt.cc \ complex_io.cc \ - globals_io.cc \ hash_tr1.cc \ hashtable_tr1.cc \ ios_failure.cc \ diff --git a/libstdc++-v3/src/c++98/Makefile.in b/libstdc++-v3/src/c++98/Makefile.in index a100df77a6d8..627ebb860cc9 100644 --- a/libstdc++-v3/src/c++98/Makefile.in +++ b/libstdc++-v3/src/c++98/Makefile.in @@ -136,14 +136,13 @@ am__objects_5 = parallel_settings.lo am__objects_6 = basic_file.lo c++locale.lo $(am__objects_4) \ $(am__objects_5) am__objects_7 = bitmap_allocator.lo pool_allocator.lo mt_allocator.lo \ - codecvt.lo complex_io.lo globals_io.lo hash_tr1.lo \ - hashtable_tr1.lo ios_failure.lo ios_init.lo ios_locale.lo \ - list.lo list-aux.lo list-aux-2.lo list_associated.lo \ - list_associated-2.lo locale.lo locale_init.lo locale_facets.lo \ - localename.lo math_stubs_float.lo math_stubs_long_double.lo \ - stdexcept.lo strstream.lo tree.lo istream.lo istream-string.lo \ - streambuf.lo valarray.lo $(am__objects_1) $(am__objects_3) \ - $(am__objects_6) + codecvt.lo complex_io.lo hash_tr1.lo hashtable_tr1.lo \ + ios_failure.lo ios_init.lo ios_locale.lo list.lo list-aux.lo \ + list-aux-2.lo list_associated.lo list_associated-2.lo \ + locale.lo locale_init.lo locale_facets.lo localename.lo \ + math_stubs_float.lo math_stubs_long_double.lo stdexcept.lo \ + strstream.lo tree.lo istream.lo istream-string.lo streambuf.lo \ + valarray.lo $(am__objects_1) $(am__objects_3) $(am__objects_6) @GLIBCXX_HOSTED_TRUE@am_libc__98convenience_la_OBJECTS = \ @GLIBCXX_HOSTED_TRUE@ $(am__objects_7) libc__98convenience_la_OBJECTS = $(am_libc__98convenience_la_OBJECTS) @@ -494,7 +493,6 @@ sources = \ mt_allocator.cc \ codecvt.cc \ complex_io.cc \ - globals_io.cc \ hash_tr1.cc \ hashtable_tr1.cc \ ios_failure.cc \ diff --git a/libstdc++-v3/src/c++98/globals_io.cc b/libstdc++-v3/src/c++98/globals_io.cc index 0c4f270977df..ba9a10377ebb 100644 --- a/libstdc++-v3/src/c++98/globals_io.cc +++ b/libstdc++-v3/src/c++98/globals_io.cc @@ -43,6 +43,22 @@ // In macro form: // _GLIBCXX_ASM_SYMVER(currentname, oldname, GLIBCXX_3.2) +#if defined(_GLIBCXX_SYMVER_GNU) && defined(_GLIBCXX_SHARED) \ + && defined(_GLIBCXX_HAVE_AS_SYMVER_DIRECTIVE) \ + && defined(_GLIBCXX_HAVE_SYMVER_SYMBOL_RENAMING_RUNTIME_SUPPORT) +// PR libstdc++/108969 +// Define std::cin as std::__io::cin and export it as std::cin@@GLIBCXX_3.4.31 +// and also as std::cin@GLIBCXX_3.4 for backwards compatibility. +# define _GLIBCXX_IO_GLOBAL(type, X, N) \ + namespace __io { \ + type X __attribute__((symver("_ZSt" #N #X "@@GLIBCXX_3.4.31"))); \ + extern type X ## 2 __attribute__((alias("_ZNSt4__io" #N #X "E"), \ + symver("_ZSt" #N #X "@GLIBCXX_3.4"))); \ + } +#else +# define _GLIBCXX_IO_GLOBAL(type, X, N) type X; +#endif + namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION @@ -53,20 +69,20 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION __attribute__ ((aligned(__alignof__(istream)))); typedef char fake_ostream[sizeof(ostream)] __attribute__ ((aligned(__alignof__(ostream)))); - fake_istream cin; - fake_ostream cout; - fake_ostream cerr; - fake_ostream clog; + _GLIBCXX_IO_GLOBAL(fake_istream, cin, 3); + _GLIBCXX_IO_GLOBAL(fake_ostream, cout, 4); + _GLIBCXX_IO_GLOBAL(fake_ostream, cerr, 4); + _GLIBCXX_IO_GLOBAL(fake_ostream, clog, 4); #ifdef _GLIBCXX_USE_WCHAR_T typedef char fake_wistream[sizeof(wistream)] __attribute__ ((aligned(__alignof__(wistream)))); typedef char fake_wostream[sizeof(wostream)] __attribute__ ((aligned(__alignof__(wostream)))); - fake_wistream wcin; - fake_wostream wcout; - fake_wostream wcerr; - fake_wostream wclog; + _GLIBCXX_IO_GLOBAL(fake_wistream, wcin, 4) + _GLIBCXX_IO_GLOBAL(fake_wostream, wcout, 5) + _GLIBCXX_IO_GLOBAL(fake_wostream, wcerr, 5) + _GLIBCXX_IO_GLOBAL(fake_wostream, wclog, 5) #endif #include "ios_base_init.h" -- GitLab