]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
target-def.h (TARGET_CXX_EXPORT_CLASS_DATA): Remove.
authorMark Mitchell <mark@codesourcery.com>
Tue, 12 Apr 2005 06:33:48 +0000 (06:33 +0000)
committerMark Mitchell <mmitchel@gcc.gnu.org>
Tue, 12 Apr 2005 06:33:48 +0000 (06:33 +0000)
* target-def.h (TARGET_CXX_EXPORT_CLASS_DATA): Remove.
(TARGET_CXX_DETERMINE_CLASS_VISIBILITY): New macro.
(TARGET_CXX_CLASS_DATA_ALWAYS_COMDAT): Likewise.
(TARGET_CXX): Adjust accordingly.
* target.h (struct gcc_target): Remove epxort_class_data.  Add
determine_class_data_visibility and class_data_always_comdat.
* doc/tm.texi (TARGET_CXX_EXPORT_CLASS_DATA): Remove.
(TARGET_CXX_DETERMINE_CLASS_DATA_VISIBILITY): Document.
(TARGET_CXX_CLASS_DATA_ALWAYS_COMDAT): Likewise.
* config/arm/arm.c (arm_cxx_export_class_data): Remove.
(arm_cxx_determine_class_data_visibility): New.
(arm_cxx_class_data_always_comdat): Likewise.
(TARGET_CXX_EXPORT_CLASS_DATA): Remove.
(TARGET_CXX_DETERMINE_CLASS_DATA_VISIBILITY): Define.
(TARGET_CXX_CLASS_DATA_ALWAYS_COMDAT): Likewise.
* config/arm/arm.h (TARGET_ARM_DYNAMIC_VAGUE_LINKAGE_P): Define.
* config/arm/symbian.h (TARGET_ARM_DYNAMIC_VAGUE_LINKAGE_P):
Define.

* decl2.c (determine_visibility): Don't use export_class_data.
(import_export_decl): Honor TARGET_CXX_CLASS_DATA_ALWAYS_WEAK and
TARGET_CXX_DETERMINE_CLASS_DATA_VISIBILITY.

* testsuite/g++.dg/ext/visibility/arm2.C: New test.
* testsuite/g++.dg/ext/visibility/arm3.C: Likewise.
* testsuite/g++.dg/ext/visibility/symbian2.C: Likewise.

From-SVN: r98010

13 files changed:
gcc/ChangeLog
gcc/config/arm/arm.c
gcc/config/arm/arm.h
gcc/config/arm/symbian.h
gcc/cp/ChangeLog
gcc/cp/decl2.c
gcc/doc/tm.texi
gcc/target-def.h
gcc/target.h
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/ext/visibility/arm2.C [new file with mode: 0644]
gcc/testsuite/g++.dg/ext/visibility/arm3.C [new file with mode: 0644]
gcc/testsuite/g++.dg/ext/visibility/symbian2.C [new file with mode: 0644]

