aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/interface.cc
diff options
context:
space:
mode:
authorPatrick Palka <ppalka@redhat.com>2022-11-16 08:53:51 -0500
committerPatrick Palka <ppalka@redhat.com>2022-11-16 08:53:51 -0500
commitec59848074ba8c4310cbadb603822bfaeff03a32 (patch)
tree137b51eb3c81cb951f57c7665fb74c2712c756fc /gcc/fortran/interface.cc
parentc5e8c6c193d9a1ab80ef1a05e5158ddf35d54009 (diff)
downloadgcc-ec59848074ba8c4310cbadb603822bfaeff03a32.zip
gcc-ec59848074ba8c4310cbadb603822bfaeff03a32.tar.gz
gcc-ec59848074ba8c4310cbadb603822bfaeff03a32.tar.bz2
libstdc++: Fix stream initialization with static library [PR107701]
When linking with a static library, the linker seems to discard a constituent .o object (including its global initializers) if nothing defined in the object is referenced by the program (unless e.g. --whole-archive is used). This behavior breaks iostream with static libstdc++.a (on systems that support init priorities) because we define the global initializer for the standard stream objects in a separate TU (ios_init.cc) from the stream object definitions (globals_io.cc). This patch fixes this by moving the stream initialization object into the same TU that defines the stream objects, so that any use of the streams prevents the linker from discarding this global initializer. PR libstdc++/107701 libstdc++-v3/ChangeLog: * include/std/iostream (__ioinit): Adjust comment. * src/c++98/globals_io.cc: Include "io_base_init.h" here instead of ... * src/c++98/ios_init.cc: ... here. * src/c++98/ios_base_init.h (__ioinit): More comments. * testsuite/17_intro/static.cc: dg-do run instead of just link.
Diffstat (limited to 'gcc/fortran/interface.cc')
0 files changed, 0 insertions, 0 deletions