[v1,05/13] Reuse MinGW from i386 for AArch64

Message ID VI1PR83MB043139E6AF69788B3333EE6BF8572@VI1PR83MB0431.EURPRD83.prod.outlook.com
State New
Headers
Series Add aarch64-w64-mingw32 target |

Commit Message

Evgeny Karpov Feb. 21, 2024, 6:34 p.m. UTC
  From 408ca45f7c5c6e58208a7b8004f764dc0c1afdd3 Mon Sep 17 00:00:00 2001
From: Zac Walker <zacwalker@microsoft.com>
Date: Tue, 20 Feb 2024 18:15:27 +0100
Subject: [PATCH v1 05/13] Reuse MinGW from i386 for AArch64

This patch creates a new config/mingw directory to share MinGW
related definitions, and moves there the corresponding existing files
from config/i386. It also makes uses of them on the new
aarch64-w64-mingw32 target.

gcc/ChangeLog:

	* config.gcc: Adjust targets after moving MinGW related files
	from i386 to mingw folder.
	* config/i386/cygming.opt: Moved to...
	* config/mingw/cygming.opt: ...here.
	* config/i386/cygming.opt.urls: Moved to...
	* config/mingw/cygming.opt.urls: ...here.
	* config/i386/cygwin-d.cc: Moved to...
	* config/mingw/cygwin-d.cc: ...here.
	* config/i386/mingw-stdint.h: Moved to...
	* config/mingw/mingw-stdint.h: ...here.
	* config/i386/mingw.opt: Moved to...
	* config/mingw/mingw.opt: ...here.
	* config/i386/mingw.opt.urls: Moved to...
	* config/mingw/mingw.opt.urls: ...here.
	* config/i386/mingw32.h: Moved to...
	* config/mingw/mingw32.h: ...here.
	* config/i386/msformat-c.cc: Moved to...
	* config/mingw/msformat-c.cc: ...here.
	* config/i386/t-cygming: Moved to...
	* config/mingw/t-cygming: ...here and updated.
	* config/i386/winnt-cxx.cc: Moved to...
	* config/mingw/winnt-cxx.cc: ...here.
	* config/i386/winnt-d.cc: Moved to...
	* config/mingw/winnt-d.cc: ...here.
	* config/i386/winnt-stubs.cc: Moved to...
	* config/mingw/winnt-stubs.cc: ...here.
	* config/i386/winnt.cc: Moved to...
	* config/mingw/winnt.cc: ...here.
---
 gcc/config.gcc                              | 25 ++++++++++++---------
 gcc/config/{i386 => mingw}/cygming.opt      |  0
 gcc/config/{i386 => mingw}/cygming.opt.urls |  0
 gcc/config/{i386 => mingw}/cygwin-d.cc      |  0
 gcc/config/{i386 => mingw}/mingw-stdint.h   |  0
 gcc/config/{i386 => mingw}/mingw.opt        |  0
 gcc/config/{i386 => mingw}/mingw.opt.urls   |  0
 gcc/config/{i386 => mingw}/mingw32.h        |  0
 gcc/config/{i386 => mingw}/msformat-c.cc    |  0
 gcc/config/{i386 => mingw}/t-cygming        | 23 ++++++++++---------
 gcc/config/{i386 => mingw}/winnt-cxx.cc     |  0
 gcc/config/{i386 => mingw}/winnt-d.cc       |  0
 gcc/config/{i386 => mingw}/winnt-stubs.cc   |  0
 gcc/config/{i386 => mingw}/winnt.cc         |  0
 14 files changed, 27 insertions(+), 21 deletions(-)
 rename gcc/config/{i386 => mingw}/cygming.opt (100%)
 rename gcc/config/{i386 => mingw}/cygming.opt.urls (100%)
 rename gcc/config/{i386 => mingw}/cygwin-d.cc (100%)
 rename gcc/config/{i386 => mingw}/mingw-stdint.h (100%)
 rename gcc/config/{i386 => mingw}/mingw.opt (100%)
 rename gcc/config/{i386 => mingw}/mingw.opt.urls (100%)
 rename gcc/config/{i386 => mingw}/mingw32.h (100%)
 rename gcc/config/{i386 => mingw}/msformat-c.cc (100%)
 rename gcc/config/{i386 => mingw}/t-cygming (73%)
 rename gcc/config/{i386 => mingw}/winnt-cxx.cc (100%)
 rename gcc/config/{i386 => mingw}/winnt-d.cc (100%)
 rename gcc/config/{i386 => mingw}/winnt-stubs.cc (100%)
 rename gcc/config/{i386 => mingw}/winnt.cc (100%)
  