index 80308c82263993e58402d7e3e34e9acf146adba1..38b643cc12d83045aee0f4f00c26c09e1eb1b59d 100644 (file)
@@ -1,3 +1,24 @@
+2005-04-11  Mark Mitchell  <mark@codesourcery.com>
+
+       * target-def.h (TARGET_CXX_EXPORT_CLASS_DATA): Remove.
+       (TARGET_CXX_DETERMINE_CLASS_VISIBILITY): New macro.
+       (TARGET_CXX_CLASS_DATA_ALWAYS_COMDAT): Likewise.
+       (TARGET_CXX): Adjust accordingly.
+       * target.h (struct gcc_target): Remove epxort_class_data.  Add
+       determine_class_data_visibility and class_data_always_comdat.
+       * doc/tm.texi (TARGET_CXX_EXPORT_CLASS_DATA): Remove.
+       (TARGET_CXX_DETERMINE_CLASS_DATA_VISIBILITY): Document.
+       (TARGET_CXX_CLASS_DATA_ALWAYS_COMDAT): Likewise.
+       * config/arm/arm.c (arm_cxx_export_class_data): Remove.
+       (arm_cxx_determine_class_data_visibility): New.
+       (arm_cxx_class_data_always_comdat): Likewise.
+       (TARGET_CXX_EXPORT_CLASS_DATA): Remove.
+       (TARGET_CXX_DETERMINE_CLASS_DATA_VISIBILITY): Define.
+       (TARGET_CXX_CLASS_DATA_ALWAYS_COMDAT): Likewise.
+       * config/arm/arm.h (TARGET_ARM_DYNAMIC_VAGUE_LINKAGE_P): Define.
+       * config/arm/symbian.h (TARGET_ARM_DYNAMIC_VAGUE_LINKAGE_P):
+       Define.
+
 2005-04-11  Devang Patel  <dpatel@apple.com>
 
         * tree-data-ref.c (build_classic_dist_vector,
index 5091f8e7c94200a2131b05d92ab856d7d21006ed..b713bff9a3076ce4e0807c1215f7c4a55df94042 100644 (file)
@@ -172,7 +172,8 @@ static tree arm_get_cookie_size (tree);
 static bool arm_cookie_has_size (void);
 static bool arm_cxx_cdtor_returns_this (void);
 static bool arm_cxx_key_method_may_be_inline (void);
-static bool arm_cxx_export_class_data (void);
+static void arm_cxx_determine_class_data_visibility (tree);
+static bool arm_cxx_class_data_always_comdat (void);
 static void arm_init_libfuncs (void);
 static unsigned HOST_WIDE_INT arm_shift_truncation_mask (enum machine_mode);
 \f
@@ -307,8 +308,12 @@ static unsigned HOST_WIDE_INT arm_shift_truncation_mask (enum machine_mode);
 #undef TARGET_CXX_KEY_METHOD_MAY_BE_INLINE
 #define TARGET_CXX_KEY_METHOD_MAY_BE_INLINE arm_cxx_key_method_may_be_inline
 
-#undef TARGET_CXX_EXPORT_CLASS_DATA
-#define TARGET_CXX_EXPORT_CLASS_DATA arm_cxx_export_class_data
+#undef TARGET_CXX_DETERMINE_CLASS_DATA_VISIBILITY
+#define TARGET_CXX_DETERMINE_CLASS_DATA_VISIBILITY \
+  arm_cxx_determine_class_data_visibility
+
+#undef TARGET_CXX_CLASS_DATA_ALWAYS_COMDAT
+#define TARGET_CXX_CLASS_DATA_ALWAYS_COMDAT arm_cxx_class_data_always_comdat
 
 struct gcc_target targetm = TARGET_INITIALIZER;
 \f
@@ -14318,15 +14323,28 @@ arm_cxx_key_method_may_be_inline (void)
   return !TARGET_AAPCS_BASED;
 }
 
-/* The EABI says that the virtual table, etc., for a class must be
-   exported if it has a key method.  The EABI does not specific the
-   behavior if there is no key method, but there is no harm in
-   exporting the class data in that case too.  */
+static void
+arm_cxx_determine_class_data_visibility (tree decl)
+{
+  if (!TARGET_AAPCS_BASED)
+    return;
 
+  /* In general, \S 3.2.5.5 of the ARM EABI requires that class data
+     is exported.  However, on systems without dynamic vague linkage,
+     \S 3.2.5.6 says that COMDAT class data has hidden linkage.  */
+  if (!TARGET_ARM_DYNAMIC_VAGUE_LINKAGE_P && DECL_COMDAT (decl))
+    DECL_VISIBILITY (decl) = VISIBILITY_HIDDEN;
+  else
+    DECL_VISIBILITY (decl) = VISIBILITY_DEFAULT;
+  DECL_VISIBILITY_SPECIFIED (decl) = 1;
+}
+  
 static bool
-arm_cxx_export_class_data (void)
+arm_cxx_class_data_always_comdat (void)
 {
-  return TARGET_AAPCS_BASED;
+  /* \S 3.2.5.4 of the ARM C++ ABI says that class data only have
+     vague linkage if the class has no key function.  */
+  return !TARGET_AAPCS_BASED;
 }
 
 void
index 59ad92ad25448a55bea709da7a92009f034102e3..5955a52ad85b686239c14acb1ea83a25f1ebe2c3 100644 (file)
@@ -2108,6 +2108,12 @@ typedef struct
 #define ASM_OUTPUT_LABELREF(FILE, NAME)                \
    arm_asm_output_labelref (FILE, NAME)
 
+/* True if the operating system can merge entities with vague linkage
+   (e.g., symbols in COMDAT group) during dynamic linking.  */
+#ifndef TARGET_ARM_DYNAMIC_VAGUE_LINKAGE_P
+#define TARGET_ARM_DYNAMIC_VAGUE_LINKAGE_P true
+#endif
+
 /* Set the short-call flag for any function compiled in the current
    compilation unit.  We skip this for functions with the section
    attribute when long-calls are in effect as this tells the compiler
index 2a588ed780a8da27d20a9eaea3607b6d85c7637b..5ea3fa7f1c6209636925d955ed595da1301a3905 100644 (file)
@@ -87,3 +87,7 @@
       builtin_define ("__symbian__");          \
     }                                          \
   while (false)
+
+
+/* SymbianOS cannot merge entities with vague linkage at runtime.  */
+#define TARGET_ARM_DYNAMIC_VAGUE_LINKAGE_P false
index 55d6e3eb1d9fee9c379bd8e65d7255d27499988b..3019b86084c0f9eb25989b1f04be9b5e9f1a532f 100644 (file)
@@ -1,3 +1,9 @@
+2005-04-11  Mark Mitchell  <mark@codesourcery.com>
+
+       * decl2.c (determine_visibility): Don't use export_class_data.
+       (import_export_decl): Honor TARGET_CXX_CLASS_DATA_ALWAYS_WEAK and
+       TARGET_CXX_DETERMINE_CLASS_DATA_VISIBILITY. 
+
 2005-04-09  Kazu Hirata  <kazu@cs.umass.edu>
 
        * cp-tree.h (cxx_alignof): Remove.
index 4a2659b3f215ae9a2fee83f83e400032f813db76..0aa81117a7fab9f0e7f986a57ab8f65e55ee99a8 100644 (file)
@@ -1644,20 +1644,7 @@ determine_visibility (tree decl)
          DECL_VISIBILITY (decl) = CLASSTYPE_VISIBILITY (class_type);
          DECL_VISIBILITY_SPECIFIED (decl) = 1;
        }
-      /* If no explicit visibility information has been provided for
-        this class, some targets require that class data be
-        exported.  */
-      else if (TREE_CODE (decl) == VAR_DECL
-              && targetm.cxx.export_class_data ()
-              && (DECL_TINFO_P (decl)
-                  || (DECL_VTABLE_OR_VTT_P (decl)
-                      /* Construction virtual tables are not emitted
-                         because they cannot be referred to from other
-                         object files; their name is not standardized by
-                         the ABI.  */
-                      && !DECL_CONSTRUCTION_VTABLE_P (decl))))
-       DECL_VISIBILITY (decl) = VISIBILITY_DEFAULT;
-      else
+      else if (!DECL_VISIBILITY_SPECIFIED (decl))
        {
          DECL_VISIBILITY (decl) = CLASSTYPE_VISIBILITY (class_type);
          DECL_VISIBILITY_SPECIFIED (decl) = 0;
@@ -1683,6 +1670,7 @@ import_export_decl (tree decl)
   int emit_p;
   bool comdat_p;
   bool import_p;
+  tree class_type = NULL_TREE;
 
   if (DECL_INTERFACE_KNOWN (decl))
     return;
@@ -1773,17 +1761,17 @@ import_export_decl (tree decl)
     ;
   else if (TREE_CODE (decl) == VAR_DECL && DECL_VTABLE_OR_VTT_P (decl))
     {
-      tree type = DECL_CONTEXT (decl);
-      import_export_class (type);
-      if (TYPE_FOR_JAVA (type))
+      class_type = DECL_CONTEXT (decl);
+      import_export_class (class_type);
+      if (TYPE_FOR_JAVA (class_type))
        import_p = true;
-      else if (CLASSTYPE_INTERFACE_KNOWN (type)
-              && CLASSTYPE_INTERFACE_ONLY (type))
+      else if (CLASSTYPE_INTERFACE_KNOWN (class_type)
+              && CLASSTYPE_INTERFACE_ONLY (class_type))
        import_p = true;
       else if ((!flag_weak || TARGET_WEAK_NOT_IN_ARCHIVE_TOC)
-              && !CLASSTYPE_USE_TEMPLATE (type)
-              && CLASSTYPE_KEY_METHOD (type)
-              && !DECL_DECLARED_INLINE_P (CLASSTYPE_KEY_METHOD (type)))
+              && !CLASSTYPE_USE_TEMPLATE (class_type)
+              && CLASSTYPE_KEY_METHOD (class_type)
+              && !DECL_DECLARED_INLINE_P (CLASSTYPE_KEY_METHOD (class_type)))
        /* The ABI requires that all virtual tables be emitted with
           COMDAT linkage.  However, on systems where COMDAT symbols
           don't show up in the table of contents for a static
@@ -1795,11 +1783,11 @@ import_export_decl (tree decl)
           emitted in only one translation unit, we make the virtual
           table an ordinary definition with external linkage.  */
        DECL_EXTERNAL (decl) = 0;
-      else if (CLASSTYPE_INTERFACE_KNOWN (type))
+      else if (CLASSTYPE_INTERFACE_KNOWN (class_type))
        {
-         /* TYPE is being exported from this translation unit, so DECL
-            should be defined here.  */ 
-         if (!flag_weak && CLASSTYPE_EXPLICIT_INSTANTIATION (type))
+         /* CLASS_TYPE is being exported from this translation unit,
+            so DECL should be defined here.  */ 
+         if (!flag_weak && CLASSTYPE_EXPLICIT_INSTANTIATION (class_type))
            /* If a class is declared in a header with the "extern
               template" extension, then it will not be instantiated,
               even in translation units that would normally require
@@ -1810,16 +1798,25 @@ import_export_decl (tree decl)
            DECL_EXTERNAL (decl) = 0;
          else
            {
-             /* The ABI requires COMDAT linkage.  Normally, we only
-                emit COMDAT things when they are needed; make sure
-                that we realize that this entity is indeed
-                needed.  */
-             comdat_p = true;
-             mark_needed (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 the class data might
+                be emitted in more than one translation unit.  */
+             if (!CLASSTYPE_KEY_METHOD (class_type)
+                 || targetm.cxx.class_data_always_comdat ())
+               {
+                 /* The ABI requires COMDAT linkage.  Normally, we
+                    only emit COMDAT things when they are needed;
+                    make sure that we realize that this entity is
+                    indeed needed.  */
+                 comdat_p = true;
+                 mark_needed (decl);
+               }
            }
        }
       else if (!flag_implicit_templates
-              && CLASSTYPE_IMPLICIT_INSTANTIATION (type))
+              && CLASSTYPE_IMPLICIT_INSTANTIATION (class_type))
        import_p = true;
       else
        comdat_p = true;
@@ -1829,6 +1826,7 @@ import_export_decl (tree decl)
       tree type = TREE_TYPE (DECL_NAME (decl));
       if (CLASS_TYPE_P (type))
        {
+         class_type = type;
          import_export_class (type);
          if (CLASSTYPE_INTERFACE_KNOWN (type)
              && TYPE_POLYMORPHIC_P (type)
@@ -1841,10 +1839,10 @@ import_export_decl (tree decl)
            import_p = true;
          else 
            {
-             comdat_p = true;
              if (CLASSTYPE_INTERFACE_KNOWN (type)
                  && !CLASSTYPE_INTERFACE_ONLY (type))
                {
+                 comdat_p = targetm.cxx.class_data_always_comdat ();
                  mark_needed (decl);
                  if (!flag_weak)
                    {
@@ -1852,6 +1850,8 @@ import_export_decl (tree decl)
                      DECL_EXTERNAL (decl) = 0;
                    }
                }
+             else
+               comdat_p = true;
            }
        }
       else
@@ -1916,6 +1916,21 @@ import_export_decl (tree decl)
       comdat_linkage (decl);
     }
 
+  /* Give the target a chance to override the visibility associated
+     with DECL.  */
+  if (TREE_CODE (decl) == VAR_DECL
+      && (DECL_TINFO_P (decl)
+         || (DECL_VTABLE_OR_VTT_P (decl)
+             /* Construction virtual tables are not exported because
+                they cannot be referred to from other object files;
+                their name is not standardized by the ABI.  */
+             && !DECL_CONSTRUCTION_VTABLE_P (decl)))
+      && TREE_PUBLIC (decl)
+      && !DECL_REALLY_EXTERN (decl)
+      && DECL_VISIBILITY_SPECIFIED (decl)
+      && (!class_type || !CLASSTYPE_VISIBILITY_SPECIFIED (class_type)))
+    targetm.cxx.determine_class_data_visibility (decl);
+  
   DECL_INTERFACE_KNOWN (decl) = 1;
 }
 
