[gcc r14-10389] Fix MinGW option -mcrtdll=

2024-07-07 Thread Jonathan Yong via Gcc-cvs
https://gcc.gnu.org/g:a8617b5ec39f81a59650193be1db2cfecdd76fb6

commit r14-10389-ga8617b5ec39f81a59650193be1db2cfecdd76fb6
Author: Pali Rohár 
Date:   Sun Jun 23 18:40:59 2024 +0200

Fix MinGW option -mcrtdll=

Add missing msvcr40* and msvcrtd* cases to CPP_SPEC and
document missing _UCRT macro and msvcr71* case.

Fixes commit 453cb585f0f8673a5d69d1b420ffd4b3f53aca00.

gcc/
* config/i386/mingw-w64.h (CPP_SPEC): Add missing -mcrtdll=
cases: msvcr40*, msvcrtd*.
* config/i386/mingw32.h (CPP_SPEC): Add missing -mcrtdll=
cases: msvcr40*, msvcrtd*.
* doc/invoke.texi: Add missing -mcrtdll= cases: msvcr40*,
msvcrtd*, msvcr71*. Express wildcards with *. Document _UCRT.

(cherry picked from commit 0de0476e47c774db21c94a75d60485a55ec7b5b4)
Signed-off-by: Jonathan Yong <10wa...@gmail.com>

Diff:
---
 gcc/config/i386/mingw-w64.h |  2 ++
 gcc/config/i386/mingw32.h   |  2 ++
 gcc/doc/invoke.texi | 13 +++--
 3 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/gcc/config/i386/mingw-w64.h b/gcc/config/i386/mingw-w64.h
index dde26413e221..0a9986c44d40 100644
--- a/gcc/config/i386/mingw-w64.h
+++ b/gcc/config/i386/mingw-w64.h
@@ -30,6 +30,8 @@ along with GCC; see the file COPYING3.  If not see
 "%{mcrtdll=msvcrt10*:-D__MSVCRT_VERSION__=0x100} " \
 "%{mcrtdll=msvcrt20*:-D__MSVCRT_VERSION__=0x200} " \
 "%{mcrtdll=msvcrt40*:-D__MSVCRT_VERSION__=0x400} " \
+"%{mcrtdll=msvcr40*:-D__MSVCRT_VERSION__=0x400} " \
+"%{mcrtdll=msvcrtd*:-D__MSVCRT_VERSION__=0x600} " \
 "%{mcrtdll=msvcrt-os*:-D__MSVCRT_VERSION__=0x700} " \
 "%{mcrtdll=msvcr70*:-D__MSVCRT_VERSION__=0x700} " \
 "%{mcrtdll=msvcr71*:-D__MSVCRT_VERSION__=0x701} " \
diff --git a/gcc/config/i386/mingw32.h b/gcc/config/i386/mingw32.h
index 58304fc55f62..7753affd36d4 100644
--- a/gcc/config/i386/mingw32.h
+++ b/gcc/config/i386/mingw32.h
@@ -94,6 +94,8 @@ along with GCC; see the file COPYING3.  If not see
 "%{mcrtdll=msvcrt10*:-D__MSVCRT_VERSION__=0x100} " \
 "%{mcrtdll=msvcrt20*:-D__MSVCRT_VERSION__=0x200} " \
 "%{mcrtdll=msvcrt40*:-D__MSVCRT_VERSION__=0x400} " \
+"%{mcrtdll=msvcr40*:-D__MSVCRT_VERSION__=0x400} " \
+"%{mcrtdll=msvcrtd*:-D__MSVCRT_VERSION__=0x600} " \
 "%{mcrtdll=msvcrt-os*:-D__MSVCRT_VERSION__=0x700} " \
 "%{mcrtdll=msvcr70*:-D__MSVCRT_VERSION__=0x700} " \
 "%{mcrtdll=msvcr71*:-D__MSVCRT_VERSION__=0x701} " \
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index 67220051a5be..f82f7d2817bb 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -36325,13 +36325,14 @@ enabled by default on those targets.
 @opindex mcrtdll
 @item -mcrtdll=@var{library}
 Preprocess, compile or link with specified C RunTime DLL @var{library}.
-This option adjust predefined macros @code{__CRTDLL__}, @code{__MSVCRT__}
-and @code{__MSVCRT_VERSION__} for specified CRT @var{library}, choose
-start file for CRT @var{library} and link with CRT @var{library}.
+This option adjust predefined macros @code{__CRTDLL__}, @code{__MSVCRT__},
+@code{_UCRT} and @code{__MSVCRT_VERSION__} for specified CRT @var{library},
+choose start file for CRT @var{library} and link with CRT @var{library}.
 Recognized CRT library names for proprocessor are:
-@code{crtdll}, @code{msvcrt10}, @code{msvcrt20}, @code{msvcrt40},
-@code{msvcrt-os}, @code{msvcr70}, @code{msvcr80}, @code{msvcr90},
-@code{msvcr100}, @code{msvcr110}, @code{msvcr120} and @code{ucrt}.
+@code{crtdll*}, @code{msvcrt10*}, @code{msvcrt20*}, @code{msvcrt40*},
+@code{msvcr40*}, @code{msvcrtd*}, @code{msvcrt-os*},
+@code{msvcr70*}, @code{msvcr71*}, @code{msvcr80*}, @code{msvcr90*},
+@code{msvcr100*}, @code{msvcr110*}, @code{msvcr120*} and @code{ucrt*}.
 If this options is not specified then the default MinGW import library
 @code{msvcrt} is used for linking and no other adjustment for
 preprocessor is done. MinGW import library @code{msvcrt} is just a


[gcc r15-2140] Do not use caller-saved registers for COMDAT functions

2024-07-18 Thread Jonathan Yong via Gcc-cvs
https://gcc.gnu.org/g:5080840d8fbf25a321dd27543a1462d393d338bc

commit r15-2140-g5080840d8fbf25a321dd27543a1462d393d338bc
Author: LIU Hao 
Date:   Mon Jul 15 16:55:52 2024 +0800

Do not use caller-saved registers for COMDAT functions

A reference to a COMDAT function may be resolved to another definition
outside the current translation unit, so it's not eligible for `-fipa-ra`.

In `decl_binds_to_current_def_p()` there is already a check for weak
symbols. This commit checks for COMDAT functions that are not implemented
as weak symbols, for example, on *-*-mingw32.

gcc/ChangeLog:

PR rtl-optimization/115049
* varasm.cc (decl_binds_to_current_def_p): Add a check for COMDAT
declarations too, like weak ones.

Diff:
---
 gcc/varasm.cc | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/gcc/varasm.cc b/gcc/varasm.cc
index beb88709033f..4426e7ce6c65 100644
--- a/gcc/varasm.cc
+++ b/gcc/varasm.cc
@@ -7813,6 +7813,8 @@ decl_binds_to_current_def_p (const_tree decl)
  for all other declaration types.  */
   if (DECL_WEAK (decl))
 return false;
+  if (DECL_COMDAT_GROUP (decl))
+return false;
   if (DECL_COMMON (decl)
   && (DECL_INITIAL (decl) == NULL
  || (!in_lto_p && DECL_INITIAL (decl) == error_mark_node)))


[gcc r14-10460] Do not use caller-saved registers for COMDAT functions

2024-07-18 Thread Jonathan Yong via Gcc-cvs
https://gcc.gnu.org/g:747c4b58573ea00419f64293a61537eb69f43307

commit r14-10460-g747c4b58573ea00419f64293a61537eb69f43307
Author: LIU Hao 
Date:   Mon Jul 15 16:55:52 2024 +0800

Do not use caller-saved registers for COMDAT functions

A reference to a COMDAT function may be resolved to another definition
outside the current translation unit, so it's not eligible for `-fipa-ra`.

In `decl_binds_to_current_def_p()` there is already a check for weak
symbols. This commit checks for COMDAT functions that are not implemented
as weak symbols, for example, on *-*-mingw32.

gcc/ChangeLog:

PR rtl-optimization/115049
* varasm.cc (decl_binds_to_current_def_p): Add a check for COMDAT
declarations too, like weak ones.

(cherry picked from commit 5080840d8fbf25a321dd27543a1462d393d338bc)

Diff:
---
 gcc/varasm.cc | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/gcc/varasm.cc b/gcc/varasm.cc
index 747f74ba1c00..b67a0b524dbf 100644
--- a/gcc/varasm.cc
+++ b/gcc/varasm.cc
@@ -7805,6 +7805,8 @@ decl_binds_to_current_def_p (const_tree decl)
  for all other declaration types.  */
   if (DECL_WEAK (decl))
 return false;
+  if (DECL_COMDAT_GROUP (decl))
+return false;
   if (DECL_COMMON (decl)
   && (DECL_INITIAL (decl) == NULL
  || (!in_lto_p && DECL_INITIAL (decl) == error_mark_node)))


[gcc r13-8923] Do not use caller-saved registers for COMDAT functions

2024-07-19 Thread Jonathan Yong via Gcc-cvs
https://gcc.gnu.org/g:953bf37690d22de956d75c6aef7a9690ad55b9a7

commit r13-8923-g953bf37690d22de956d75c6aef7a9690ad55b9a7
Author: LIU Hao 
Date:   Mon Jul 15 16:55:52 2024 +0800

Do not use caller-saved registers for COMDAT functions

A reference to a COMDAT function may be resolved to another definition
outside the current translation unit, so it's not eligible for `-fipa-ra`.

