[binutils-gdb] Use Solaris iconv
Rainer Orth via Gdb-cvs <[email protected]>
| Newsgroups | gmane.comp.gdb.cvs |
|---|---|
| Message-ID | <[email protected]> |
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=ec8449a55b78c618bb9f0214b468d149790024e6 commit ec8449a55b78c618bb9f0214b468d149790024e6 Author: Rainer Orth <[email protected]> Date: Fri Aug 21 08:39:15 2026 +0200 Use Solaris iconv Currently hundreds of tests FAIL on Solaris with warning: could not convert '...' from the host encoding (ISO-8859-1) to UTF-32. This normally should not happen, please file a bug report. This happens because the system headers don't define __STDC_ISO_10646__ which was only introduced in C17. However, Solaris libc only conforms to C11. Consequently PHONY_ICONV is defined, leading to those failures. However, Solaris 11.4 iconv is good enough to use: enabling its use fixes 300+ failures. While it is likely that this also works with older Solaris 11 versions, those are unsupported and no longer tested. In case of problems, one can always use GNU libiconv. The results are on par with those using GNU libiconv 1.17, while forcibly disabling HAVE_ICONV on Linux/x86_64 adds causes the same amount of failures. Tested on sparcv9-sun-solaris2.11, x86_64-pc-solaris2.11, and x86_64-pc-solaris2.11. Diff: --- gdb/gdb_wchar.h | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/gdb/gdb_wchar.h b/gdb/gdb_wchar.h index 8f27f3ba3ce..41faae476f6 100644 --- a/gdb/gdb_wchar.h +++ b/gdb/gdb_wchar.h @@ -34,10 +34,12 @@ functionality is available to the user, but many characters (those outside the narrow range) will be displayed as escapes. - Finally, some systems do not have iconv, or are really broken - (e.g., Solaris, which almost has all of this working, but where - just enough is broken to make it too hard to use). Here we provide - a phony iconv which only handles a single character set, and we + While the Solaris 11.4 system headers don't define __STDC_ISO_10646__ + (it's a C17 addition while Solaris libc only conforms to C11), the + system iconv works well enough. + + Finally, some systems do not have iconv, or are really broken. Here we + provide a phony iconv which only handles a single character set, and we provide wrappers for the wchar_t functionality we use. */ @@ -59,7 +61,8 @@ iconvlist. */ #if defined (HAVE_ICONV) && defined (HAVE_BTOWC) \ && (defined (__STDC_ISO_10646__) \ - || (defined (_LIBICONV_VERSION) && _LIBICONV_VERSION >= 0x108)) + || (defined (_LIBICONV_VERSION) && _LIBICONV_VERSION >= 0x108) \ + || (defined (__sun__) && defined (__svr4__))) using gdb_wchar_t = wchar_t; using gdb_wint_t = wint_t; @@ -88,7 +91,8 @@ using gdb_wint_t = wint_t; Sonoma specifically, but it is desirable for binaries built for older versions of macOS to still work on newer ones such as Sonoma, so there is no version check here for this workaround. */ -#if defined (__STDC_ISO_10646__) || defined (__APPLE__) +#if defined (__STDC_ISO_10646__) || defined (__APPLE__) \ + || (defined (__sun__) && defined (__svr4__)) #define USE_INTERMEDIATE_ENCODING_FUNCTION #define INTERMEDIATE_ENCODING intermediate_encoding () const char *intermediate_encoding (void);