index 8d575015f3c94b53f6c3dbbef1ec1b07ab9e9254..9b7856026ff8e8a9940c25f4319b2c46df0f1e8f 100644 (file)
@@ -8718,12 +8718,21 @@ some variants of the ABI, an inline function can never be the key
 method.  The default is to return @code{true}.
 @end deftypefn
 
-@deftypefn {Target Hook} bool TARGET_CXX_EXPORT_CLASS_DATA (void)
-If this hook returns false (the default), then virtual tables and RTTI
-data structures will have the ELF visibility of their containing
-class.  If this hook returns true, then these data structures will
-have ELF ``default'' visibility, independently of the visibility of
-the containing class.
+@deftypefn {Target Hook} void TARGET_CXX_DETERMINE_CLASS_DATA_VISIBILITY (tree @var{decl})
+@var{decl} is a virtual table, virtual table table, typeinfo object,
+or other similar implicit class data object that will be emitted with
+external linkage in this translation unit.  No ELF visibility has been
+explicitly specified.  If the target needs to specify a visibility
+other than that of the containing class, use this hook to set
+@code{DECL_VISIBILITY} and @code{DECL_VISIBILITY_SPECIFIED}.
+@end deftypefn
+
+@deftypefn {Target Hook} bool TARGET_CXX_CLASS_DATA_ALWAYS_COMDAT (void)
+This hook returns true (the default) if virtual tables and other
+similar implicit class data objects are always COMDAT if they have
+external linkage.  If this hook returns false, then class data for
+classes whose virtual table will be emitted in only one translation
+unit will not be COMDAT.
 @end deftypefn
 
 @node Misc
index aa65e37c5ace288934c3833314f59bc58dcf362b..44e3791f0ab59bb1d2b75b52ef0a5892e625d3c2 100644 (file)
@@ -469,8 +469,12 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 #define TARGET_CXX_KEY_METHOD_MAY_BE_INLINE hook_bool_void_true
 #endif
 
-#ifndef TARGET_CXX_EXPORT_CLASS_DATA
-#define TARGET_CXX_EXPORT_CLASS_DATA hook_bool_void_false
+#ifndef TARGET_CXX_DETERMINE_CLASS_DATA_VISIBILITY
+#define TARGET_CXX_DETERMINE_CLASS_DATA_VISIBILITY hook_void_tree
+#endif
+
+#ifndef TARGET_CXX_CLASS_DATA_ALWAYS_COMDAT
+#define TARGET_CXX_CLASS_DATA_ALWAYS_COMDAT hook_bool_void_true
 #endif
 
 #define TARGET_CXX                             \
@@ -482,7 +486,8 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
     TARGET_CXX_IMPORT_EXPORT_CLASS,            \
     TARGET_CXX_CDTOR_RETURNS_THIS,             \
     TARGET_CXX_KEY_METHOD_MAY_BE_INLINE,       \
-    TARGET_CXX_EXPORT_CLASS_DATA               \
+    TARGET_CXX_DETERMINE_CLASS_DATA_VISIBILITY,        \
+    TARGET_CXX_CLASS_DATA_ALWAYS_COMDAT,        \
   }
 
 /* The whole shebang.  */
index 42a721ce2af9f51ef85abda398b096b0ef0f91ee..2cb4db278a07804bce3db3828bc8f6d7490aef6b 100644 (file)
@@ -589,10 +589,20 @@ struct gcc_target
        itself.  Returning true is the behavior required by the Itanium
        C++ ABI.  */
     bool (*key_method_may_be_inline) (void);
-    /* Returns true if all class data (virtual tables, type info,
-       etc.) should be exported from the current DLL, even when the
-       associated class is not exported.  */
-    bool (*export_class_data) (void);
+    /* DECL is a virtual table, virtual table table, typeinfo object,
+       or other similar implicit class data object that will be
+       emitted with external linkage in this translation unit.  No ELF
+       visibility has been explicitly specified.  If the target needs
+       to specify a visibility other than that of the containing class,
+       use this hook to set DECL_VISIBILITY and
+       DECL_VISIBILITY_SPECIFIED.  */ 
+    void (*determine_class_data_visibility) (tree decl);
+    /* Returns true (the default) if virtual tables and other
+       similar implicit class data objects are always COMDAT if they
+       have external linkage.  If this hook returns false, then
+       class data for classes whose virtual table will be emitted in
+       only one translation unit will not be COMDAT.  */
+    bool (*class_data_always_comdat) (void);
   } cxx;
 
   /* Leave the boolean fields at the end.  */
