summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/config/i386/winnt.c6
-rw-r--r--gcc/cp/ChangeLog7
-rw-r--r--gcc/cp/decl.c9
-rw-r--r--gcc/testsuite/ChangeLog6
-rw-r--r--gcc/testsuite/g++.dg/ext/dllimport2.C15
-rw-r--r--gcc/testsuite/g++.dg/ext/dllimport3.C25
7 files changed, 70 insertions, 4 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 59c182cca22..c5c1792e147 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2003-05-21 Danny Smith <dannysmith@users.sourceforge.net>
+
+ PR c++/9738
+ * config/i386/winnt.c (i386_pe_encode_section_info): Enable
+ even if not first.
+
2003-05-20 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* genautomata.c (output_description, output_automaton_units,
diff --git a/gcc/config/i386/winnt.c b/gcc/config/i386/winnt.c
index c2eac3ac7e2..04f5cedb036 100644
--- a/gcc/config/i386/winnt.c
+++ b/gcc/config/i386/winnt.c
@@ -427,9 +427,6 @@ i386_pe_encode_section_info (decl, rtl, first)
rtx rtl;
int first;
{
- if (!first)
- return;
-
default_encode_section_info (decl, rtl, first);
if (TREE_CODE (decl) == FUNCTION_DECL)
@@ -445,7 +442,8 @@ i386_pe_encode_section_info (decl, rtl, first)
}
/* Mark the decl so we can tell from the rtl whether the object is
- dllexport'd or dllimport'd. */
+ dllexport'd or dllimport'd. This also handles dllexport/dllimport
+ override semantics. */
if (i386_pe_dllexport_p (decl))
i386_pe_mark_dllexport (decl);
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 15a0eb60e01..7ea230f968c 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,10 @@
+2003-05-21 Danny Smith <dannysmith@users.sourceforge.net>
+
+ PR c++/9738
+ * decl.c (duplicate_decls): Re-invoke make_decl_rtl
+ if the old decl had instantiated DECL_RTL.
+ (Base on Richard Henderson 2003-05-13 patch to c-decl.c).
+
2003-05-19 Matt Austern <austern@apple.com>
* lang-options.h: Document -Wno-invalid-offsetof
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 48f4a8cf58e..71a58227705 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -3593,6 +3593,15 @@ duplicate_decls (tree newdecl, tree olddecl)
Update OLDDECL to be the same. */
DECL_ATTRIBUTES (olddecl) = DECL_ATTRIBUTES (newdecl);
+ /* If OLDDECL had its DECL_RTL instantiated, re-invoke make_decl_rtl
+ so that encode_section_info has a chance to look at the new decl
+ flags and attributes. */
+ if (DECL_RTL_SET_P (olddecl)
+ && (TREE_CODE (olddecl) == FUNCTION_DECL
+ || (TREE_CODE (olddecl) == VAR_DECL
+ && TREE_STATIC (olddecl))))
+ make_decl_rtl (olddecl, NULL);
+
return 1;
}
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index d27ea229f5f..db194e8b321 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,9 @@
+2003-05-21 Danny Smith <dannysmith@users.sourceforge.net>
+
+ PR c++/9738
+ * g++.dg/ext/dllimport2.C: New file.
+ * g++.dg/ext/dllimport3.C: New file.
+
2003-05-20 Janis Johnson <janis187@us.ibm.com>
* gcc.dg/compat/struct-by-value-3_x.c: Move common pieces to headers.
diff --git a/gcc/testsuite/g++.dg/ext/dllimport2.C b/gcc/testsuite/g++.dg/ext/dllimport2.C
new file mode 100644
index 00000000000..9564be4f74c
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/dllimport2.C
@@ -0,0 +1,15 @@
+// { dg-do compile { target i?86-*-cygwin* i?86-*-mingw*} }
+
+// PR 9738 Dllimport attribute is overriden by later definition
+
+void __attribute__((dllimport)) Bar(void);
+
+ void Foo(void)
+ {
+ Bar();
+ }
+
+ void Bar(void)
+ {
+ }
+
diff --git a/gcc/testsuite/g++.dg/ext/dllimport3.C b/gcc/testsuite/g++.dg/ext/dllimport3.C
new file mode 100644
index 00000000000..d5e7955dbff
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/dllimport3.C
@@ -0,0 +1,25 @@
+// { dg-do compile { target i?86-*-cygwin* i?86-*-mingw*} }
+
+// PR 10148 Dllimport attribute of object is overriden by later
+// redefinition without attribute.
+
+struct Foo
+ {
+ int a;
+ };
+
+ __attribute__((dllimport)) struct Foo f;
+
+ void Bar(void)
+ {
+ void* dummy = &f;
+ }
+
+ struct Foo f;
+
+// Dllimport sets DECL_NON_ADDR_CONST_P to 1, so following
+// assignment would require static_initialization_and_destruction
+// if attribute is retained.
+
+ void* dummy = &f;
+