aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Stump <mrs@apple.com>2004-07-11 05:13:12 +0000
committerMike Stump <mrs@gcc.gnu.org>2004-07-11 05:13:12 +0000
commit30bf22a0ee6f89f241714483c24417e45392ffdf (patch)
tree3b2399aa188627c9e88f1d6ad2c117774f3346c7
parent8242b64a88f219d9c3fb49c30116712c10bc95b9 (diff)
downloadgcc-30bf22a0ee6f89f241714483c24417e45392ffdf.zip
gcc-30bf22a0ee6f89f241714483c24417e45392ffdf.tar.gz
gcc-30bf22a0ee6f89f241714483c24417e45392ffdf.tar.bz2
decl2.c (import_export_class): Never export/import vtables with inline key functions.
* decl2.c (import_export_class): Never export/import vtables with inline key functions. From-SVN: r84493
-rw-r--r--gcc/cp/ChangeLog5
-rw-r--r--gcc/cp/decl2.c9
2 files changed, 13 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index a9ac0cb..2639623 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,8 @@
+2004-07-10 Mike Stump <mrs@apple.com>
+
+ * decl2.c (import_export_class): Never export/import vtables
+ with inline key functions.
+
2004-07-09 Steven Bosscher <stevenb@suse.de>
* typeck.c (c_expand_asm_operands): Remove.
diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c
index 191888e..4465873 100644
--- a/gcc/cp/decl2.c
+++ b/gcc/cp/decl2.c
@@ -1501,7 +1501,14 @@ import_export_class (tree ctype)
&& TYPE_POLYMORPHIC_P (ctype))
{
tree method = CLASSTYPE_KEY_METHOD (ctype);
- if (method)
+
+ /* If weak symbol support is not available, then we must be
+ careful not to emit the vtable when the key function is
+ inline. An inline function can be defined in multiple
+ translation units. If we were to emit the vtable in each
+ translation unit containing a definition, we would get
+ multiple definition errors at link-time. */
+ if (method && (flag_weak || ! DECL_DECLARED_INLINE_P (method)))
import_export = (DECL_REALLY_EXTERN (method) ? -1 : 1);
}