This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch]: Add specific triplet for mingw-w64 runtime and add -municode feature


Hello,

As discussed in earlier threads it is unlikely that MinGW.org's
runtime will soon provide some features of mingw-w64 runtime. So we
discussed in w64 team how to do this in a way letting at least the
opportunity that both projects may join in future time. And we don't
want to be the guys closing the door here. We decided to allow for the
build for our runtime the optional vendor part "w64" in the target
triplet, which enables our additional features. By this we are still
able to build in a compatible way to MinGW's runtime, but allow also
as option the build for our new features.
This patch prepares also the planned multilib feature for gcc 4.5
toolchain we plan. We have to separate here too, as MinGW.org's
runtime isn't able to support x64 target at the moment. Therefore I
cloned the t-mingw32 file as t-mingw-w64 for this. Additional I add
here an mingw-w64 specific opt file for the additional w64 target
specific options (now -municode feature).

ChangeLog

2009-04-20  Kai Tietz  <kai.tietz@onevision.com>

	* config.gcc: Add additional configuration for
	i686-w64-mingw* and x86_64-w64-mingw* triplet.
	* config/i386/mingw-w64.h: New mingw-w64 specific header.
	(CPP_SPEC): Redefine for allowing -municode option.
	(STARTFILE_SPEC): Likewise.
	* config/i386/t-mingw-w64: New.
	* config/i386/mingw-w64.opt: New.
	(municode): Add new target option.
	* doc/invoke.texi (municode): Add documentation for new option.

Tested for i686-pc-mingw32, x86_64-pc-mingw32, and x86_64-w64-mingw32
without regression.

If there aren't any objections in the next 24 hours, I'll commit it to trunk.

Cheers,
Kai


-- 
|  (\_/) This is Bunny. Copy and paste
| (='.'=) Bunny into your signature to help
| (")_(") him gain world domination
Index: gcc/gcc/config.gcc
===================================================================
--- gcc.orig/gcc/config.gcc
+++ gcc/gcc/config.gcc
@@ -1251,17 +1251,35 @@ i[34567]86-*-pe | i[34567]86-*-cygwin*)
 	use_gcc_stdint=wrap
 	;;
 i[34567]86-*-mingw* | x86_64-*-mingw*)
-	tm_file="${tm_file} i386/unix.h i386/bsd.h i386/gas.h dbxcoff.h i386/cygming.h i386/mingw32.h i386/mingw-stdint.h"
+	tm_file="${tm_file} i386/unix.h i386/bsd.h i386/gas.h dbxcoff.h i386/cygming.h i386/mingw32.h"
 	xm_file=i386/xm-mingw32.h
+	# This makes the logic if mingw's or the w64 feature set has to be used
+	case ${target} in
+		*-w64-*)
+			tm_file="${tm_file} i386/mingw-w64.h"
+			tmake_file="${tmake_file} i386/t-mingw-w64"
+			;;
+		*)
+			tmake_file="${tmake_file} i386/t-mingw32"
+			;;
+	esac
+	tm_file="${tm_file} i386/mingw-stdint.h"
 	# This has to match the logic for DWARF2_UNWIND_INFO in gcc/config/i386/cygming.h
 	if test x$sjlj = x0; then
 		tmake_eh_file="i386/t-dw2-eh"
 	else
 		tmake_eh_file="i386/t-sjlj-eh"
 	fi
-	tmake_file="${tmake_file} ${tmake_eh_file} i386/t-cygming i386/t-mingw32"
+	tmake_file="${tmake_file} ${tmake_eh_file} i386/t-cygming"
 	target_gtfiles="\$(srcdir)/config/i386/winnt.c"
 	extra_options="${extra_options} i386/cygming.opt i386/mingw.opt"
+	case ${target} in
+		*-w64-*)
+			extra_options="${extra_options} i386/mingw-w64.opt"
+			;;
+		*)
+			;;
+	esac
 	extra_objs="winnt.o winnt-stubs.o"
 	c_target_objs="${c_target_objs} msformat-c.o"
 	cxx_target_objs="${cxx_target_objs} winnt-cxx.o msformat-c.o"
