From: Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
To: gdb-patches@sourceware.org
Subject: [PATCH] Use Solaris iconv
Date: Wed, 19 Aug 2026 14:23:57 +0200 [thread overview]
Message-ID: <yddwltmjo2q.fsf@CeBiTec.Uni-Bielefeld.DE> (raw)
[-- Attachment #1: Type: text/plain, Size: 904 bytes --]
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.
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.
Ok for trunk?
Rainer
--
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: sol2-iconv.patch --]
[-- Type: text/x-patch, Size: 1949 bytes --]
# HG changeset patch
# Parent 97bd89d84470fc76016c1f0a387cad83b62d0c7a
Use Solaris iconv
diff --git a/gdb/gdb_wchar.h b/gdb/gdb_wchar.h
--- 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);
next reply other threads:[~2026-08-19 12:24 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-19 12:23 Rainer Orth [this message]
2026-08-20 16:33 ` Tom Tromey
2026-08-20 18:00 ` Rainer Orth
2026-08-20 18:27 ` Simon Marchi
2026-08-21 15:08 ` Tom Tromey
2026-08-22 20:19 ` Rainer Orth
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=yddwltmjo2q.fsf@CeBiTec.Uni-Bielefeld.DE \
--to=ro@cebitec.uni-bielefeld.de \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox