aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/decl2.c
diff options
context:
space:
mode:
authorMike Stump <mrs@apple.com>2006-03-02 02:20:54 +0000
committerMike Stump <mrs@gcc.gnu.org>2006-03-02 02:20:54 +0000
commit1a1d0917518f2e70a04881abd0be4082259243f5 (patch)
treedd454c9ce0e6e065773bfff12faabcd40f8c07eb /gcc/cp/decl2.c
parent011daa767e8ba0999faed5c3ea7e8d8ceaa42fcd (diff)
downloadgcc-1a1d0917518f2e70a04881abd0be4082259243f5.zip
gcc-1a1d0917518f2e70a04881abd0be4082259243f5.tar.gz
gcc-1a1d0917518f2e70a04881abd0be4082259243f5.tar.bz2
re PR target/25908 (vtables with vague linkage is not being marked as vague on darwin)
PR darwin/25908 * decl2.c (import_export_decl): Fix ABI breakage on darwin. * g++.dg/abi/key2.C: Add. From-SVN: r111632
Diffstat (limited to 'gcc/cp/decl2.c')
-rw-r--r--gcc/cp/decl2.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c
index 18cdae2..9cc95b6 100644
--- a/gcc/cp/decl2.c
+++ b/gcc/cp/decl2.c
@@ -1784,9 +1784,14 @@ import_export_decl (tree decl)
/* The generic C++ ABI says that class data is always
COMDAT, even if there is a key function. Some
variants (e.g., the ARM EABI) says that class data
- only has COMDAT linkage if the class data might
- be emitted in more than one translation unit. */
+ only has COMDAT linkage if the class data might be
+ emitted in more than one translation unit. When the
+ key method can be inline and is inline, we still have
+ to arrange for comdat even though
+ class_data_always_comdat is false. */
if (!CLASSTYPE_KEY_METHOD (class_type)
+ || (DECL_DECLARED_INLINE_P (CLASSTYPE_KEY_METHOD (class_type))
+ && targetm.cxx.key_method_may_be_inline ())
|| targetm.cxx.class_data_always_comdat ())
{
/* The ABI requires COMDAT linkage. Normally, we
@@ -1825,7 +1830,10 @@ import_export_decl (tree decl)
if (CLASSTYPE_INTERFACE_KNOWN (type)
&& !CLASSTYPE_INTERFACE_ONLY (type))
{
- comdat_p = targetm.cxx.class_data_always_comdat ();
+ comdat_p = (targetm.cxx.class_data_always_comdat ()
+ || (CLASSTYPE_KEY_METHOD (type)
+ && DECL_DECLARED_INLINE_P (CLASSTYPE_KEY_METHOD (type))
+ && targetm.cxx.key_method_may_be_inline ()));
mark_needed (decl);
if (!flag_weak)
{