This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
RFC: PATCH to cygming.h for c++/42870 (missing export with destructor alias)
- From: Jason Merrill <jason at redhat dot com>
- To: Dave Korn <dave dot korn dot cygwin at googlemail dot com>
- Cc: gcc-patches List <gcc-patches at gcc dot gnu dot org>
- Date: Wed, 03 Feb 2010 18:24:57 -0500
- Subject: RFC: PATCH to cygming.h for c++/42870 (missing export with destructor alias)
This patch fixes the bug for me with a cygwin cross-compiler, but I'm
not set up to do a full regression test run. Does this look right to
you? If so, could you test it for me?
commit 48ab90a482da26393b1aa9b445084fed4cd5e19f
Author: Jason Merrill <jason@redhat.com>
Date: Wed Feb 3 18:21:57 2010 -0500
PR c++/42870
* config/i386/cygming.h (ASM_OUTPUT_DEF_FROM_DECLS): Call
i386_pe_maybe_record_exported_symbol.
diff --git a/gcc/config/i386/cygming.h b/gcc/config/i386/cygming.h
index ddec95a..54a61d7 100644
--- a/gcc/config/i386/cygming.h
+++ b/gcc/config/i386/cygming.h
@@ -361,6 +361,7 @@ do { \
{ \
const char *alias \
= IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (DECL)); \
+ i386_pe_maybe_record_exported_symbol (DECL, alias, 0); \
if (TREE_CODE (DECL) == FUNCTION_DECL) \
i386_pe_declare_function_type (STREAM, alias, \
TREE_PUBLIC (DECL)); \
diff --git a/gcc/testsuite/g++.dg/ext/dllexport3.C b/gcc/testsuite/g++.dg/ext/dllexport3.C
new file mode 100644
index 0000000..a47a5e0
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/dllexport3.C
@@ -0,0 +1,19 @@
+// PR c++/42870
+// { dg-do compile { target i?86-*-cygwin *-*-mingw* } }
+// { dg-final { scan-assembler "-export:_ZN2SaD1Ev" } }
+
+#define ATTRIBUTE __attribute__ ((dllexport))
+class ATTRIBUTE Sa {
+ public:
+ Sa()
+ {}
+ ~Sa();
+};
+ATTRIBUTE Sa::~Sa()
+{return;}
+
+bool DllMain(void *a,void*b,int)
+{
+ Sa s;
+ return true;
+}