We cannot assume that libstdc++.so.6 performs std::cout etc. initialization, so the GTS header files need to keep using the old initialization model. Otherwise, things will build and link just fine, but the initialization might not happen as expected. Note: Needs to be transitioned to the gcc-toolset-13-gcc component once that exists.
Jakub suggests that we could pull in an ELF constructor in libstdc++_nonshared.a instead (with an appropriate early priority).
Do we want to revert these two commits or some other ones as well? 9a41d2cdbcd2af77a3a91a840a3a13f0eb39971b 4e4e3ffd10f53ef71696bc728ab40258751a2df4
Created attachment 1969733 [details] Revert ios init changes Makes sense to me. I think you also want 87de39e4c3686535728f3a347f772e73af4cf262 (as the first one to revert). There will be conflicts though, so I've attached a patch that does it cleanly.
I believe what is in the patch should work fine. If not, the reversions would break the gcc13-libstdc++-compat.patch though.
Thanks Jonathan. (In reply to Jakub Jelinek from comment #4) > I believe what is in the patch should work fine. the patch = Jon's #c3 patch? Or gcc13-libstdc++-compat.patch and you actually don't want the reversion? > If not, the reversions would break the gcc13-libstdc++-compat.patch though. Relatedly, I see +_ZSt21ios_base_library_initv FUNC GLOBAL DEFAULT in our 'diff -up system2vanilla.abilist.diff nonshared.abilist' testing. Should _ZSt21ios_base_library_initv be .hidden as well?
I meant gcc13-libstdc++-compat.patch . What is in there is that if you #include <iostream>, you require _ZSt21ios_base_library_initv symbol, and the object that provides that symbol (in libstdc++_nonshared.a) should initialize iostreams. So, instead of the old initializing per TU, it is now effectively initialization per library or binary. While upstream has it in libstdc++.so.6 only which does that initialization. I think the symbol shouldn't be hidden, we don't make the symbols from the system libstdc++.so.6 to libstdc++.so.6.0.32 diff hidden. If some other library exports it already and you link against that library, the libstdc++_nonshared.a object might not be linked in, sure, but then the dependent library should have initialized iostreams before running current library's constructors.
Ok, let's give it (= no reversion) a shot. I'm also going to keep _ZSt21ios_base_library_initv non-hidden. If we run into issues, we can consider reverting the optimization again. Thanks.