Probe and dlopen() the correct libstdc++ (#46976)
* Probe if system libstdc++ is newer than ours
If the system libstdc++ is detected to be newer, load it.
Otherwise, load the one that we ship. This improves compatibility
with external shared libraries that the user might have on their
system.
Fixes #34276
Co-authored-by: Jameson Nash <vtjnash@gmail.com>
Co-authored-by: Elliot Saba <staticfloat@gmail.com>
* Addressed review comments.
* Change error handling in wrapper functions
Co-authored-by: Jameson Nash <vtjnash@gmail.com>
* Call write_wrapper three times instead of snprintf
Co-authored-by: Jameson Nash <vtjnash@gmail.com>
* Apply suggestions from code review
Co-authored-by: Jameson Nash <vtjnash@gmail.com>
* Update cli/loader_lib.c
Co-authored-by: Jameson Nash <vtjnash@gmail.com>
* Reordered reading and waiting to avoid a deadlock.
* Fixed obvious issues.
* Only load libstdc++ preemptively on linux.
* Update cli/loader_lib.c
Co-authored-by: Jameson Nash <vtjnash@gmail.com>
* Update cli/loader_lib.c
Co-authored-by: Jameson Nash <vtjnash@gmail.com>
* Specified path to bundled libstdc++ on the command line.
* Removed whitespace.
* Update cli/Makefile
Co-authored-by: Jameson Nash <vtjnash@gmail.com>
* Handled make install stringreplace.
* Correctly quoted stringreplace.
* Added -Wl,--enable-new-dtags to prevent DT_RPATH for transitive dependencies
* Updated news entry.
* Added comment about environment variable.
* patched rpath for libgfortran and libLLVM.
* Added explaination to Make.inc
* Removed trailing space
* Removed patchelf for libgfortran, now that BB has been fixed.
* Fixed typos and comments
Co-authored-by: Max Horn <max@quendi.de>
Co-authored-by: Mosè Giordano <mose@gnu.org>
Co-authored-by: Jameson Nash <vtjnash@gmail.com>
Co-authored-by: Elliot Saba <staticfloat@gmail.com>
Co-authored-by: Max Horn <max@quendi.de>