Comments

Andrew Pinski Feb. 21, 2024, 6:50 p.m. UTC | #1
On Wed, Feb 21, 2024 at 10:38 AM Evgeny Karpov
<Evgeny.Karpov@microsoft.com> wrote:
>
>

In config/i386/winnt.cc there are many x86_64 comments and many
function names that use i386 in them? When moving it seems like better
to rename them and remove references to 86.
I don't see any changes that rename the functions or comments there.

Thanks,
Andrew
  
Bernhard Reutner-Fischer Feb. 21, 2024, 9:34 p.m. UTC | #2
On 21 February 2024 19:34:43 CET, Evgeny Karpov <Evgeny.Karpov@microsoft.com> wrote:
>

Please use git send-email. Your mail ends up as empty as here, otherwise.

The ChangeLog has to be expressed in present tense, as mandated by the standard; s/Moved/Move/g etc.

In any sane world ( and in gcc ) to fold, respectively a folder, is something else compared to a directory ( which you probably mean when moving a file from one directory to another directory as you seem to do ).

Most of the free world has left COFF behind since several decades, so I won't comment on that. YMMV.

HTH
  
Richard Earnshaw (lists) Feb. 22, 2024, 11:11 a.m. UTC | #3
On 21/02/2024 21:34, rep.dot.nop@gmail.com wrote:
> On 21 February 2024 19:34:43 CET, Evgeny Karpov <Evgeny.Karpov@microsoft.com> wrote:
>>
> 
> Please use git send-email. Your mail ends up as empty as here, otherwise.

I don't see anything wrong with it; niether does patchwork (https://patchwork.sourceware.org/project/gcc/list/?series=31191) nor does the Linaro CI bot.  So perhaps it's your mailer that's misconfigured.

> 
> The ChangeLog has to be expressed in present tense, as mandated by the standard; s/Moved/Move/g etc.

Agreed, but that's a detail that we can get to once the patch has been properly reviewed.

> 
> In any sane world ( and in gcc ) to fold, respectively a folder, is something else compared to a directory ( which you probably mean when moving a file from one directory to another directory as you seem to do ).
> 
> Most of the free world has left COFF behind since several decades, so I won't comment on that. YMMV.

This isn't helpful.  Windows platforms use (a derivative of) COFF, so that's what the tools need to use when targetting that platform.

R.
  
Evgeny Karpov Feb. 22, 2024, 3:39 p.m. UTC | #4
Hello Andrew,

Thank you for the review!

Renaming functions and comments that reference functions with the
i386_ prefix can trigger extensive changes. This task should
ideally be handled in a separate follow-up patch.

The primary goal of the renaming changes in
https://gcc.gnu.org/pipermail/gcc-patches/attachments/20240221/8f41fb9a/attachment-0001.txt 
was to avoid direct references from the aarch64 target to 
functions with i386_ prefix.

Regards,
Evgeny

-----Original Message-----
Wednesday, February 21, 2024 7:50 PM
Andrew Pinski wrote:

On Wed, Feb 21, 2024 at 10:38 AM Evgeny Karpov <Evgeny.Karpov@microsoft.com> wrote:
>
>

