public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Costas Argyris <costas.argyris@gmail.com>
To: gcc-patches@gcc.gnu.org
Cc: Jonathan Yong <10walls@gmail.com>, Jacek Caban <jacek@codeweavers.com>
Subject: Re: Enable UTF-8 code page in driver and compiler on 64-bit mingw host [PR108865]
Date: Mon, 27 Mar 2023 18:17:57 +0100	[thread overview]
Message-ID: <CAHyHGCkfi=umcUHvYJCwFGQtUqmZM2vBYcLBksBpi5bQnOcyeQ@mail.gmail.com> (raw)
In-Reply-To: <002e2259-1859-1f77-ffa0-40b1b673dd4f@gmail.com>


[-- Attachment #1.1: Type: text/plain, Size: 1257 bytes --]

The patch attached to this email extends the UTF-8 support of the
driver and compiler processes to the 32-bit mingw host.    Initially,
only the 64-bit host got it.

About the changes in sym-mingw32.cc:

Even though the 64-bit host was building fine with the symbol being
simply declared as a char, the 32-bit host was failing to find the
symbol at link time because a leading underscore was being added
to it by the compiler.    The asm keyword ensures that the symbol
always appears with that exact name, such that the linker will
always find it.

The patch also includes Jacek's flag about adding the .manifest file
as a prerequisite for the object file (this was actually done from before
but an earlier version of the patch was pushed so it was missed).

Tested building from master for both 32 and 64-bit mingw hosts using:

1) cross-compilation from a Debian machine using configure + make
2) native-compilation from a Windows machine using MSYS2

On Thu, 9 Mar 2023 at 15:03, Jonathan Yong <10walls@gmail.com> wrote:

> On 3/9/23 13:33, Costas Argyris wrote:
> > Pinging the list and mingw maintainer.
> >
> > Analysis and pre-approval here:
> >
> > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108865
> >
>
> Thanks, pushed to master branch.
>
>
>

[-- Attachment #2: 0001-Extend-UTF-8-support-to-the-32-bit-mingw-host.patch --]
[-- Type: text/x-patch, Size: 2373 bytes --]

From 0ed08739f44116eaef46b552df923959ba945afa Mon Sep 17 00:00:00 2001
From: Costas Argyris <costas.argyris@gmail.com>
Date: Sun, 26 Mar 2023 11:32:13 +0100
Subject: [PATCH] Extend UTF-8 support to the 32-bit mingw host.

Prevent any name mangling in HOST_EXTRA_OBJS_SYMBOL
such that the linker always finds it by that name.

Also add the .manifest file as an explicit
dependency in the make rule such that the
object gets re-built if it changes.
---
 gcc/config.host                | 5 +++--
 gcc/config/i386/sym-mingw32.cc | 4 +++-
 gcc/config/i386/x-mingw32-utf8 | 3 ++-
 3 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/gcc/config.host b/gcc/config.host
index 4abb32ad73d..5df85752ed4 100644
--- a/gcc/config.host
+++ b/gcc/config.host
@@ -232,10 +232,11 @@ case ${host} in
     ;;
   i[34567]86-*-mingw32*)
     host_xm_file=i386/xm-mingw32.h
-    host_xmake_file="${host_xmake_file} i386/x-mingw32"
+    host_xmake_file="${host_xmake_file} i386/x-mingw32 i386/x-mingw32-utf8"
     host_exeext=.exe
     out_host_hook_obj=host-mingw32.o
-    host_extra_gcc_objs="${host_extra_gcc_objs} driver-mingw32.o"
+    host_extra_objs="${host_extra_objs} utf8-mingw32.o"
+    host_extra_gcc_objs="${host_extra_gcc_objs} driver-mingw32.o utf8rc-mingw32.o"
     host_lto_plugin_soname=liblto_plugin.dll
     ;;
   x86_64-*-mingw*)
diff --git a/gcc/config/i386/sym-mingw32.cc b/gcc/config/i386/sym-mingw32.cc
index f369698abc4..2f8dee6c1ec 100644
--- a/gcc/config/i386/sym-mingw32.cc
+++ b/gcc/config/i386/sym-mingw32.cc
@@ -1 +1,3 @@
-char HOST_EXTRA_OBJS_SYMBOL;
+/* Prevent any name mangling to make sure that the linker
+   will always find the symbol. */
+char HOST_EXTRA_OBJS_SYMBOL asm ("HOST_EXTRA_OBJS_SYMBOL");
diff --git a/gcc/config/i386/x-mingw32-utf8 b/gcc/config/i386/x-mingw32-utf8
index 9de963d7965..cf5c3db3d8b 100644
--- a/gcc/config/i386/x-mingw32-utf8
+++ b/gcc/config/i386/x-mingw32-utf8
@@ -27,7 +27,8 @@
 # The resulting .o file gets added to host_extra_gcc_objs in
 # config.host for x86_64-*-mingw* host and gets linked into
 # the driver as a .o file, so it's lack of symbols is OK.
-utf8rc-mingw32.o : $(srcdir)/config/i386/utf8-mingw32.rc
+utf8rc-mingw32.o : $(srcdir)/config/i386/utf8-mingw32.rc \
+  $(srcdir)/config/i386/winnt-utf8.manifest
 	$(WINDRES) $< $@
 
 # Create an object file that just exports the global symbol
-- 
2.30.2


  reply	other threads:[~2023-03-27 17:18 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-07  0:52 Costas Argyris
2023-03-07 12:01 ` Jacek Caban
2023-03-07 14:00   ` Costas Argyris
2023-03-07 14:17     ` Jacek Caban
2023-03-07 15:27       ` Costas Argyris
2023-03-08 10:52         ` Costas Argyris
2023-03-09 13:33           ` Costas Argyris
2023-03-09 15:03             ` Jonathan Yong
2023-03-27 17:17               ` Costas Argyris [this message]
2023-03-28  8:05                 ` Jonathan Yong
2023-03-28 10:43                   ` Costas Argyris
2023-03-28 12:03                     ` Jonathan Yong

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='CAHyHGCkfi=umcUHvYJCwFGQtUqmZM2vBYcLBksBpi5bQnOcyeQ@mail.gmail.com' \
    --to=costas.argyris@gmail.com \
    --cc=10walls@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jacek@codeweavers.com \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).