From 51dd20d6225772a5d6c77076c7aee92d4d945516 Mon Sep 17 00:00:00 2001
From: Jonathan Yong <10walls@gmail.com>
Date: Sat, 28 Jun 2014 09:44:48 +0800
Subject: [PATCH 02/13] Cygwin: add dummy -pthread, -tsaware and
 --large-address-aware for executables only

---
 gcc/config/i386/cygwin-w64.h | 1 +
 gcc/config/i386/cygwin.h     | 2 ++
 gcc/config/i386/cygwin.opt   | 3 +++
 3 files changed, 6 insertions(+)

diff --git a/gcc/config/i386/cygwin-w64.h b/gcc/config/i386/cygwin-w64.h
index 8bac9d05ca7..75896f80d7c 100644
--- a/gcc/config/i386/cygwin-w64.h
+++ b/gcc/config/i386/cygwin-w64.h
@@ -67,6 +67,7 @@ along with GCC; see the file COPYING3.  If not see
   %{shared|mdll: " SUB_LINK_ENTRY " --enable-auto-image-base} \
   %(shared_libgcc_undefs) \
   --dll-search-prefix=cyg \
+  %{rdynamic: --export-all-symbols} \
   %{!shared: %{!mdll: %{" SPEC_32 ":--large-address-aware} --tsaware}}"
 
 /* Cygwin64 will have a 64-bit long type. */
diff --git a/gcc/config/i386/cygwin.h b/gcc/config/i386/cygwin.h
index 71fb6135c2c..c42224a7824 100644
--- a/gcc/config/i386/cygwin.h
+++ b/gcc/config/i386/cygwin.h
@@ -102,6 +102,7 @@ along with GCC; see the file COPYING3.  If not see
 
 /* To implement C++ function replacement we always wrap the cxx
    malloc-like operators.  See N2800 #17.6.4.6 [replacement.functions] */
+#undef CXX_WRAP_SPEC_LIST
 #define CXX_WRAP_SPEC_LIST " \
   --wrap _Znwj \
   --wrap _Znaj \
@@ -140,6 +141,7 @@ along with GCC; see the file COPYING3.  If not see
   %{static:-Bstatic} %{!static:-Bdynamic} \
   %{shared|mdll: --enable-auto-image-base -e __cygwin_dll_entry@12} \
   --dll-search-prefix=cyg \
+  %{rdynamic: --export-all-symbols} \
   %{!shared: %{!mdll: --large-address-aware --tsaware}}"
 
 /* Binutils does not handle weak symbols from dlls correctly.  For now,
diff --git a/gcc/config/i386/cygwin.opt b/gcc/config/i386/cygwin.opt
index fcec11db6ad..4062e41a780 100644
--- a/gcc/config/i386/cygwin.opt
+++ b/gcc/config/i386/cygwin.opt
@@ -21,4 +21,7 @@
 pthread
 Driver
 
+rdynamic
+Driver
+
 ; Retain blank line above
-- 
2.39.0