In config/i386/winnt.cc there are many x86_64 comments and many function names that use i386 in them? When moving it seems like better to rename them and remove references to 86.
I don't see any changes that rename the functions or comments there.

Thanks,
Andrew
  
Evgeny Karpov Feb. 22, 2024, 3:56 p.m. UTC | #5
A ChangeLog template using "Moved... ...here" has been generated by contrib/mklog.py.
It seems that it needs modification.

Regards,
Evgeny

-----Original Message-----
Thursday, February 22, 2024 12:11 PM
Richard Earnshaw (lists) wrote:

> The ChangeLog has to be expressed in present tense, as mandated by the standard; s/Moved/Move/g etc.

Agreed, but that's a detail that we can get to once the patch has been properly reviewed.
  
Joseph Myers Feb. 22, 2024, 5:54 p.m. UTC | #6
On Thu, 22 Feb 2024, Richard Earnshaw (lists) wrote:

> On 21/02/2024 21:34, rep.dot.nop@gmail.com wrote:
> > On 21 February 2024 19:34:43 CET, Evgeny Karpov <Evgeny.Karpov@microsoft.com> wrote:
> >>
> > 
> > Please use git send-email. Your mail ends up as empty as here, otherwise.
> 
> I don't see anything wrong with it; niether does patchwork 
> (https://patchwork.sourceware.org/project/gcc/list/?series=31191) nor 
> does the Linaro CI bot.  So perhaps it's your mailer that's 
> misconfigured.

The first part of the multipart/mixed message is empty (well, two blank 
lines).  The second part, the patch, has Content-Disposition: attachment, 
so it's correct for a mailer not to show it inline (instead showing an 
empty message with an attachment - which is how it appeared to me).
  
Bernhard Reutner-Fischer Feb. 23, 2024, 8:59 p.m. UTC | #7
On Thu, 22 Feb 2024 15:56:46 +0000
Evgeny Karpov <Evgeny.Karpov@microsoft.com> wrote:

> A ChangeLog template using "Moved... ...here" has been generated by contrib/mklog.py.
> It seems that it needs modification.
> 
> Regards,
> Evgeny
> 
> -----Original Message-----
> Thursday, February 22, 2024 12:11 PM
> Richard Earnshaw (lists) wrote:
> 
> > The ChangeLog has to be expressed in present tense, as mandated by the standard; s/Moved/Move/g etc.  
> 
> Agreed, but that's a detail that we can get to once the patch has been properly reviewed.
> 

Excellent, two patches for the price of one :)

diff --git a/contrib/mklog.py b/contrib/mklog.py
index d764fb41f99..7d8d554b15e 100755
--- a/contrib/mklog.py
+++ b/contrib/mklog.py
@@ -277,7 +277,7 @@ def generate_changelog(data, no_functions=False, fill_pr_titles=False,
                 # it used to be path.source_file[2:]
                 relative_path = get_rel_path_if_prefixed(file.source_file[2:],
                                                          changelog)
-                out = append_changelog_line(out, relative_path, 'Moved to...')
+                out = append_changelog_line(out, relative_path, 'Move to...')
                 new_path = get_rel_path_if_prefixed(file.target_file[2:],
                                                     changelog)
                 out += f'\t* {new_path}: ...here.\n'


cheers
  
Mark Harmstone Feb. 25, 2024, 9:12 p.m. UTC | #8
On 22/2/24 11:11, Richard Earnshaw (lists) wrote:
>> Most of the free world has left COFF behind since several decades, so I won't comment on that. YMMV.
> This isn't helpful.  Windows platforms use (a derivative of) COFF, so that's what the tools need to use when targetting that platform.

Also, there are relocation types needed for Windows programs that are supported in COFF but not in ELF object files.

Mark
  
Bernhard Reutner-Fischer Feb. 26, 2024, 8:17 a.m. UTC | #9
On Sun, 25 Feb 2024 at 22:12, Mark Harmstone <mark@harmstone.com> wrote:
> Also, there are relocation types needed for Windows programs that are supported in COFF but not in ELF object files.
>

Right, it's been a long time since i last dealt with PECOFF and i had
assumed that things might have changed in the meantime.

PS: Please don't forget to add an entry to contrib/config-list.mk
thanks
  
Evgeny Karpov Feb. 26, 2024, 6:31 p.m. UTC | #10
Thank you for the fix, Bernhard! Please send it as a separate patch.

Regards,
Evgeny

-----Original Message-----
Sent: Monday, February 26, 2024 9:18 AM
Bernhard Reutner-Fischer 

PS: Please don't forget to add an entry to contrib/config-list.mk thanks
  

Patch

diff --git a/gcc/config.gcc b/gcc/config.gcc
index 34c7be72fb6..498ee702607 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -1265,7 +1265,10 @@  aarch64*-*-linux*)
 	;;
 aarch64*-*-mingw*)
 	tm_file="${tm_file} aarch64/aarch64-coff.h"