In `decl_binds_to_current_def_p()` there is already a check for weak
symbols. This commit checks for COMDAT functions that are not implemented
as weak symbols, for example, on *-*-mingw32.

gcc/ChangeLog:

PR rtl-optimization/115049
* varasm.cc (decl_binds_to_current_def_p): Add a check for COMDAT
declarations too, like weak ones.

(cherry picked from commit 5080840d8fbf25a321dd27543a1462d393d338bc)

Diff:
---
 gcc/varasm.cc | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/gcc/varasm.cc b/gcc/varasm.cc
index 9ad41c3dbdb8..e95cef8a7259 100644
--- a/gcc/varasm.cc
+++ b/gcc/varasm.cc
@@ -7632,6 +7632,8 @@ decl_binds_to_current_def_p (const_tree decl)
  for all other declaration types.  */
   if (DECL_WEAK (decl))
 return false;
+  if (DECL_COMDAT_GROUP (decl))
+return false;
   if (DECL_COMMON (decl)
   && (DECL_INITIAL (decl) == NULL
  || (!in_lto_p && DECL_INITIAL (decl) == error_mark_node)))


[gcc r12-10625] Do not use caller-saved registers for COMDAT functions

2024-07-19 Thread Jonathan Yong via Gcc-cvs
https://gcc.gnu.org/g:2c5f48a43f26223cb8603b826d7c0d52cdbcfb46

commit r12-10625-g2c5f48a43f26223cb8603b826d7c0d52cdbcfb46
Author: LIU Hao 
Date:   Mon Jul 15 16:55:52 2024 +0800

Do not use caller-saved registers for COMDAT functions

A reference to a COMDAT function may be resolved to another definition
outside the current translation unit, so it's not eligible for `-fipa-ra`.

In `decl_binds_to_current_def_p()` there is already a check for weak
symbols. This commit checks for COMDAT functions that are not implemented
as weak symbols, for example, on *-*-mingw32.

gcc/ChangeLog:

PR rtl-optimization/115049
* varasm.cc (decl_binds_to_current_def_p): Add a check for COMDAT
declarations too, like weak ones.

(cherry picked from commit 5080840d8fbf25a321dd27543a1462d393d338bc)

Diff:
---
 gcc/varasm.cc | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/gcc/varasm.cc b/gcc/varasm.cc
index dc9f733791ab..9fa3a42bf454 100644
--- a/gcc/varasm.cc
+++ b/gcc/varasm.cc
@@ -7621,6 +7621,8 @@ decl_binds_to_current_def_p (const_tree decl)
  for all other declaration types.  */
   if (DECL_WEAK (decl))
 return false;
+  if (DECL_COMDAT_GROUP (decl))
+return false;
   if (DECL_COMMON (decl)
   && (DECL_INITIAL (decl) == NULL
  || (!in_lto_p && DECL_INITIAL (decl) == error_mark_node)))


[gcc r14-9528] c-c++-common/Wrestrict.c: fix some typos and enable for LLP64

2024-03-18 Thread Jonathan Yong via Gcc-cvs
https://gcc.gnu.org/g:9ee19f9b99ad1f877eb3e93382a437d951f737c8

commit r14-9528-g9ee19f9b99ad1f877eb3e93382a437d951f737c8
Author: Jonathan Yong <10wa...@gmail.com>
Date:   Sun Feb 11 09:25:25 2024 +

c-c++-common/Wrestrict.c: fix some typos and enable for LLP64

Signed-off-by: Jonathan Yong <10wa...@gmail.com>

gcc/testsuite:

* c-c++-common/Wrestrict.c: Fix typos in comments and
enable for LLP64 testing.

Diff:
---
 gcc/testsuite/c-c++-common/Wrestrict.c | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/gcc/testsuite/c-c++-common/Wrestrict.c 
b/gcc/testsuite/c-c++-common/Wrestrict.c
index 4d005a618b3..57a3f67e21e 100644
--- a/gcc/testsuite/c-c++-common/Wrestrict.c
+++ b/gcc/testsuite/c-c++-common/Wrestrict.c
@@ -381,14 +381,14 @@ void test_memcpy_range_exceed (char *d, const char *s)
   T (d + i, s + 1, 3);   /* { dg-warning "accessing 3 bytes at offsets 
\\\[\[0-9\]+, \[0-9\]+] and 1 overlaps 1 byte" "memcpy" } */
 
 #if __SIZEOF_SIZE_T__ == 8
-  /* Verfiy the offset and size computation is correct.  The overlap
- offset mentioned in the warning plus sthe size of the access must
+  /* Verify the offset and size computation is correct.  The overlap
+ offset mentioned in the warning plus the size of the access must
  not exceed DIFF_MAX.  */
-  T (d, d + i, 5);   /* { dg-warning "accessing 5 bytes at offsets 0 and 
\\\[9223372036854775805, 9223372036854775807] overlaps 3 bytes at offset 
9223372036854775802" "LP64" { target lp64 } } */
-  T (d + i, d, 5);   /* { dg-warning "accessing 5 bytes at offsets 
\\\[9223372036854775805, 9223372036854775807] and 0 overlaps 3 bytes at offset 
9223372036854775802" "LP64" { target lp64 } } */
+  T (d, d + i, 5);   /* { dg-warning "accessing 5 bytes at offsets 0 and 
\\\[9223372036854775805, 9223372036854775807] overlaps 3 bytes at offset 
9223372036854775802" "LP64" { target { lp64 || llp64 } } } */
+  T (d + i, d, 5);   /* { dg-warning "accessing 5 bytes at offsets 
\\\[9223372036854775805, 9223372036854775807] and 0 overlaps 3 bytes at offset 
9223372036854775802" "LP64" { target { lp64 || llp64 } } } */
 
-  T (d, s + i, 5);   /* { dg-warning "accessing 5 bytes at offsets 0 and 
\\\[9223372036854775805, 9223372036854775807] overlaps 3 bytes at offset 
9223372036854775802" "LP64" { target lp64 } } */
-  T (d + i, s, 5);   /* { dg-warning "accessing 5 bytes at offsets 
\\\[9223372036854775805, 9223372036854775807] and 0 overlaps 3 bytes at offset 
9223372036854775802" "LP64" { target lp64 } } */
+  T (d, s + i, 5);   /* { dg-warning "accessing 5 bytes at offsets 0 and 
\\\[9223372036854775805, 9223372036854775807] overlaps 3 bytes at offset 
9223372036854775802" "LP64" { target { lp64 || llp64 } } } */
+  T (d + i, s, 5);   /* { dg-warning "accessing 5 bytes at offsets 
\\\[9223372036854775805, 9223372036854775807] and 0 overlaps 3 bytes at offset 
9223372036854775802" "LP64" { target { lp64 || llp64 } } } */
 #elif __SIZEOF_SIZE_T__ == 4
   T (d, d + i, 5);   /* { dg-warning "accessing 5 bytes at offsets 0 and 
\\\[2147483645, 2147483647] overlaps 3 bytes at offset 2147483642" "ILP32" { 
target ilp32 } } */
   T (d + i, d, 5);   /* { dg-warning "accessing 5 bytes at offsets 
\\\[2147483645, 2147483647] and 0 overlaps 3 bytes at offset 2147483642" 
"ILP32" { target ilp32 } } */


[gcc r15-849] Define which threading model is in use on Windows

2024-05-27 Thread Jonathan Yong via Gcc-cvs
https://gcc.gnu.org/g:f6c5f836df44196a7cd3b206af5bb29df6c7c225

commit r15-849-gf6c5f836df44196a7cd3b206af5bb29df6c7c225
Author: TheShermanTanker 
Date:   Mon May 27 12:57:33 2024 +0800

Define which threading model is in use on Windows

gcc:
* config/mingw/mingw32.h: Add new define for POSIX
threads.

Signed-off-by: TheShermanTanker 

Diff:
---
 gcc/config/mingw/mingw32.h | 13 -
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/gcc/config/mingw/mingw32.h b/gcc/config/mingw/mingw32.h
index 08f1b5f0696..fa6e307476c 100644
--- a/gcc/config/mingw/mingw32.h
+++ b/gcc/config/mingw/mingw32.h
@@ -34,8 +34,12 @@ along with GCC; see the file COPYING3.  If not see
 | MASK_STACK_PROBE | MASK_ALIGN_DOUBLE \
 | MASK_MS_BITFIELD_LAYOUT)
 
