From: Saurabh Jha <[email protected]>

Fixes regression in C++ support without exception handling by:
1. Moving Makefile fragment config/i386/t-seh-eh to
   config/mingw/t-seh-eh that handles C++ exception handling. This is
   sufficient to fix the regression even if the exception handling
   itself is not implemented yet.
2. Changing existing references of t-seh-eh in libgcc/config.host and
   add it for aarch64-*-mingw*.

With these changes, the compiler can now be built with C and C++.

This doesn't add support for Structured Exception Handling (SEH)
which will be done separately.

libgcc/ChangeLog:

        * config.host: Set tmake_eh_file for aarch64-*-mingw* and update
        it for x86_64-*-mingw* and x86_64-*-cygwin*.
        * config/i386/t-seh-eh: Move to...
        * config/mingw/t-seh-eh: ...here.
        * config/aarch64/t-no-eh: Removed.

gcc/testsuite/ChangeLog:

        * gcc.target/aarch64/mingw/mingw.exp: Add support for C++ files.
        * gcc.target/aarch64/mingw/minimal_new_del.C: New test.

Co-Authored-By: Evgeny Karpov <[email protected]>
---
 gcc/testsuite/gcc.target/aarch64/mingw/mingw.exp     |  2 +-
 .../gcc.target/aarch64/mingw/minimal_new_del.C       | 12 ++++++++++++
 libgcc/config.host                                   |  6 +++---
 libgcc/config/aarch64/t-no-eh                        |  2 --
 libgcc/config/{i386 => mingw}/t-seh-eh               |  0
 5 files changed, 16 insertions(+), 6 deletions(-)
 create mode 100644 gcc/testsuite/gcc.target/aarch64/mingw/minimal_new_del.C
 delete mode 100644 libgcc/config/aarch64/t-no-eh
 rename libgcc/config/{i386 => mingw}/t-seh-eh (100%)

diff --git a/gcc/testsuite/gcc.target/aarch64/mingw/mingw.exp 
b/gcc/testsuite/gcc.target/aarch64/mingw/mingw.exp
index 98622e270f76..26d65b22e750 100644
--- a/gcc/testsuite/gcc.target/aarch64/mingw/mingw.exp
+++ b/gcc/testsuite/gcc.target/aarch64/mingw/mingw.exp
@@ -34,7 +34,7 @@ if ![info exists DEFAULT_CFLAGS] then {
 dg-init
 
 # Main loop.
-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cCS\]]] \
+dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cCS\]*]] \
        "" $DEFAULT_CFLAGS
 
 # All done.
diff --git a/gcc/testsuite/gcc.target/aarch64/mingw/minimal_new_del.C 
b/gcc/testsuite/gcc.target/aarch64/mingw/minimal_new_del.C
new file mode 100644
index 000000000000..d0e7a9e6e0ca
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/mingw/minimal_new_del.C
@@ -0,0 +1,12 @@
+/* { dg-do run } */
+/* { dg-additional-options "-O2" } */
+
+/* A minimal test to validate that C++ support works.  */
+
+int
+main()
+{
+  int *x = new int;
+  delete x;
+  return 0;
+}
diff --git a/libgcc/config.host b/libgcc/config.host
index 850a37b05558..7e5c99420f88 100644
--- a/libgcc/config.host
+++ b/libgcc/config.host
@@ -463,7 +463,7 @@ aarch64-*-mingw*)
            tmake_thr_file="mingw/t-mingw-mcfgthread"
            ;;
        esac
-       tmake_file="${tmake_file} ${cpu_type}/t-no-eh ${tmake_thr_file}"
+       tmake_file="${tmake_file} mingw/t-seh-eh ${tmake_thr_file}"
        tmake_file="${tmake_file} t-dfprules"
        tmake_file="${tmake_file} ${cpu_type}/t-aarch64"
        tmake_file="${tmake_file} ${cpu_type}/t-mingw"
@@ -870,7 +870,7 @@ x86_64-*-cygwin*)
                # biarch -m32 with --disable-sjlj-exceptions
                tmake_eh_file="i386/t-dw2-eh"
        else
-               tmake_eh_file="i386/t-seh-eh"
+               tmake_eh_file="mingw/t-seh-eh"
        fi
        # Shared libgcc DLL install dir depends on cross/native build.
        if test x${build} = x${host} ; then
@@ -932,7 +932,7 @@ x86_64-*-mingw*)
                tmake_eh_file="i386/t-dw2-eh"
                md_unwind_header=i386/w32-unwind.h
        else
-               tmake_eh_file="i386/t-seh-eh"
+               tmake_eh_file="mingw/t-seh-eh"
        fi
        # Shared libgcc DLL install dir depends on cross/native build.
        if test x${build} = x${host} ; then
diff --git a/libgcc/config/aarch64/t-no-eh b/libgcc/config/aarch64/t-no-eh
deleted file mode 100644
index 1802339a5834..000000000000
--- a/libgcc/config/aarch64/t-no-eh
+++ /dev/null
@@ -1,2 +0,0 @@
-# Not using EH
-LIB2ADDEH =
diff --git a/libgcc/config/i386/t-seh-eh b/libgcc/config/mingw/t-seh-eh
similarity index 100%
rename from libgcc/config/i386/t-seh-eh
rename to libgcc/config/mingw/t-seh-eh
-- 
2.52.0

Reply via email to