+	tm_file="${tm_file} mingw/mingw32.h"
+	tm_file="${tm_file} mingw/mingw-stdint.h"
 	tmake_file="${tmake_file} aarch64/t-aarch64"
+	target_gtfiles="$target_gtfiles \$(srcdir)/config/mingw/winnt.cc"
 	case ${enable_threads} in
 	  "" | yes | win32)
 	    thread_file='win32'
@@ -2161,9 +2164,9 @@  i[4567]86-wrs-vxworks*|x86_64-wrs-vxworks7*)
 i[34567]86-*-cygwin*)
 	tm_file="${tm_file} i386/unix.h i386/bsd.h i386/gas.h i386/cygming.h i386/cygwin.h i386/cygwin-stdint.h"
 	xm_file=i386/xm-cygwin.h
-	tmake_file="${tmake_file} i386/t-cygming t-slibgcc"
-	target_gtfiles="$target_gtfiles \$(srcdir)/config/i386/winnt.cc"
-	extra_options="${extra_options} i386/cygming.opt i386/cygwin.opt"
+	tmake_file="${tmake_file} mingw/t-cygming t-slibgcc"
+	target_gtfiles="$target_gtfiles \$(srcdir)/config/mingw/winnt.cc"
+	extra_options="${extra_options} mingw/cygming.opt i386/cygwin.opt"
 	extra_objs="${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"
@@ -2179,9 +2182,9 @@  x86_64-*-cygwin*)
 	need_64bit_isa=yes
 	tm_file="${tm_file} i386/unix.h i386/bsd.h i386/gas.h i386/cygming.h i386/cygwin.h i386/cygwin-w64.h i386/cygwin-stdint.h"
 	xm_file=i386/xm-cygwin.h
-	tmake_file="${tmake_file} i386/t-cygming t-slibgcc"
-	target_gtfiles="$target_gtfiles \$(srcdir)/config/i386/winnt.cc"
-	extra_options="${extra_options} i386/cygming.opt i386/cygwin.opt"
+	tmake_file="${tmake_file} mingw/t-cygming t-slibgcc"
+	target_gtfiles="$target_gtfiles \$(srcdir)/config/mingw/winnt.cc"
+	extra_options="${extra_options} mingw/cygming.opt i386/cygwin.opt"
 	extra_objs="${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"
@@ -2217,7 +2220,7 @@  i[34567]86-*-mingw* | x86_64-*-mingw*)
 	if test x$enable_threads = xmcf ; then
 		tm_file="${tm_file} i386/mingw-mcfgthread.h"
 	fi
-	tm_file="${tm_file} i386/mingw32.h"
+	tm_file="${tm_file} mingw/mingw32.h"
 	# This makes the logic if mingw's or the w64 feature set has to be used
 	case ${target} in
 		*-w64-*)
@@ -2246,8 +2249,8 @@  i[34567]86-*-mingw* | x86_64-*-mingw*)
 		*)
 			;;
 	esac
-	tm_file="${tm_file} i386/mingw-stdint.h"
-	tmake_file="${tmake_file} t-winnt i386/t-cygming t-slibgcc"
+	tm_file="${tm_file} mingw/mingw-stdint.h"
+	tmake_file="${tmake_file} t-winnt mingw/t-cygming t-slibgcc"
         case ${target} in
                x86_64-w64-*)
                		tmake_file="${tmake_file} i386/t-mingw-w64"
@@ -2257,8 +2260,8 @@  i[34567]86-*-mingw* | x86_64-*-mingw*)
 			;;
 	esac
         native_system_header_dir=/mingw/include
-	target_gtfiles="$target_gtfiles \$(srcdir)/config/i386/winnt.cc"
-	extra_options="${extra_options} i386/cygming.opt i386/mingw.opt"
+	target_gtfiles="$target_gtfiles \$(srcdir)/config/mingw/winnt.cc"
+	extra_options="${extra_options} mingw/cygming.opt mingw/mingw.opt"
 	case ${target} in
 		*-w64-*)
 			extra_options="${extra_options} i386/mingw-w64.opt"
diff --git a/gcc/config/i386/cygming.opt b/gcc/config/mingw/cygming.opt
similarity index 100%
rename from gcc/config/i386/cygming.opt
rename to gcc/config/mingw/cygming.opt
diff --git a/gcc/config/i386/cygming.opt.urls b/gcc/config/mingw/cygming.opt.urls
similarity index 100%
rename from gcc/config/i386/cygming.opt.urls
rename to gcc/config/mingw/cygming.opt.urls
diff --git a/gcc/config/i386/cygwin-d.cc b/gcc/config/mingw/cygwin-d.cc
similarity index 100%
rename from gcc/config/i386/cygwin-d.cc
rename to gcc/config/mingw/cygwin-d.cc
diff --git a/gcc/config/i386/mingw-stdint.h b/gcc/config/mingw/mingw-stdint.h
similarity index 100%
rename from gcc/config/i386/mingw-stdint.h
rename to gcc/config/mingw/mingw-stdint.h
diff --git a/gcc/config/i386/mingw.opt b/gcc/config/mingw/mingw.opt
similarity index 100%
rename from gcc/config/i386/mingw.opt
rename to gcc/config/mingw/mingw.opt
diff --git a/gcc/config/i386/mingw.opt.urls b/gcc/config/mingw/mingw.opt.urls
similarity index 100%
rename from gcc/config/i386/mingw.opt.urls
rename to gcc/config/mingw/mingw.opt.urls
diff --git a/gcc/config/i386/mingw32.h b/gcc/config/mingw/mingw32.h
similarity index 100%
rename from gcc/config/i386/mingw32.h
rename to gcc/config/mingw/mingw32.h
diff --git a/gcc/config/i386/msformat-c.cc b/gcc/config/mingw/msformat-c.cc
similarity index 100%
rename from gcc/config/i386/msformat-c.cc
rename to gcc/config/mingw/msformat-c.cc
diff --git a/gcc/config/i386/t-cygming b/gcc/config/mingw/t-cygming
similarity index 73%
rename from gcc/config/i386/t-cygming
rename to gcc/config/mingw/t-cygming
index af01f69acd1..f5de941c8e5 100644
--- a/gcc/config/i386/t-cygming
+++ b/gcc/config/mingw/t-cygming
@@ -20,37 +20,40 @@ 
 # doing the build, it may not be installed yet.
 LIMITS_H_TEST = true
 