-#ifndef TARGET_USING_MCFGTHREAD
-#define TARGET_USING_MCFGTHREAD  0
+#ifdef TARGET_USING_MCFGTHREAD
+#define DEFINE_THREAD_MODEL  builtin_define ("__USING_MCFGTHREAD__");
+#elif defined(TARGET_USE_PTHREAD_BY_DEFAULT)
+#define DEFINE_THREAD_MODEL  builtin_define ("__USING_POSIXTHREAD__");
+#else
+#define DEFINE_THREAD_MODEL
 #endif
 
 /* See i386/crtdll.h for an alternative definition. _INTEGRAL_MAX_BITS
@@ -56,8 +60,7 @@ along with GCC; see the file COPYING3.  If not see
  builtin_define_std ("WIN64"); \
  builtin_define ("_WIN64");\
}   \
-  if (TARGET_USING_MCFGTHREAD) \
-   builtin_define ("__USING_MCFGTHREAD__");\
+  DEFINE_THREAD_MODEL  \
 }  \
   while (0)
 
@@ -190,7 +193,7 @@ along with GCC; see the file COPYING3.  If not see
 #else
 #define SHARED_LIBGCC_SPEC " -lgcc "
 #endif
-#if TARGET_USING_MCFGTHREAD
+#ifdef TARGET_USING_MCFGTHREAD
 #define MCFGTHREAD_SPEC  " -lmcfgthread -lkernel32 -lntdll "
 #else
 #define MCFGTHREAD_SPEC  ""


[gcc r15-1354] diagnostics: Enable escape sequence processing on windows consoles

2024-06-15 Thread Jonathan Yong via Gcc-cvs
https://gcc.gnu.org/g:e943a5da40cd4799908d3d29001e1325eb00b755

commit r15-1354-ge943a5da40cd4799908d3d29001e1325eb00b755
Author: Peter Damianov 
Date:   Mon Jun 3 10:07:08 2024 -0700

diagnostics: Enable escape sequence processing on windows consoles

Since windows 10 release v1511, the windows console has had support for 
VT100
escape sequences. We should try to enable this, and utilize it where 
possible.

gcc/ChangeLog:
* diagnostic-color.cc (should_colorize): Enable processing of VT100
escape sequences on windows consoles

Signed-off-by: Peter Damianov 

Diff:
---
 gcc/diagnostic-color.cc | 21 -
 1 file changed, 16 insertions(+), 5 deletions(-)

diff --git a/gcc/diagnostic-color.cc b/gcc/diagnostic-color.cc
index cbe57ce763f2..261a14b6c5f2 100644
--- a/gcc/diagnostic-color.cc
+++ b/gcc/diagnostic-color.cc
@@ -300,12 +300,23 @@ should_colorize (void)
  pp_write_text_to_stream() in pretty-print.cc calls fputs() on
  that stream.  However, the code below for non-Windows doesn't seem
  to care about it either...  */
-  HANDLE h;
-  DWORD m;
+  HANDLE handle;
+  DWORD mode;
+  BOOL isconsole = false;
 
-  h = GetStdHandle (STD_ERROR_HANDLE);
-  return (h != INVALID_HANDLE_VALUE) && (h != NULL)
- && GetConsoleMode (h, &m);
+  handle = GetStdHandle (STD_ERROR_HANDLE);
+
+  if ((handle != INVALID_HANDLE_VALUE) && (handle != NULL))
+isconsole = GetConsoleMode (handle, &mode);
+
+  if (isconsole)
+{
+  /* Try to enable processing of VT100 escape sequences */
+  mode |= ENABLE_PROCESSED_OUTPUT | ENABLE_VIRTUAL_TERMINAL_PROCESSING;
+  SetConsoleMode (handle, mode);
+}
+
+  return isconsole;
 #else
   char const *t = getenv ("TERM");
   /* emacs M-x shell sets TERM="dumb".  */


[gcc r15-1355] diagnostics: Don't hardcode auto_enable_urls to false for mingw hosts

2024-06-15 Thread Jonathan Yong via Gcc-cvs
https://gcc.gnu.org/g:5c662a3a5724b75ceb06496d9c64137d59c89d39

commit r15-1355-g5c662a3a5724b75ceb06496d9c64137d59c89d39
Author: Peter Damianov 
Date:   Mon Jun 3 10:07:09 2024 -0700

diagnostics: Don't hardcode auto_enable_urls to false for mingw hosts

Windows terminal and mintty both have support for link escape sequences, 
and so
auto_enable_urls shouldn't be hardcoded to false. For older versions of the
windows console, mingw_ansi_fputs's console API translation logic does 
mangle
these sequences, but there's nothing useful it could do even if this weren't
the case, so check if the ansi escape sequences are supported at all.

conhost.exe doesn't support link escape sequences, but printing them does 
not
cause any problems.

gcc/ChangeLog:
* diagnostic-color.cc (auto_enable_urls): Don't hardcode to return
false on mingw hosts.
(auto_enable_urls): Return true if console
supports ansi escape sequences.

Signed-off-by: Peter Damianov 

Diff:
---
 gcc/diagnostic-color.cc | 19 +++
 1 file changed, 15 insertions(+), 4 deletions(-)