Index: gcc/gcc/config/i386/mingw-w64.h
===================================================================
--- /dev/null
+++ gcc/gcc/config/i386/mingw-w64.h
@@ -0,0 +1,34 @@
+/* Operating system specific defines to be used when targeting GCC for
+   hosting on Windows 32/64 via mingw-w64 runtime, using GNU tools and
+   the Windows API Library.
+   Copyright (C) 2009,
+   2009 Free Software Foundation, Inc.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GCC; see the file COPYING3.  If not see
+<http://www.gnu.org/licenses/>.  */
+
+/* Enable -municode feature.  */
+
+#undef CPP_SPEC
+#define CPP_SPEC "%{posix:-D_POSIX_SOURCE} %{mthreads:-D_MT} \
+  %{municode:-DUNICODE}"
+
+#undef STARTFILE_SPEC
+#define STARTFILE_SPEC "%{shared|mdll:dllcrt2%O%s} \
+  %{!shared:%{!mdll:%{!municode:crt2%O%s}}} \
+  %{!shared:%{!mdll:%{municode:crt2u%O%s}}} \
+  %{pg:gcrt2%O%s} \
+  crtbegin.o%s"
Index: gcc/gcc/config/i386/t-mingw-w64
===================================================================
--- /dev/null
+++ gcc/gcc/config/i386/t-mingw-w64
@@ -0,0 +1,5 @@
+# Match SYSTEM_INCLUDE_DIR
+NATIVE_SYSTEM_HEADER_DIR = /mingw/include
+
+# MinGW-specific parts of LIB_SPEC
+SHLIB_LC = -lmingw32 -lmingwex -lmoldname -lmsvcrt -luser32 -lkernel32 -ladvapi32 -lshell32
Index: gcc/gcc/config/i386/mingw-w64.opt
===================================================================
--- /dev/null
+++ gcc/gcc/config/i386/mingw-w64.opt
@@ -0,0 +1,23 @@
+; MinGW-w64-specific options.
+
+; Copyright (C) 2009 Free Software Foundation, Inc.
+;
+; This file is part of GCC.
+;
+; GCC is free software; you can redistribute it and/or modify it under
+; the terms of the GNU General Public License as published by the Free
+; Software Foundation; either version 3, or (at your option) any later
+; version.
+;
+; GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+; WARRANTY; without even the implied warranty of MERCHANTABILITY or
+; FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+; for more details.
+;
+; You should have received a copy of the GNU General Public License
+; along with GCC; see the file COPYING3.  If not see
+; <http://www.gnu.org/licenses/>.
+
+municode
+Target
+Use unicode startup and define UNICODE macro
Index: gcc/gcc/doc/invoke.texi
===================================================================
--- gcc.orig/gcc/doc/invoke.texi
+++ gcc/gcc/doc/invoke.texi
@@ -828,7 +828,7 @@ See i386 and x86-64 Options.
 
 @emph{i386 and x86-64 Windows Options}
 @gccoptlist{-mconsole -mcygwin -mno-cygwin -mdll
--mnop-fun-dllimport -mthread -mwin32 -mwindows}
+-mnop-fun-dllimport -mthread -municode -mwin32 -mwindows}
 
 @emph{Xstormy16 Options}
 @gccoptlist{-msim}
@@ -15605,6 +15605,12 @@ specifies that the dllimport attribute s
 This option is available for MinGW targets. It specifies
 that MinGW-specific thread support is to be used.
 
+@item -municode
+@opindex municode
+This option is available for mingw-w64 targets.  It specifies
+that the UNICODE macro is getting pre-defined and that the
+unicode capable runtime startup code is choosen.
+
 @item -mwin32
 @opindex mwin32
 This option is available for Cygwin and MinGW targets.  It

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]