-winnt.o: $(srcdir)/config/i386/winnt.cc $(CONFIG_H) $(SYSTEM_H) coretypes.h \
+winnt.o: $(srcdir)/config/mingw/winnt.cc $(CONFIG_H) $(SYSTEM_H) coretypes.h \
   $(TM_H) $(RTL_H) $(REGS_H) hard-reg-set.h output.h $(TREE_H) flags.h \
   $(TM_P_H) $(HASH_TABLE_H) $(GGC_H) $(LTO_STREAMER_H)
 	$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
-	$(srcdir)/config/i386/winnt.cc
+	$(srcdir)/config/mingw/winnt.cc
 
-winnt-cxx.o: $(srcdir)/config/i386/winnt-cxx.cc $(CONFIG_H) $(SYSTEM_H) coretypes.h \
+winnt-cxx.o: $(srcdir)/config/mingw/winnt-cxx.cc $(CONFIG_H) $(SYSTEM_H) \
+  coretypes.h \
   $(TM_H) $(TREE_H) flags.h \
   $(TM_P_H) $(HASHTAB_H) $(GGC_H)
 	$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
-	$(srcdir)/config/i386/winnt-cxx.cc
+	$(srcdir)/config/mingw/winnt-cxx.cc
 
 
-winnt-stubs.o: $(srcdir)/config/i386/winnt-stubs.cc $(CONFIG_H) $(SYSTEM_H) coretypes.h \
+winnt-stubs.o: $(srcdir)/config/mingw/winnt-stubs.cc $(CONFIG_H) $(SYSTEM_H) \
+  coretypes.h \
   $(TM_H) $(RTL_H) $(REGS_H) hard-reg-set.h output.h $(TREE_H) flags.h \
   $(TM_P_H) $(HASHTAB_H) $(GGC_H)
 	$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
-	$(srcdir)/config/i386/winnt-stubs.cc
+	$(srcdir)/config/mingw/winnt-stubs.cc
 
-cygwin-d.o: $(srcdir)/config/i386/cygwin-d.cc
+cygwin-d.o: $(srcdir)/config/mingw/cygwin-d.cc
 	$(COMPILE) $<
 	$(POSTCOMPILE)
 
-winnt-d.o: $(srcdir)/config/i386/winnt-d.cc
+winnt-d.o: $(srcdir)/config/mingw/winnt-d.cc
 	$(COMPILE) $<
 	$(POSTCOMPILE)
 
-msformat-c.o: $(srcdir)/config/i386/msformat-c.cc $(CONFIG_H) $(SYSTEM_H) coretypes.h \
+msformat-c.o: $(srcdir)/config/mingw/msformat-c.cc $(CONFIG_H) $(SYSTEM_H) \
+  coretypes.h \
   $(TM_H) $(RTL_H) $(REGS_H) hard-reg-set.h output.h $(TREE_H) flags.h \
   $(TM_P_H) $(HASHTAB_H) $(GGC_H)
 	$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
-	$(srcdir)/config/i386/msformat-c.cc
+	$(srcdir)/config/mingw/msformat-c.cc
 
 STMP_FIXINC=stmp-fixinc
diff --git a/gcc/config/i386/winnt-cxx.cc b/gcc/config/mingw/winnt-cxx.cc
similarity index 100%
rename from gcc/config/i386/winnt-cxx.cc
rename to gcc/config/mingw/winnt-cxx.cc
diff --git a/gcc/config/i386/winnt-d.cc b/gcc/config/mingw/winnt-d.cc
similarity index 100%
rename from gcc/config/i386/winnt-d.cc
rename to gcc/config/mingw/winnt-d.cc
diff --git a/gcc/config/i386/winnt-stubs.cc b/gcc/config/mingw/winnt-stubs.cc
similarity index 100%
rename from gcc/config/i386/winnt-stubs.cc
rename to gcc/config/mingw/winnt-stubs.cc
diff --git a/gcc/config/i386/winnt.cc b/gcc/config/mingw/winnt.cc
similarity index 100%
rename from gcc/config/i386/winnt.cc
rename to gcc/config/mingw/winnt.cc