index 1786a405d7bc7fed123a7f9105ea6bf425fe2f6f..3e7c29d1c1f7ae9d707896deb56e0c13590e385d 100644 (file)
@@ -1,3 +1,24 @@
+2005-04-11  Mark Mitchell  <mark@codesourcery.com>
+
+       * target-def.h (TARGET_CXX_EXPORT_CLASS_DATA): Remove.
+       (TARGET_CXX_DETERMINE_CLASS_VISIBILITY): New macro.
+       (TARGET_CXX_CLASS_DATA_ALWAYS_COMDAT): Likewise.
+       (TARGET_CXX): Adjust accordingly.
+       * target.h (struct gcc_target): Remove epxort_class_data.  Add
+       determine_class_data_visibility and class_data_always_comdat.
+       * doc/tm.texi (TARGET_CXX_EXPORT_CLASS_DATA): Remove.
+       (TARGET_CXX_DETERMINE_CLASS_DATA_VISIBILITY): Document.
+       (TARGET_CXX_CLASS_DATA_ALWAYS_COMDAT): Likewise.
+       * config/arm/arm.c (arm_cxx_export_class_data): Remove.
+       (arm_cxx_determine_class_data_visibility): New.
+       (arm_cxx_class_data_always_comdat): Likewise.
+       (TARGET_CXX_EXPORT_CLASS_DATA): Remove.
+       (TARGET_CXX_DETERMINE_CLASS_DATA_VISIBILITY): Define.
+       (TARGET_CXX_CLASS_DATA_ALWAYS_COMDAT): Likewise.
+       * config/arm/arm.h (TARGET_ARM_DYNAMIC_VAGUE_LINKAGE_P): Define.
+       * config/arm/symbian.h (TARGET_ARM_DYNAMIC_VAGUE_LINKAGE_P):
+       Define.
+
 2005-04-11  Mark Mitchell  <mark@codesourcery.com>
 
        * lib/wrapper.exp (${tool}_maybe_build_wrapper): Don't unset gluefile.
diff --git a/gcc/testsuite/g++.dg/ext/visibility/arm2.C b/gcc/testsuite/g++.dg/ext/visibility/arm2.C
new file mode 100644 (file)
index 0000000..7eed18d
--- /dev/null
@@ -0,0 +1,11 @@
+// { dg-do compile { target arm*-*-*eabi* arm*-*-symbianelf* } }
+// Class data should be exported.
+// { dg-final { scan-not-hidden "_ZTV1S" } }
+// { dg-final { scan-not-hidden "_ZTI1S" } }
+// { dg-final { scan-not-hidden "_ZTS1S" } }
+
+struct S {
+  virtual void f();
+};
+
+void S::f() {}
diff --git a/gcc/testsuite/g++.dg/ext/visibility/arm3.C b/gcc/testsuite/g++.dg/ext/visibility/arm3.C
new file mode 100644 (file)
index 0000000..f97813d
--- /dev/null
@@ -0,0 +1,12 @@
+// { dg-do compile { target arm*-*-*eabi* } }
+// { dg-options "-fvisibility=hidden" }
+// Class data should be exported.
+// { dg-final { scan-not-hidden "_ZTI1A" } }
+// { dg-final { scan-not-hidden "_ZTS1A" } }
+// { dg-final { scan-not-hidden "_ZTV1B" } }
+// { dg-final { scan-not-hidden "_ZTI1B" } }
+// { dg-final { scan-not-hidden "_ZTS1B" } }
+
+struct A {};
+struct B : virtual public A {};
+B b;
diff --git a/gcc/testsuite/g++.dg/ext/visibility/symbian2.C b/gcc/testsuite/g++.dg/ext/visibility/symbian2.C
new file mode 100644 (file)
index 0000000..767f0b5
--- /dev/null
@@ -0,0 +1,11 @@
+// { dg-do compile { target arm*-*-symbianelf* } }
+// Class data should not be exported.
+// { dg-final { scan-hidden "_ZTI1A" } }
+// { dg-final { scan-hidden "_ZTS1A" } }
+// { dg-final { scan-hidden "_ZTV1B" } }
+// { dg-final { scan-hidden "_ZTI1B" } }
+// { dg-final { scan-hidden "_ZTS1B" } }
+
+struct A {};
+struct B : virtual public A {};
+B b;