https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103407

--- Comment #12 from Jonathan Wakely <redi at gcc dot gnu.org> ---
I tried this instead, but I think this still counts as "binding the same symbol
to different versions", and didn't work:

#if defined __sun__ && defined _GLIBCXX_HAVE_USELOCALE
#if defined(_GLIBCXX_SYMVER_SUN) && defined(_GLIBCXX_SHARED) \
    && defined(_GLIBCXX_HAVE_AS_SYMVER_DIRECTIVE)
// Solaris 11.4 supports uselocale, so std::from_chars is present since gcc-11
// with symbol version GLIBCXX_3.4.29. Solaris 11.3 does not support uselocale
// so std::from_chars is not present until gcc-12, with version GLIBCXX_3.4.30.
// Define aliases so that code linked on Solaris 11.3 runs on 11.4 too.
from_chars_result
__from_chars_compat(const char* first, const char* last,
                    double& value, chars_format fmt) noexcept
{ return std::from_chars(first, last, value, fmt); }
asm(".symver _ZSt19__from_chars_compatPKcS0_RdSt12chars_format,
_ZSt10from_charsPKcS0_RdSt12chars_formaT@GLIBCXX_3.4.30");
from_chars_result
__from_chars_compat(const char* first, const char* last,
                    long double& value, chars_format fmt) noexcept
{ return std::from_chars(first, last, value, fmt); }
asm(".symver _ZSt19__from_chars_compatPKcS0_ReSt12chars_format,
_ZSt10from_charsPKcS0_ReSt12chars_formaT@GLIBCXX_3.4.30");
from_chars_result
__from_chars_compat(const char* first, const char* last,
                    float& value, chars_format fmt) noexcept
{ return std::from_chars(first, last, value, fmt); }
asm(".symver _ZSt19__from_chars_compatPKcS0_RfSt12chars_format,
_ZSt10from_charsPKcS0_RfSt12chars_formaT@GLIBCXX_3.4.30");
#endif
#endif

This does get compiled, but I don't see those @GLIBCXX_3.4.30 symbols in the
DSO. Maybe I'm missing something that would make them exported as global
symbols, or maybe this just can't be done on Solaris.

Reply via email to