Skip to content

Commit

Permalink
Extend UTF-8 support to the 32-bit mingw host.
Browse files Browse the repository at this point in the history
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/ChangeLog:

	* config.host: Pull in i386/x-mingw32-utf8 Makefile
	fragment and reference utf8rc-mingw32.o explicitly
	for mingw hosts.
	* config/i386/sym-mingw32.cc: prevent name mangling of
	stub symbol.
	* config/i386/x-mingw32-utf8: Make utf8rc-mingw32.o
	depend on manifest file explicitly.

Signed-off-by: Jonathan Yong <10walls@gmail.com>
  • Loading branch information
Costas Argyris authored and jon-y committed Mar 28, 2023
1 parent b462947 commit 304c7d4
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
5 changes: 3 additions & 2 deletions gcc/config.host
Original file line number Diff line number Diff line change
Expand Up @@ -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*)
Expand Down
4 changes: 3 additions & 1 deletion gcc/config/i386/sym-mingw32.cc
Original file line number Diff line number Diff line change
@@ -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");
3 changes: 2 additions & 1 deletion gcc/config/i386/x-mingw32-utf8
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 304c7d4

Please sign in to comment.