diff --git a/gcc/diagnostic-color.cc b/gcc/diagnostic-color.cc
index 261a14b6c5f2..184419cea367 100644
--- a/gcc/diagnostic-color.cc
+++ b/gcc/diagnostic-color.cc
@@ -384,9 +384,6 @@ parse_env_vars_for_urls ()
 static bool
 auto_enable_urls ()
 {
-#ifdef __MINGW32__
-  return false;
-#else
   const char *term, *colorterm;
 
   /* First check the terminal is capable of printing color escapes,
@@ -394,6 +391,21 @@ auto_enable_urls ()
   if (!should_colorize ())
 return false;
 
+#ifdef __MINGW32__
+  HANDLE handle;
+  DWORD mode;
+
+  handle = GetStdHandle (STD_ERROR_HANDLE);
+  if ((handle == INVALID_HANDLE_VALUE) || (handle == NULL))
+return false;
+
+  /* If ansi escape sequences aren't supported by the console, then URLs will
+ print mangled from mingw_ansi_fputs's console API translation. It wouldn't
+ be useful even if this weren't the case.  */
+  if (GetConsoleMode (handle, &mode) && !(mode & 
ENABLE_VIRTUAL_TERMINAL_PROCESSING))
+return false;
+#endif
+
   /* xfce4-terminal is known to not implement URLs at this time.
  Recently new installations (0.8) will safely ignore the URL escape
  sequences, but a large number of legacy installations (0.6.3) print
@@ -428,7 +440,6 @@ auto_enable_urls ()
 return false;
 
   return true;
-#endif
 }
 
 /* Determine if URLs should be enabled, based on RULE,


[gcc r15-1356] pretty-print: Don't translate escape sequences to windows console API

2024-06-15 Thread Jonathan Yong via Gcc-cvs
https://gcc.gnu.org/g:bc630d613db94eb50687a009ae6b45098ab02db5

commit r15-1356-gbc630d613db94eb50687a009ae6b45098ab02db5
Author: Peter Damianov 
Date:   Mon Jun 3 10:07:10 2024 -0700

pretty-print: Don't translate escape sequences to windows console API

Modern versions of windows (after windows 10 v1511) support VT100 escape
sequences, so translation for them is not necessary. The translation also
mangles embedded warning documentation links.

gcc/ChangeLog:
* pretty-print.cc (mingw_ansi_fputs): Don't translate escape 
sequences if
the console has ENABLE_VIRTUAL_TERMINAL_PROCESSING.

Signed-off-by: Peter Damianov 

Diff:
---
 gcc/pretty-print.cc | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/gcc/pretty-print.cc b/gcc/pretty-print.cc
index 639e2b881586..ec44172f24df 100644
--- a/gcc/pretty-print.cc
+++ b/gcc/pretty-print.cc
@@ -674,8 +674,9 @@ mingw_ansi_fputs (const char *str, FILE *fp)
   /* Don't mess up stdio functions with Windows APIs.  */
   fflush (fp);
 
-  if (GetConsoleMode (h, &mode))
-/* If it is a console, translate ANSI escape codes as needed.  */
+  if (GetConsoleMode (h, &mode) && !(mode & 
ENABLE_VIRTUAL_TERMINAL_PROCESSING))
+/* If it is a console, and doesn't support ANSI escape codes, translate
+   them as needed.  */
 for (;;)
   {
if ((esc_code = find_esc_head (&prefix_len, &esc_head, read)) == 0)


[gcc r15-1581] Fix MinGW option -mcrtdll=

2024-06-24 Thread Jonathan Yong via Gcc-cvs
https://gcc.gnu.org/g:0de0476e47c774db21c94a75d60485a55ec7b5b4

commit r15-1581-g0de0476e47c774db21c94a75d60485a55ec7b5b4
Author: Pali Rohár 
Date:   Sun Jun 23 18:40:59 2024 +0200

Fix MinGW option -mcrtdll=

Add missing msvcr40* and msvcrtd* cases to CPP_SPEC and
document missing _UCRT macro and msvcr71* case.

Fixes commit 453cb585f0f8673a5d69d1b420ffd4b3f53aca00.

gcc/
* config/i386/mingw-w64.h (CPP_SPEC): Add missing -mcrtdll=
cases: msvcr40*, msvcrtd*.
* config/mingw/mingw32.h (CPP_SPEC): Add missing -mcrtdll=
cases: msvcr40*, msvcrtd*.
* doc/invoke.texi: Add missing -mcrtdll= cases: msvcr40*,
msvcrtd*, msvcr71*. Express wildcards with *. Document _UCRT.

Diff:
---
 gcc/config/i386/mingw-w64.h |  2 ++
 gcc/config/mingw/mingw32.h  |  2 ++
 gcc/doc/invoke.texi | 13 +++--
 3 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/gcc/config/i386/mingw-w64.h b/gcc/config/i386/mingw-w64.h
index dde26413e22..0a9986c44d4 100644
--- a/gcc/config/i386/mingw-w64.h
+++ b/gcc/config/i386/mingw-w64.h
@@ -30,6 +30,8 @@ along with GCC; see the file COPYING3.  If not see
 "%{mcrtdll=msvcrt10*:-D__MSVCRT_VERSION__=0x100} " \
 "%{mcrtdll=msvcrt20*:-D__MSVCRT_VERSION__=0x200} " \
 "%{mcrtdll=msvcrt40*:-D__MSVCRT_VERSION__=0x400} " \
+"%{mcrtdll=msvcr40*:-D__MSVCRT_VERSION__=0x400} " \
+"%{mcrtdll=msvcrtd*:-D__MSVCRT_VERSION__=0x600} " \
 "%{mcrtdll=msvcrt-os*:-D__MSVCRT_VERSION__=0x700} " \
 "%{mcrtdll=msvcr70*:-D__MSVCRT_VERSION__=0x700} " \
 "%{mcrtdll=msvcr71*:-D__MSVCRT_VERSION__=0x701} " \
diff --git a/gcc/config/mingw/mingw32.h b/gcc/config/mingw/mingw32.h
index fa6e307476c..da8e1e8949e 100644
--- a/gcc/config/mingw/mingw32.h
+++ b/gcc/config/mingw/mingw32.h
@@ -99,6 +99,8 @@ along with GCC; see the file COPYING3.  If not see
 "%{mcrtdll=msvcrt10*:-D__MSVCRT_VERSION__=0x100} " \
 "%{mcrtdll=msvcrt20*:-D__MSVCRT_VERSION__=0x200} " \
 "%{mcrtdll=msvcrt40*:-D__MSVCRT_VERSION__=0x400} " \
+"%{mcrtdll=msvcr40*:-D__MSVCRT_VERSION__=0x400} " \
+"%{mcrtdll=msvcrtd*:-D__MSVCRT_VERSION__=0x600} " \
 "%{mcrtdll=msvcrt-os*:-D__MSVCRT_VERSION__=0x700} " \
 "%{mcrtdll=msvcr70*:-D__MSVCRT_VERSION__=0x700} " \
 "%{mcrtdll=msvcr71*:-D__MSVCRT_VERSION__=0x701} " \
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index 580232a76a6..23d90db2925 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -36462,13 +36462,14 @@ enabled by default on those targets.
 @opindex mcrtdll
 @item -mcrtdll=@var{library}
 Preprocess, compile or link with specified C RunTime DLL @var{library}.
-This option adjust predefined macros @code{__CRTDLL__}, @code{__MSVCRT__}
-and @code{__MSVCRT_VERSION__} for specified CRT @var{library}, choose
-start file for CRT @var{library} and link with CRT @var{library}.
+This option adjust predefined macros @code{__CRTDLL__}, @code{__MSVCRT__},
+@code{_UCRT} and @code{__MSVCRT_VERSION__} for specified CRT @var{library},
+choose start file for CRT @var{library} and link with CRT @var{library}.
 Recognized CRT library names for proprocessor are:
-@code{crtdll}, @code{msvcrt10}, @code{msvcrt20}, @code{msvcrt40},
-@code{msvcrt-os}, @code{msvcr70}, @code{msvcr80}, @code{msvcr90},
-@code{msvcr100}, @code{msvcr110}, @code{msvcr120} and @code{ucrt}.
+@code{crtdll*}, @code{msvcrt10*}, @code{msvcrt20*}, @code{msvcrt40*},
+@code{msvcr40*}, @code{msvcrtd*}, @code{msvcrt-os*},
+@code{msvcr70*}, @code{msvcr71*}, @code{msvcr80*}, @code{msvcr90*},
+@code{msvcr100*}, @code{msvcr110*}, @code{msvcr120*} and @code{ucrt*}.
 If this options is not specified then the default MinGW import library
 @code{msvcrt} is used for linking and no other adjustment for
 preprocessor is done. MinGW import library @code{msvcrt} is just a


[gcc r15-9032] gcc/mingw: Align `.refptr.` to 8-byte boundaries for 64-bit targets

2025-04-05 Thread Jonathan Yong via Gcc-cvs
https://gcc.gnu.org/g:8d42378acdf1a011420ba78685f7a6c79808c881

commit r15-9032-g8d42378acdf1a011420ba78685f7a6c79808c881
Author: LIU Hao 
Date:   Sat Mar 29 22:47:54 2025 +0800

gcc/mingw: Align `.refptr.` to 8-byte boundaries for 64-bit targets

Windows only requires sections to be aligned on a 4-byte boundary. This used
to work because in binutils the `.rdata` section is over-aligned to a 
16-byte
boundary, which will be fixed in the future.

This matches the output of Clang.

Signed-off-by: LIU Hao 
Signed-off-by: Jonathan Yong <10wa...@gmail.com>

gcc/ChangeLog:
* config/mingw/winnt.cc (mingw_pe_file_end): Add `.p2align`.

Diff:
---
 gcc/config/mingw/winnt.cc | 1 +
 1 file changed, 1 insertion(+)

diff --git a/gcc/config/mingw/winnt.cc b/gcc/config/mingw/winnt.cc
index adaa6dfa3cff..08a761d3a6d4 100644
--- a/gcc/config/mingw/winnt.cc
+++ b/gcc/config/mingw/winnt.cc
@@ -819,6 +819,7 @@ mingw_pe_file_end (void)
}
 
  fprintf (asm_out_file, "\t.section\t.rdata$%s, \"dr\"\n"
+  "\t.p2align\t3, 0\n"
   "\t.globl\t%s\n"
   "\t.linkonce\tdiscard\n", oname, oname);
  fprintf (asm_out_file, "%s:\n\t.quad\t%s\n", oname, name);


[gcc r15-9337] deref-before-check-pr113253.c: Fix bogus warnings on lp32

2025-04-09 Thread Jonathan Yong via Gcc-cvs
https://gcc.gnu.org/g:9ea6bdac02af61f360b5741bef978be02924252d

commit r15-9337-g9ea6bdac02af61f360b5741bef978be02924252d
Author: Jonathan Yong <10wa...@gmail.com>
Date:   Mon Apr 7 15:40:05 2025 +

deref-before-check-pr113253.c: Fix bogus warnings on lp32

Warnings about pointer sizes cause the test to fail
incorrectly. A dummy return value is also added to
set_marker_internal for completeness to suppress a
-Wreturn-type warning even though gcc does not issue
it by default.

Signed-off-by: Jonathan Yong <10wa...@gmail.com>

gcc/testsuite/ChangeLog:

PR analyzer/113253
* gcc.dg/analyzer/deref-before-check-pr113253.c:
(ptrdiff_t): use stddef.h type.
(uintptr_t): ditto.
(EMACS_INT): ditto.
(set_marker_internal): Add dummy 0 to suppress -Wreturn-type.

Diff:
---
 gcc/testsuite/gcc.dg/analyzer/deref-before-check-pr113253.c | 9 +
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/gcc/testsuite/gcc.dg/analyzer/deref-before-check-pr113253.c 
b/gcc/testsuite/gcc.dg/analyzer/deref-before-check-pr113253.c
index d9015accd6ab..1890312cc1ab 100644
--- a/gcc/testsuite/gcc.dg/analyzer/deref-before-check-pr113253.c
+++ b/gcc/testsuite/gcc.dg/analyzer/deref-before-check-pr113253.c
@@ -5,12 +5,12 @@
 
 /* { dg-additional-options "-O2 -g" } */
 
-typedef long int ptrdiff_t;
-typedef unsigned long int uintptr_t;
-typedef long int EMACS_INT;
+typedef __PTRDIFF_TYPE__ ptrdiff_t;
+typedef __UINTPTR_TYPE__ uintptr_t;
+typedef __PTRDIFF_TYPE__ EMACS_INT;
 enum
 {
-  EMACS_INT_WIDTH = 64,
+  EMACS_INT_WIDTH = sizeof(EMACS_INT) * 8,
   VALBITS = EMACS_INT_WIDTH - 3,
 };
 typedef struct Lisp_X* Lisp_Word;
@@ -151,4 +151,5 @@ set_marker_internal(Lisp_Object position, Lisp_Object 
buffer)
   struct buffer* b = live_buffer(buffer);
   if (NILP(position) || (MARKERP(position) && !XMARKER(position)->buffer) || 
!b) /* { dg-bogus "Wanalyzer-deref-before-check" } */
 unchain_marker();
+  return 0;
 }


[gcc r15-9480] Wbuiltin-declaration-mismatch-4.c: accept long long in warning for llp64

2025-04-15 Thread Jonathan Yong via Gcc-cvs
https://gcc.gnu.org/g:039b566f2f03699676d31b681d1595bddc94a774

commit r15-9480-g039b566f2f03699676d31b681d1595bddc94a774
Author: Jonathan Yong <10wa...@gmail.com>
Date:   Sun Apr 13 02:41:36 2025 +

Wbuiltin-declaration-mismatch-4.c: accept long long in warning for llp64

llp64 targets like mingw-w64 will print:
gcc/testsuite/gcc.dg/Wbuiltin-declaration-mismatch-4.c:80:17: warning: 
‘memset’ argument 3 promotes to ‘ptrdiff_t’ {aka ‘long long int’} where ‘long 
long unsigned int’ is expected in a call to built-in function declared without 
prototype [-
Wbuiltin-declaration-mismatch]
Change the regex pattern to accept it.

Signed-off-by: Jonathan Yong <10wa...@gmail.com>

gcc/testsuite/ChangeLog:

* gcc.dg/Wbuiltin-declaration-mismatch-4.c: Make diagnostic
accept long long.

Diff:
---
 gcc/testsuite/gcc.dg/Wbuiltin-declaration-mismatch-4.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gcc/testsuite/gcc.dg/Wbuiltin-declaration-mismatch-4.c 
b/gcc/testsuite/gcc.dg/Wbuiltin-declaration-mismatch-4.c
index c48fe5fcf300..09665b49 100644
--- a/gcc/testsuite/gcc.dg/Wbuiltin-declaration-mismatch-4.c
+++ b/gcc/testsuite/gcc.dg/Wbuiltin-declaration-mismatch-4.c
@@ -77,9 +77,9 @@ void test_integer_conversion_memset (void *d)
   /* Passing a ptrdiff_t where size_t is expected may not be unsafe
  but because GCC may emits suboptimal code for such calls warning
  for them helps improve efficiency.  */
-  memset (d, 0, diffi);   /* { dg-warning ".memset. argument 3 promotes to 
.ptrdiff_t. {aka .\(long \)?\(int\)?\(__int20\)?.} where .\(long \)?\(__int20 
\)?unsigned\( int\)?. is expected" } */
+  memset (d, 0, diffi);   /* { dg-warning ".memset. argument 3 promotes to 
.ptrdiff_t. {aka .\(long \)*\(int\)?\(__int20\)?.} where .\(long \)*\(__int20 
\)?unsigned\( int\)?. is expected" } */
 
-  memset (d, 0, 2.0); /* { dg-warning ".memset. argument 3 type is 
.double. where '\(long \)?\(__int20 \)?unsigned\( int\)?' is expected" } */
+  memset (d, 0, 2.0); /* { dg-warning ".memset. argument 3 type is 
.double. where '\(long \)*\(__int20 \)?unsigned\( int\)?' is expected" } */
 
   /* Verify that the same call as above but to the built-in doesn't
  trigger a warning.  */


[gcc r16-27] ref-temp1.C: Enable some tests for PE targets

2025-04-18 Thread Jonathan Yong via Gcc-cvs
https://gcc.gnu.org/g:b986ed16c2546674256b8c892541a8fdb6a97202

commit r16-27-gb986ed16c2546674256b8c892541a8fdb6a97202
Author: Jonathan Yong <10wa...@gmail.com>
Date:   Tue Apr 15 11:41:36 2025 +

ref-temp1.C: Enable some tests for PE targets

Test for expected PE values.

Signed-off-by: Jonathan Yong <10wa...@gmail.com>

gcc/testsuite/ChangeLog:

* g++.dg/abi/ref-temp1.C: Replicate some test based on
PE expectations.
* lib/target-supports.exp: New check_effective_target_pe.

Diff:
---
 gcc/testsuite/g++.dg/abi/ref-temp1.C  | 13 +
 gcc/testsuite/lib/target-supports.exp | 10 ++
 2 files changed, 19 insertions(+), 4 deletions(-)

diff --git a/gcc/testsuite/g++.dg/abi/ref-temp1.C 
b/gcc/testsuite/g++.dg/abi/ref-temp1.C
index 70c9a7a431c2..b02dcf610427 100644
--- a/gcc/testsuite/g++.dg/abi/ref-temp1.C
+++ b/gcc/testsuite/g++.dg/abi/ref-temp1.C
@@ -7,11 +7,16 @@ struct B { const A (&x)[2]; };
 template  B &&b = { { { { 1, 2, 3 } }, { { 4, 5, 6 } } } };
 B &temp = b;
 
-// { dg-final { scan-assembler ".weak\(_definition\)?\[ \t\]_?_ZGR1bIvE_" } }
-// { dg-final { scan-assembler ".weak\(_definition\)?\[ \t\]_?_ZGR1bIvE0_" } }
-// { dg-final { scan-assembler ".weak\(_definition\)?\[ \t\]_?_ZGR1bIvE1_" } }
-// { dg-final { scan-assembler ".weak\(_definition\)?\[ \t\]_?_ZGR1bIvE2_" } }
+// { dg-final { scan-assembler ".weak\(_definition\)?\[ \t\]_?_ZGR1bIvE_" { 
target { ! pe } } } }
+// { dg-final { scan-assembler ".weak\(_definition\)?\[ \t\]_?_ZGR1bIvE0_" { 
target { ! pe } } } }
+// { dg-final { scan-assembler ".weak\(_definition\)?\[ \t\]_?_ZGR1bIvE1_" { 
target { ! pe } } } }
+// { dg-final { scan-assembler ".weak\(_definition\)?\[ \t\]_?_ZGR1bIvE2_" { 
target { ! pe } } } }
 
+// { dg-final { scan-assembler 
"\.section\t\.data\\\$_ZGR1bIvE_,\"w\"\n\t\.linkonce same_size" { target pe } } 
}
+// { dg-final { scan-assembler 
"\.section\t\.rdata\\\$_ZGR1bIvE0_,\"dr\"\n\t\.linkonce same_size" { target pe 
} } }
+// { dg-final { scan-assembler 
"\.section\t\.rdata\\\$_ZGR1bIvE1_,\"dr\"\n\t\.linkonce same_size" { target pe 
} } }
+// { dg-final { scan-assembler 
"\.section\t\.rdata\\\$_ZGR1bIvE2_,\"dr\"\n\t\.linkonce same_size" { target pe 
} } }
+//
 // { dg-final { scan-assembler "_ZGR1bIvE_:\n\[^\n]+_ZGR1bIvE0_" } }
 // { dg-final { scan-assembler "_ZGR1bIvE0_:\n\[^\n]+_ZGR1bIvE1_" } }
 // { dg-final { scan-assembler "_ZGR1bIvE1_:\n\[^\n]+\[ \t\]1" } }
diff --git a/gcc/testsuite/lib/target-supports.exp 
b/gcc/testsuite/lib/target-supports.exp
index a62f459ad7ed..869d1501c383 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -562,6 +562,16 @@ proc check_effective_target_elf { } {
 }
 }
 
+# Returns 1 if the target uses the PE/COFF object format, 0 otherwise.
+
+proc check_effective_target_pe { } {
+if { [gcc_target_object_format] == "pe" } {
+return 1;
+} else {
+return 0;
+}
+}
+
 # Returns 1 if the target toolchain supports ifunc, 0 otherwise.
 
 proc check_ifunc_available { } {


[gcc r15-9373] bf-ms-attrib.c: Fix expected struct size

2025-04-10 Thread Jonathan Yong via Gcc-cvs
https://gcc.gnu.org/g:7e6255edeb5a01d6ae1c2fa5bed391a836726229

commit r15-9373-g7e6255edeb5a01d6ae1c2fa5bed391a836726229
Author: Jonathan Yong <10wa...@gmail.com>
Date:   Wed Apr 9 14:29:39 2025 +

bf-ms-attrib.c: Fix expected struct size

Both gcc and msvc agree that the struct size should
be 12, gcc is already correct.

Signed-off-by: Jonathan Yong <10wa...@gmail.com>

gcc/testsuite/ChangeLog:

PR target/113633
* gcc.dg/bf-ms-attrib.c: Fix expected __ms_struct__ layout
size.

Diff:
---
 gcc/testsuite/gcc.dg/bf-ms-attrib.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc/testsuite/gcc.dg/bf-ms-attrib.c 
b/gcc/testsuite/gcc.dg/bf-ms-attrib.c
index 2da4f0320d6a..5208c7f882fb 100644
--- a/gcc/testsuite/gcc.dg/bf-ms-attrib.c
+++ b/gcc/testsuite/gcc.dg/bf-ms-attrib.c
@@ -32,7 +32,7 @@ main()
 /* As long as the sizes are as expected, we know attributes are working.
bf-ms-layout.c makes sure the right thing happens when the attribute
is on. */
-if (sizeof(struct one_ms) != 8)
+if (sizeof(struct one_ms) != 12)
abort();
 if (sizeof(struct one_gcc) != 8)
abort();


[gcc r15-9372] realloc-1.c: accept long long in warning for llp64

2025-04-10 Thread Jonathan Yong via Gcc-cvs
https://gcc.gnu.org/g:f4cdbd619d89147cf5767ddbb10fbeee8f1b0cbc

commit r15-9372-gf4cdbd619d89147cf5767ddbb10fbeee8f1b0cbc
Author: Jonathan Yong <10wa...@gmail.com>
Date:   Wed Apr 9 14:21:22 2025 +

realloc-1.c: accept long long in warning for llp64

llp64 targets like mingw-w64 will print:
warning: ignoring return value of ‘void* __builtin_realloc(void*, long long 
unsigned int)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
Change the regex pattern to accept it.

Signed-off-by: Jonathan Yong <10wa...@gmail.com>

gcc/testsuite/ChangeLog:

* c-c++-common/analyzer/realloc-1.c: Make diagnostic accept
long long for __builtin_realloc warning.

Diff:
---
 gcc/testsuite/c-c++-common/analyzer/realloc-1.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc/testsuite/c-c++-common/analyzer/realloc-1.c 
b/gcc/testsuite/c-c++-common/analyzer/realloc-1.c
index 04925cfe5adc..0bb846c62497 100644
--- a/gcc/testsuite/c-c++-common/analyzer/realloc-1.c
+++ b/gcc/testsuite/c-c++-common/analyzer/realloc-1.c
@@ -92,5 +92,5 @@ void test_9 (void *p)
 void test_10 (char *s, int n)
 {
   __builtin_realloc(s, n); /* { dg-warning "ignoring return value of 
'__builtin_realloc' declared with attribute 'warn_unused_result'" "" { target c 
} } */
-  /* { dg-warning "ignoring return value of 'void\\* 
__builtin_realloc\\(void\\*, (long )?unsigned int\\)' declared with attribute 
'warn_unused_result'" "" { target c++ } .-1 } */
+  /* { dg-warning "ignoring return value of 'void\\* 
__builtin_realloc\\(void\\*, (long )*unsigned int\\)' declared with attribute 
'warn_unused_result'" "" { target c++ } .-1 } */
 } /* { dg-warning "leak" } */


[gcc r16-398] Implement Windows TLS

2025-05-06 Thread Jonathan Yong via Gcc-cvs
https://gcc.gnu.org/g:0aea633e146b75016eb0cf1c0bf67050d32bf8b6

commit r16-398-g0aea633e146b75016eb0cf1c0bf67050d32bf8b6
Author: Julian Waters 
Date:   Fri May 2 09:59:13 2025 +

Implement Windows TLS

This patch implements native Thread Local Storage access on Windows, as 
motivated by
PR80881. Currently, Thread Local Storage accesses on Windows relies on 
emulation, which
is detrimental to performance in certain applications, notably the Python 
Interpreter
and the gcc port of the Java Virtual Machine. This patch was heavily 
inspired by Daniel
Green's original work on native Windows Thread Local Storage from over a 
decade ago, which
can be found at 
https://github.com/venix1/MinGW-GDC/blob/master/patches/mingw-tls-gcc-4.8.patch
as a reference.

Co-authored-by: Eric Botcazou 
Co-authored-by: Uroš Bizjak 
Co-authored-by: Liu Hao 
Signed-off-by: Julian Waters 
Signed-off-by: Jonathan Yong <10wa...@gmail.com>

gcc/ChangeLog:

* config/i386/i386.cc (ix86_legitimate_constant_p): Handle new 
UNSPEC.
(legitimate_pic_operand_p): Handle new UNSPEC.
(legitimate_pic_address_disp_p): Handle new UNSPEC.
(ix86_legitimate_address_p): Handle new UNSPEC.
(ix86_tls_index_symbol): New symbol for _tls_index.
(ix86_tls_index): Handle creation of _tls_index symbol.
(legitimize_tls_address): Create thread local access sequence.
(output_pic_addr_const): Handle new UNSPEC.
(i386_output_dwarf_dtprel): Handle new UNSPEC.
(i386_asm_output_addr_const_extra): Handle new UNSPEC.
* config/i386/i386.h (TARGET_WIN32_TLS): Define.
* config/i386/i386.md: New UNSPEC.
* config/i386/predicates.md: Handle new UNSPEC.
* config/mingw/mingw32.h (TARGET_WIN32_TLS): Define.
(TARGET_ASM_SELECT_SECTION): Define.
(DEFAULT_TLS_SEG_REG): Define.
* config/mingw/winnt.cc (mingw_pe_select_section): Select proper 
TLS section.
(mingw_pe_unique_section): Handle TLS section.
* config/mingw/winnt.h (mingw_pe_select_section): Declare.
* configure: Regenerate.
* configure.ac: New check for broken linker thread local support

Diff:
---
 gcc/config/i386/i386.cc   | 61 ++-
 gcc/config/i386/i386.h|  1 +
 gcc/config/i386/i386.md   |  1 +
 gcc/config/i386/predicates.md |  1 +
 gcc/config/mingw/mingw32.h|  9 +++
 gcc/config/mingw/winnt.cc | 14 ++
 gcc/config/mingw/winnt.h  |  1 +
 gcc/configure | 29 
 gcc/configure.ac  | 29 
 9 files changed, 145 insertions(+), 1 deletion(-)

diff --git a/gcc/config/i386/i386.cc b/gcc/config/i386/i386.cc
index df3e3efdfd02..f28c92a9d3aa 100644
--- a/gcc/config/i386/i386.cc
+++ b/gcc/config/i386/i386.cc
@@ -11363,6 +11363,9 @@ ix86_legitimate_constant_p (machine_mode mode, rtx x)
x = XVECEXP (x, 0, 0);
return (GET_CODE (x) == SYMBOL_REF
&& SYMBOL_REF_TLS_MODEL (x) == TLS_MODEL_LOCAL_DYNAMIC);
+ case UNSPEC_SECREL32:
+   x = XVECEXP (x, 0, 0);
+   return GET_CODE (x) == SYMBOL_REF;
  default:
return false;
  }
@@ -11499,6 +11502,9 @@ legitimate_pic_operand_p (rtx x)
x = XVECEXP (inner, 0, 0);
return (GET_CODE (x) == SYMBOL_REF
&& SYMBOL_REF_TLS_MODEL (x) == TLS_MODEL_LOCAL_EXEC);
+ case UNSPEC_SECREL32:
+   x = XVECEXP (inner, 0, 0);
+   return GET_CODE (x) == SYMBOL_REF;
  case UNSPEC_MACHOPIC_OFFSET:
return legitimate_pic_address_disp_p (x);
  default:
@@ -11679,6 +11685,9 @@ legitimate_pic_address_disp_p (rtx disp)
   disp = XVECEXP (disp, 0, 0);
   return (GET_CODE (disp) == SYMBOL_REF
  && SYMBOL_REF_TLS_MODEL (disp) == TLS_MODEL_LOCAL_DYNAMIC);
+case UNSPEC_SECREL32:
+  disp = XVECEXP (disp, 0, 0);
+  return GET_CODE (disp) == SYMBOL_REF;
 }
 
   return false;
@@ -11956,6 +11965,7 @@ ix86_legitimate_address_p (machine_mode, rtx addr, bool 
strict,
  case UNSPEC_INDNTPOFF:
  case UNSPEC_NTPOFF:
  case UNSPEC_DTPOFF:
+ case UNSPEC_SECREL32:
break;
 
  default:
@@ -11981,7 +11991,8 @@ ix86_legitimate_address_p (machine_mode, rtx addr, bool 
strict,
  || GET_CODE (XEXP (XEXP (disp, 0), 0)) != UNSPEC
  || !CONST_INT_P (XEXP (XEXP (disp, 0), 1))
  || (XINT (XEXP (XEXP (disp, 0), 0), 1) != UNSPEC_DTPOFF
- && XINT (XEXP (XEXP (disp, 0), 0), 1) != UNSPEC_NTPOFF))
+ && XINT (XEXP (XEXP (disp, 0), 0), 1) != UNSPEC_NTPOFF
+ && XINT (XEXP (XEXP (disp, 0), 0), 1) != UNSPEC_SECREL32))
 

[gcc r16-399] Allow a PCH to be mapped to a different address

2025-05-06 Thread Jonathan Yong via Gcc-cvs
https://gcc.gnu.org/g:16e301adf7b653c72d5c3cae1c7287877f3f20ff

commit r16-399-g16e301adf7b653c72d5c3cae1c7287877f3f20ff
Author: LIU Hao 
Date:   Wed May 11 22:42:53 2022 +0800

Allow a PCH to be mapped to a different address

First, try mapping the PCH to its original address. If that fails, try
letting the system choose one; the PCH can be relocated thereafter.

Reference: https://gcc.gnu.org/pipermail/gcc-patches/2022-May/594556.html

2022-05-11  LIU Hao 
Signed-off-by: Jonathan Yong <10wa...@gmail.com>

PR pch/14940

gcc/ChangeLog:
* config/i386/host-mingw32.cc (mingw32_gt_pch_use_address):
Replace the loop that attempted to map the PCH only to its
original address with more adaptive operations

Diff:
---
 gcc/config/i386/host-mingw32.cc | 32 +++-
 1 file changed, 15 insertions(+), 17 deletions(-)

diff --git a/gcc/config/i386/host-mingw32.cc b/gcc/config/i386/host-mingw32.cc
index e083f49f3da7..87804a5bb755 100644
--- a/gcc/config/i386/host-mingw32.cc
+++ b/gcc/config/i386/host-mingw32.cc
@@ -135,7 +135,6 @@ mingw32_gt_pch_use_address (void *&addr, size_t size, int 
fd,
  and earlier, backslashes are invalid in object name.  So, we need
  to check if we are on Windows2000 or higher.  */
   OSVERSIONINFO version_info;
-  int r;
 
   version_info.dwOSVersionInfoSize = sizeof (version_info);
 
@@ -169,25 +168,24 @@ mingw32_gt_pch_use_address (void *&addr, size_t size, int 
fd,
   return -1;
 }
 
-  /* Retry five times, as here might occure a race with multiple gcc's
- instances at same time.  */
-  for (r = 0; r < 5; r++)
-   {
-  mmap_addr = MapViewOfFileEx (mmap_handle, FILE_MAP_COPY, 0, offset,
-  size, addr);
-  if (mmap_addr == addr)
-   break;
-  if (r != 4)
-Sleep (500);
-   }
-
-  if (mmap_addr != addr)
+  /* Try mapping the file at `addr`.  */
+  mmap_addr = MapViewOfFileEx (mmap_handle, FILE_MAP_COPY, 0, offset,
+  size, addr);
+  if (mmap_addr == NULL)
 {
-  w32_error (__FUNCTION__, __FILE__, __LINE__, "MapViewOfFileEx");
-  CloseHandle(mmap_handle);
-  return  -1;
+  /* We could not map the file at its original address, so let the
+system choose a different one. The PCH can be relocated later.  */
+  mmap_addr = MapViewOfFileEx (mmap_handle, FILE_MAP_COPY, 0, offset,
+  size, NULL);
+  if (mmap_addr == NULL)
+   {
+ w32_error (__FUNCTION__, __FILE__, __LINE__, "MapViewOfFileEx");
+ CloseHandle(mmap_handle);
+ return  -1;
+   }
 }
 
+  addr = mmap_addr;
   return 1;
 }


[gcc r16-177] Fix size_t in id-15.c and infoleak-net-ethtool-ioctl.c for llp64

2025-04-27 Thread Jonathan Yong via Gcc-cvs
https://gcc.gnu.org/g:346c62c60b88fa6ff123bfc6159f61e865ac8750

commit r16-177-g346c62c60b88fa6ff123bfc6159f61e865ac8750
Author: Jonathan Yong <10wa...@gmail.com>
Date:   Thu Apr 24 07:42:17 2025 +

Fix size_t in id-15.c and infoleak-net-ethtool-ioctl.c for llp64

Use __SIZE_TYPE__ for size_t types so that it works for
llp64.

Signed-off-by: Jonathan Yong <10wa...@gmail.com>

gcc/testsuite/ChangeLog:

* gcc.dg/graphite/id-15.c: Use __SIZE_TYPE__ instead of
unsigned long.
* gcc.dg/plugin/infoleak-net-ethtool-ioctl.c: ditto.

Diff:
---
 gcc/testsuite/gcc.dg/graphite/id-15.c| 2 +-
 gcc/testsuite/gcc.dg/plugin/infoleak-net-ethtool-ioctl.c | 3 +--
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/gcc/testsuite/gcc.dg/graphite/id-15.c 
b/gcc/testsuite/gcc.dg/graphite/id-15.c
index d0a804c876bf..d258ef576882 100644
--- a/gcc/testsuite/gcc.dg/graphite/id-15.c
+++ b/gcc/testsuite/gcc.dg/graphite/id-15.c
@@ -1,7 +1,7 @@
 /* { dg-additional-options "-Wno-old-style-definition" } */
 /* { dg-require-effective-target int32plus } */
 
-typedef long unsigned int size_t;
+typedef __SIZE_TYPE__ size_t;
 extern void *memset (void *__s, int __c, size_t __n) __attribute__ 
((__nothrow__)) __attribute__ ((__nonnull__ (1)));
 
 static void
diff --git a/gcc/testsuite/gcc.dg/plugin/infoleak-net-ethtool-ioctl.c 
b/gcc/testsuite/gcc.dg/plugin/infoleak-net-ethtool-ioctl.c
index 52846c40f863..afb4a5714e9a 100644
--- a/gcc/testsuite/gcc.dg/plugin/infoleak-net-ethtool-ioctl.c
+++ b/gcc/testsuite/gcc.dg/plugin/infoleak-net-ethtool-ioctl.c
@@ -11,8 +11,7 @@ typedef unsigned int __u32;
 typedef __s8 s8;
 typedef __u32 u32;
 enum { false = 0, true = 1 };
-typedef unsigned long __kernel_ulong_t;
-typedef __kernel_ulong_t __kernel_size_t;
+typedef __SIZE_TYPE__ __kernel_size_t;
 typedef _Bool bool;
 typedef __kernel_size_t size_t;


[gcc r16-178] gcc: For Windows x86-32, always attempt to realign stack regardless of SSE

2025-04-27 Thread Jonathan Yong via Gcc-cvs
https://gcc.gnu.org/g:dea7b9a78b11b5ca0c85b971521144ba07a66aca

commit r16-178-gdea7b9a78b11b5ca0c85b971521144ba07a66aca
Author: LIU Hao 
Date:   Sun Apr 27 18:18:34 2025 +0800

gcc: For Windows x86-32, always attempt to realign stack regardless of SSE

For Windows x86-32 targets, the Microsoft ABI only guarantees that the stack
is aligned to 4-byte boundaries. GCC knows about the default alignment of 
the
stack. However, before this commit, it did not realign the stack unless SSE
was also enabled.

When a stricter (larger) alignment is requested, it's always necessary to
realign the stack, as what Solaris does.

Reference: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=07#c14
Signed-off-by: LIU Hao 
Signed-off-by: Jonathan Yong <10wa...@gmail.com>

gcc/ChangeLog:

PR target/07
* config/i386/cygming.h (STACK_REALIGN_DEFAULT): Copy from sol2.h.

Diff:
---
 gcc/config/i386/cygming.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc/config/i386/cygming.h b/gcc/config/i386/cygming.h
index 3ddcbecb22fd..d587d25a58a8 100644
--- a/gcc/config/i386/cygming.h
+++ b/gcc/config/i386/cygming.h
@@ -36,7 +36,7 @@ along with GCC; see the file COPYING3.  If not see
 /* 32-bit Windows aligns the stack on a 4-byte boundary but SSE instructions
may require 16-byte alignment.  */
 #undef STACK_REALIGN_DEFAULT
-#define STACK_REALIGN_DEFAULT TARGET_SSE
+#define STACK_REALIGN_DEFAULT (TARGET_64BIT ? 0 : 1)
 
 /* Support hooks for SEH.  */
 #undef  TARGET_ASM_UNWIND_EMIT


[gcc r15-9148] switch-3.c: Fix llp64 warnings

2025-04-02 Thread Jonathan Yong via Gcc-cvs
https://gcc.gnu.org/g:e7912d4a81cf34e05c7ded70910069b691a8bb15

commit r15-9148-ge7912d4a81cf34e05c7ded70910069b691a8bb15
Author: Jonathan Yong <10wa...@gmail.com>
Date:   Wed Apr 2 11:18:21 2025 +

switch-3.c: Fix llp64 warnings

mtrr_ioctl() uses long and casts it to a pointer. Fix warnings
for llp64 platforms.

Signed-off-by: Jonathan Yong <10wa...@gmail.com>

gcc/testsuite/ChangeLog:

* gcc.dg/analyzer/torture/switch-3.c: Fix llp64 warnings.

Diff:
---
 gcc/testsuite/gcc.dg/analyzer/torture/switch-3.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc/testsuite/gcc.dg/analyzer/torture/switch-3.c 
b/gcc/testsuite/gcc.dg/analyzer/torture/switch-3.c
index 57b8acdb2929..b40be664d389 100644
--- a/gcc/testsuite/gcc.dg/analyzer/torture/switch-3.c
+++ b/gcc/testsuite/gcc.dg/analyzer/torture/switch-3.c
@@ -68,7 +68,7 @@ extern void check_init_u32 (__u32 v);
 /* Adapted/reduced from arch/x86/kernel/cpu/mtrr/if.c: mtrr_ioctl,
which is GPL-2.0  */
 
