* [PATCH] Use Solaris iconv
@ 2026-08-19 12:23 Rainer Orth
2026-08-20 16:33 ` Tom Tromey
0 siblings, 1 reply; 6+ messages in thread
From: Rainer Orth @ 2026-08-19 12:23 UTC (permalink / raw)
To: gdb-patches
[-- 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);
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Use Solaris iconv
2026-08-19 12:23 [PATCH] Use Solaris iconv Rainer Orth
@ 2026-08-20 16:33 ` Tom Tromey
2026-08-20 18:00 ` Rainer Orth
0 siblings, 1 reply; 6+ messages in thread
From: Tom Tromey @ 2026-08-20 16:33 UTC (permalink / raw)
To: Rainer Orth; +Cc: gdb-patches
>>>>> "Rainer" == Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> writes:
Rainer> However, Solaris 11.4 iconv is good enough to use: enabling its use
Rainer> fixes 300+ failures.
Rainer> Ok for trunk?
I think it's fine, but my question here is whether gdb intends to
support versions of Solaris where this might not work.
Rainer> - Finally, some systems do not have iconv, or are really broken
Rainer> - (e.g., Solaris, which almost has all of this working, but where
Rainer> - just enough is broken to make it too hard to use). Here we provide
Rainer> - a phony iconv which only handles a single character set, and we
Ages ago I wrote this text, and it was true at the time. IIRC, Solaris
back then used some undocumented, idiosyncratic, system-specific wchar_t
encoding and there was no way to convert from the regular encodings to
wchar_t via iconv, or something like that.
I don't know when Solaris changed to using Unicode.
Anyway I guess the question I have is whether this:
Rainer> - || (defined (_LIBICONV_VERSION) && _LIBICONV_VERSION >= 0x108))
Rainer> + || (defined (_LIBICONV_VERSION) && _LIBICONV_VERSION >= 0x108) \
Rainer> + || (defined (__sun__) && defined (__svr4__)))
... should check some kind of Solaris version.
If not, maybe adding some note to the commit message on this topic would
be nice to have.
thanks,
Tom
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Use Solaris iconv
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
0 siblings, 2 replies; 6+ messages in thread
From: Rainer Orth @ 2026-08-20 18:00 UTC (permalink / raw)
To: Tom Tromey; +Cc: gdb-patches
Hi Tom,
>>>>>> "Rainer" == Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> writes:
>
> Rainer> However, Solaris 11.4 iconv is good enough to use: enabling its use
> Rainer> fixes 300+ failures.
>
> Rainer> Ok for trunk?
>
> I think it's fine, but my question here is whether gdb intends to
> support versions of Solaris where this might not work.
I've thought about this but decided not to care for anything but Solaris
11.4 for a couple of reasons:
* Over in GCC, I've obsoleted all versions up to and including 11.3 in
GCC 13. Support was finally removed in GCC 15. In all that time, I'm
not aware of even a single complaint about this.
* Even though GDB might well work on pre-11.4 versions, I'm certainly
not going to test this. Howver, unless someone else steps forward to
do so, untested support is useless IMO
* Right now, without this patch, users get confusing warnings and tons
of errors, so this is a massive improvement at little cost, so anyone
using 11.4 benefits without further effort, rather than having to use
GNU libiconv, which isn't bundled with Solaris.
* Solaris iconv certainly has it's issues. However, when investigating
GCC PR c++/112652, I learned that it hasn't been touched in many
years, so it's unlikely that there are considerable changes since at
least Solaris 11.0 15 years ago.
* Last but not least, users always have the option to use GNU libiconv
instead.
> Rainer> - Finally, some systems do not have iconv, or are really broken
> Rainer> - (e.g., Solaris, which almost has all of this working, but where
> Rainer> - just enough is broken to make it too hard to use). Here we provide
> Rainer> - a phony iconv which only handles a single character set, and we
>
> Ages ago I wrote this text, and it was true at the time. IIRC, Solaris
> back then used some undocumented, idiosyncratic, system-specific wchar_t
> encoding and there was no way to convert from the regular encodings to
> wchar_t via iconv, or something like that.
>
> I don't know when Solaris changed to using Unicode.
Me neither: I'd guess it was in the Solaris 10 timeframe (21 years ago
now), when POSIX.1-2001 support was introduced. TBH I haven't
researched since that's all ancient history now.
> Anyway I guess the question I have is whether this:
>
> Rainer> - || (defined (_LIBICONV_VERSION) && _LIBICONV_VERSION >= 0x108))
> Rainer> + || (defined (_LIBICONV_VERSION) && _LIBICONV_VERSION >= 0x108) \
> Rainer> + || (defined (__sun__) && defined (__svr4__)))
>
> ... should check some kind of Solaris version.
I guess there's no use in that. While Studio cc predefines
__SunOS_RELEASE, gcc does not, so this would have to be done via a
configure test. Not worth the trouble, I believe.
> If not, maybe adding some note to the commit message on this topic would
> be nice to have.
Will do.
BTW., given the benefit and no impact for other OSes, this might be a
candidate for the GDB 18 release. Thoughts?
Thanks.
Rainer
--
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Use Solaris iconv
2026-08-20 18:00 ` Rainer Orth
@ 2026-08-20 18:27 ` Simon Marchi
2026-08-21 15:08 ` Tom Tromey
1 sibling, 0 replies; 6+ messages in thread
From: Simon Marchi @ 2026-08-20 18:27 UTC (permalink / raw)
To: Rainer Orth, Tom Tromey; +Cc: gdb-patches
On 8/20/26 2:00 PM, Rainer Orth wrote:
> BTW., given the benefit and no impact for other OSes, this might be a
> candidate for the GDB 18 release. Thoughts?
I don't know enough to comment on the patch itself, but yes I think it's
fine to put on the GDB 18 branch.
Simon
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Use Solaris iconv
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
1 sibling, 1 reply; 6+ messages in thread
From: Tom Tromey @ 2026-08-21 15:08 UTC (permalink / raw)
To: Rainer Orth; +Cc: Tom Tromey, gdb-patches
>>>>> "Rainer" == Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> writes:
Rainer> I've thought about this but decided not to care for anything but Solaris
Rainer> 11.4 for a couple of reasons:
[...]
Thank you.
>> If not, maybe adding some note to the commit message on this topic would
>> be nice to have.
Rainer> Will do.
Rainer> BTW., given the benefit and no impact for other OSes, this might be a
Rainer> candidate for the GDB 18 release. Thoughts?
Ok for both, thanks a lot.
Approved-By: Tom Tromey <tom@tromey.com>
Tom
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Use Solaris iconv
2026-08-21 15:08 ` Tom Tromey
@ 2026-08-22 20:19 ` Rainer Orth
0 siblings, 0 replies; 6+ messages in thread
From: Rainer Orth @ 2026-08-22 20:19 UTC (permalink / raw)
To: Tom Tromey; +Cc: gdb-patches
Hi Tom,
>>>>>> "Rainer" == Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> writes:
> Rainer> BTW., given the benefit and no impact for other OSes, this might be a
> Rainer> candidate for the GDB 18 release. Thoughts?
>
> Ok for both, thanks a lot.
> Approved-By: Tom Tromey <tom@tromey.com>
I'd already committed the patch to both trunk and gdb-18 branch, sorry.
I'm still a bit confused about the differences in procedure and commit
message contents between gdb, binutils, and gcc.
Thinks like no ChangeLogs in gdb, only in commit message in binutils,
and both in commit message and extracted into actual ChangeLog files in
gcc. Just an ok/lgtm being enough in gcc and binutils vs. git trailers
in gdb... It's harder to wrap your head around this especially if you
only contribute occasionally.
Rainer
--
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2026-08-22 20:19 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-08-19 12:23 [PATCH] Use Solaris iconv Rainer Orth
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
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox