From f7eda39d692f90d5c2c10e71ed9dc0d52a11c852 Mon Sep 17 00:00:00 2001
From: Jonathan Yong <10walls@gmail.com>
Date: Sat, 28 Jun 2014 09:44:48 +0800
Subject: [PATCH 04/18] 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 25814a32ace..3fe429379c3 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 73737f4805c..13a7d57eb65 100644
--- a/gcc/config/i386/cygwin.h
+++ b/gcc/config/i386/cygwin.h
@@ -93,6 +93,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 \
@@ -131,6 +132,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 44b9c887234..d95cfe7d653 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.28.0