-long mtrr_ioctl(unsigned int cmd, unsigned long __arg) {
+long mtrr_ioctl(unsigned int cmd, __UINTPTR_TYPE__ __arg) {
   int err = 0;
   struct mtrr_sentry sentry;
   struct mtrr_gentry gentry;


[gcc r16-511] i386/cygming: Decrease default preferred stack boundary for 32-bit targets

2025-05-10 Thread Jonathan Yong via Gcc-cvs
https://gcc.gnu.org/g:ee7c0a5b70dc316477f45abc0f09dd2af9abe5cb

commit r16-511-gee7c0a5b70dc316477f45abc0f09dd2af9abe5cb
Author: LIU Hao 
Date:   Tue Apr 29 10:43:06 2025 +0800

i386/cygming: Decrease default preferred stack boundary for 32-bit targets

This commit decreases the default preferred stack boundary to 4.

In i386-options.cc, there's

   ix86_default_incoming_stack_boundary = PREFERRED_STACK_BOUNDARY;

which sets the default incoming stack boundary to this value, if it's not
overridden by other options or attributes.

Previously, GCC preferred 16-byte alignment like other platforms, unless
`-miamcu` was specified. However, the Microsoft x86 ABI only requires the
stack be aligned to 4-byte boundaries. Callback functions from MSVC code may
break this assumption by GCC (see reference below), causing local variables
to be misaligned.

For compatibility reasons, when the attribute `force_align_arg_pointer` is
attached to a function, it continues to ensure the stack is at least aligned
to a 16-byte boundary, as the documentation seems to suggest.

After this change, `STACK_REALIGN_DEFAULT` no longer has an effect on this
target, so it is removed.

Reference: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=07#c9
Signed-off-by: LIU Hao 
Signed-off-by: Jonathan Yong <10wa...@gmail.com>

gcc/ChangeLog:

PR target/07
* config/i386/cygming.h (PREFERRED_STACK_BOUNDARY_DEFAULT): Override
definition from i386.h.
(STACK_REALIGN_DEFAULT): Undefine, as it no longer has an effect.
* config/i386/i386.cc (ix86_update_stack_boundary): Force minimum
128-bit alignment if `force_align_arg_pointer`.

Diff:
---
 gcc/config/i386/cygming.h | 9 -
 gcc/config/i386/i386.cc   | 9 +
 2 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/gcc/config/i386/cygming.h b/gcc/config/i386/cygming.h
index d587d25a58a8..743cc38f5852 100644
--- a/gcc/config/i386/cygming.h
+++ b/gcc/config/i386/cygming.h
@@ -28,16 +28,15 @@ along with GCC; see the file COPYING3.  If not see
 #undef TARGET_SEH
 #define TARGET_SEH  (TARGET_64BIT_MS_ABI && flag_unwind_tables)
 
+#undef PREFERRED_STACK_BOUNDARY_DEFAULT
+#define PREFERRED_STACK_BOUNDARY_DEFAULT \
+  (TARGET_64BIT ? 128 : MIN_STACK_BOUNDARY)
+
 /* Win64 with SEH cannot represent DRAP stack frames.  Disable its use.
Force the use of different mechanisms to allocate aligned local data.  */
 #undef MAX_STACK_ALIGNMENT
 #define MAX_STACK_ALIGNMENT  (TARGET_SEH ? 128 : MAX_OFILE_ALIGNMENT)
 
-/* 32-bit Windows aligns the stack on a 4-byte boundary but SSE instructions
-   may require 16-byte alignment.  */
-#undef STACK_REALIGN_DEFAULT
-#define STACK_REALIGN_DEFAULT (TARGET_64BIT ? 0 : 1)
-
 /* Support hooks for SEH.  */
 #undef  TARGET_ASM_UNWIND_EMIT
 #define TARGET_ASM_UNWIND_EMIT  i386_pe_seh_unwind_emit
diff --git a/gcc/config/i386/i386.cc b/gcc/config/i386/i386.cc
index fd36ea802c00..9c24a926a890 100644
--- a/gcc/config/i386/i386.cc
+++ b/gcc/config/i386/i386.cc
@@ -7942,6 +7942,15 @@ ix86_update_stack_boundary (void)
   if (ix86_tls_descriptor_calls_expanded_in_cfun
   && crtl->preferred_stack_boundary < 128)
 crtl->preferred_stack_boundary = 128;
+
+  /* For 32-bit MS ABI, both the incoming and preferred stack boundaries
+ are 32 bits, but if force_align_arg_pointer is specified, it should
+ prefer 128 bits for a backward-compatibility reason, which is also
+ what the doc suggests.  */
+  if (lookup_attribute ("force_align_arg_pointer",
+   TYPE_ATTRIBUTES (TREE_TYPE (current_function_decl)))
+  && crtl->preferred_stack_boundary < 128)
+crtl->preferred_stack_boundary = 128;
 }
 
 /* Handle the TARGET_GET_DRAP_RTX hook.  Return NULL if no DRAP is


[gcc r16-867] i386: Quote user-defined symbols in assembly in Intel syntax

2025-05-25 Thread Jonathan Yong via Gcc-cvs
https://gcc.gnu.org/g:5840bf969e2bfdf4f6c51d04aeb1a96a87727d80

commit r16-867-g5840bf969e2bfdf4f6c51d04aeb1a96a87727d80
Author: LIU Hao 
Date:   Sat Feb 22 13:11:51 2025 +0800

i386: Quote user-defined symbols in assembly in Intel syntax

With `-masm=intel`, GCC generates registers without % prefixes. If a
user-declared symbol happens to match a register, it will confuse the
assembler. User-defined symbols should be quoted, so they are not to
be mistaken for registers or operators.

Support for quoted symbols were added in Binutils 2.26, originally
for ARM assembly, where registers are also unprefixed:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=d02603dc201f80cd9d2a1f4b1a16110b1e04222b

This change is required for `@SECREL32` to work in Intel syntax when
targeting Windows, where `@` is allowed as part of a symbol. GNU AS
fails to parse a plain symbol with that suffix:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80881#c79

gcc/ChangeLog:

PR target/53929
PR target/80881
* config/i386/i386-protos.h (ix86_asm_output_labelref): Declare new
function for quoting user-defined symbols in Intel syntax.
* config/i386/i386.cc (ix86_asm_output_labelref): Implement it.
* config/i386/i386.h (ASM_OUTPUT_LABELREF): Use it.
* config/i386/cygming.h (ASM_OUTPUT_LABELREF): Use it.

Diff:
---
 gcc/config/i386/cygming.h |  5 +++--
 gcc/config/i386/i386-protos.h |  1 +
 gcc/config/i386/i386.cc   | 13 +
 gcc/config/i386/i386.h|  7 +++
 4 files changed, 24 insertions(+), 2 deletions(-)

diff --git a/gcc/config/i386/cygming.h b/gcc/config/i386/cygming.h
index 743cc38f5852..0a3173c4e937 100644
--- a/gcc/config/i386/cygming.h
+++ b/gcc/config/i386/cygming.h
@@ -246,9 +246,10 @@ do {   
\
 #undef ASM_OUTPUT_LABELREF
 #define  ASM_OUTPUT_LABELREF(STREAM, NAME) \
 do {   \
+  const char *prefix = ""; \
   if ((NAME)[0] != FASTCALL_PREFIX)\
-fputs (user_label_prefix, (STREAM));   \
-  fputs ((NAME), (STREAM));\
+prefix = user_label_prefix;\
+  ix86_asm_output_labelref ((STREAM), prefix, (NAME)); \
 } while (0)
 
 /* This does much the same in memory rather than to a stream.  */
diff --git a/gcc/config/i386/i386-protos.h b/gcc/config/i386/i386-protos.h
index e85b925704ba..10863ab9e9de 100644
--- a/gcc/config/i386/i386-protos.h
+++ b/gcc/config/i386/i386-protos.h
@@ -199,6 +199,7 @@ extern int ix86_attr_length_vex_default (rtx_insn *, bool, 
bool);
 extern rtx ix86_libcall_value (machine_mode);
 extern bool ix86_function_arg_regno_p (int);
 extern void ix86_asm_output_function_label (FILE *, const char *, tree);
+extern void ix86_asm_output_labelref (FILE *, const char *, const char *);
 extern void ix86_call_abi_override (const_tree);
 extern int ix86_reg_parm_stack_space (const_tree);
 
diff --git a/gcc/config/i386/i386.cc b/gcc/config/i386/i386.cc
index 5cb66dadb43e..1b7dbd425d69 100644
--- a/gcc/config/i386/i386.cc
+++ b/gcc/config/i386/i386.cc
@@ -1716,6 +1716,19 @@ ix86_asm_output_function_label (FILE *out_file, const 
char *fname,
 }
 }
 
+/* Output a user-defined label.  In AT&T syntax, registers are prefixed
+   with %, so labels require no punctuation.  In Intel syntax, registers
+   are unprefixed, so labels may clash with registers or other operators,
+   and require quoting.  */
+void
+ix86_asm_output_labelref (FILE *file, const char *prefix, const char *label)
+{
+  if (ASSEMBLER_DIALECT == ASM_ATT)
+fprintf (file, "%s%s", prefix, label);
+  else
+fprintf (file, "\"%s%s\"", prefix, label);
+}
+
 /* Implementation of call abi switching target hook. Specific to FNDECL
the specific call register sets are set.  See also
ix86_conditional_register_usage for more details.  */
diff --git a/gcc/config/i386/i386.h b/gcc/config/i386/i386.h
index 5aa056ff553b..ccc62fc3e7ca 100644
--- a/gcc/config/i386/i386.h
+++ b/gcc/config/i386/i386.h
@@ -2267,6 +2267,13 @@ extern unsigned int const 
svr4_debugger_register_map[FIRST_PSEUDO_REGISTER];
   } while (0)
 #endif
 
+/* In Intel syntax, we have to quote user-defined labels that would
+   match (unprefixed) registers or operators.  */
+
+#undef ASM_OUTPUT_LABELREF
+#define ASM_OUTPUT_LABELREF(STREAM, NAME)  \
+  ix86_asm_output_labelref ((STREAM), user_label_prefix, (NAME))
+
 /* Under some conditions we need jump tables in the text section,
because the assembler cannot handle label differences between
sections.  */


[gcc r16-868] Enable mcf thread model for aarch64-*-mingw*.

2025-05-25 Thread Jonathan Yong via Gcc-cvs
https://gcc.gnu.org/g:20aae412f824d5245c8e2520b2e38713a64c73b5

commit r16-868-g20aae412f824d5245c8e2520b2e38713a64c73b5
Author: LIU Hao 
Date:   Thu May 15 19:12:51 2025 +0800

Enable mcf thread model for aarch64-*-mingw*.

This is similar to d6d7afcdbc04adb0ec42a44b2d7e05600945af42 about the posix
and win32 thread model.

Signed-off-by: LIU Hao 
Signed-off-by: Jonathan Yong <10wa...@gmail.com>

libgcc/ChangeLog:

* config.host: Enable mcf thread model for aarch64-*-mingw*.
* config/i386/t-mingw-mcfgthread: Move to...
* config/mingw/t-mingw-mcfgthread: ...here.

Diff:
---
 libgcc/config.host   | 7 +--
 libgcc/config/{i386 => mingw}/t-mingw-mcfgthread | 0
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/libgcc/config.host b/libgcc/config.host
index 6a88ee5a2dd0..d36f0e34a3b6 100644
--- a/libgcc/config.host
+++ b/libgcc/config.host
@@ -472,6 +472,9 @@ aarch64-*-mingw*)
  posix)
tmake_thr_file="mingw/t-mingw-pthread"
;;
+ mcf)
+   tmake_thr_file="mingw/t-mingw-mcfgthread"
+   ;;
esac
tmake_file="${tmake_file} ${cpu_type}/t-no-eh ${tmake_thr_file}"
tmake_file="${tmake_file} t-dfprules"
@@ -904,7 +907,7 @@ i[34567]86-*-mingw*)
tmake_thr_file="mingw/t-mingw-pthread"
;;
  mcf)
-   tmake_thr_file="i386/t-mingw-mcfgthread"
+   tmake_thr_file="mingw/t-mingw-mcfgthread"
;;
esac
# This has to match the logic for DWARF2_UNWIND_INFO in 
gcc/config/i386/cygming.h
@@ -931,7 +934,7 @@ x86_64-*-mingw*)
tmake_thr_file="mingw/t-mingw-pthread"
;;
  mcf)
-   tmake_thr_file="i386/t-mingw-mcfgthread"
+   tmake_thr_file="mingw/t-mingw-mcfgthread"
;;
esac
# This has to match the logic for DWARF2_UNWIND_INFO in 
gcc/config/i386/cygming.h
diff --git a/libgcc/config/i386/t-mingw-mcfgthread 
b/libgcc/config/mingw/t-mingw-mcfgthread
similarity index 100%
rename from libgcc/config/i386/t-mingw-mcfgthread
rename to libgcc/config/mingw/t-mingw-mcfgthread