]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
decl2.c (determine_visibility): Allow target to override visibility of class data.
authorJulian Brown <julian@codesourcery.com>
Thu, 17 Jul 2008 14:03:50 +0000 (14:03 +0000)
committerJulian Brown <jules@gcc.gnu.org>
Thu, 17 Jul 2008 14:03:50 +0000 (14:03 +0000)
    gcc/cp/
    * decl2.c (determine_visibility): Allow target to override
    visibility of class data.

    gcc/
    * config/arm/arm.c (arm_cxx_determine_class_data_visibility): Make
    no-op for targets which don't use DLLs.

    gcc/testsuite/
    * g++.dg/ext/visibility/arm3.C: Add explanatory text. Skip on
    non-DLL targets.
    * g++.dg/ext/visibility/arm1.C: Skip on non-DLL targets.

Co-Authored-By: Mark Mitchell <mark@codesourcery.com>
From-SVN: r137922

gcc/ChangeLog
gcc/config/arm/arm.c
gcc/cp/ChangeLog
gcc/cp/decl2.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/ext/visibility/arm1.C
gcc/testsuite/g++.dg/ext/visibility/arm3.C

index 53e1131037d934f81154a6e5630999e2edc6eb83..41b5a4924e7898487ecd1542af621b08a41a3c8e 100644 (file)
@@ -1,3 +1,8 @@
+2008-07-17  Julian Brown  <julian@codesourcery.com>
+
+       * config/arm/arm.c (arm_cxx_determine_class_data_visibility): Make
+       no-op for targets which don't use DLLs.
+
 2008-07-17  Martin Jambor  <mjambor@suse.cz>
 
        * ipa-cp.c (ipcp_print_all_lattices): New variable info, check
index 0ce531bb80284afbf05350de18e87e30200cc643..d64b6fda34f0a0c501f3474b5bb372a28119ecca 100644 (file)
@@ -18318,7 +18318,8 @@ arm_cxx_key_method_may_be_inline (void)
 static void
 arm_cxx_determine_class_data_visibility (tree decl)
 {
-  if (!TARGET_AAPCS_BASED)
+  if (!TARGET_AAPCS_BASED
+      || !TARGET_DLLIMPORT_DECL_ATTRIBUTES)
     return;
 
   /* In general, \S 3.2.5.5 of the ARM EABI requires that class data
index 0e537b855c7c5dd04e4a2a4b48734d0bbfb628ad..a664d0f9bc9e3af4cac5c239b04f6caae2fbe3c2 100644 (file)
@@ -1,3 +1,9 @@
+2008-07-17  Julian Brown  <julian@codesourcery.com>
+           Mark Mitchell  <mark@codesourcery.com>
+
+       * decl2.c (determine_visibility): Allow target to override
+       visibility of class data.
+
 2008-07-17  Paolo Carlini  <paolo.carlini@oracle.com>
 
        PR c++/36855
index a5ece9a670911868612b4bbbc3bb3cafbbea89a6..f14f94d16b51e15edbd2ab904a424e4320e50ad8 100644 (file)
@@ -1963,6 +1963,14 @@ determine_visibility (tree decl)
          /* tinfo visibility is based on the type it's for.  */
          constrain_visibility
            (decl, type_visibility (TREE_TYPE (DECL_NAME (decl))));
+
+         /* Give the target a chance to override the visibility associated
+            with DECL.  */
+         if (TREE_PUBLIC (decl)
+             && !DECL_REALLY_EXTERN (decl)
+             && CLASS_TYPE_P (TREE_TYPE (DECL_NAME (decl)))
+             && !CLASSTYPE_VISIBILITY_SPECIFIED (TREE_TYPE (DECL_NAME (decl))))
+           targetm.cxx.determine_class_data_visibility (decl);
        }
       else if (use_template)
        /* Template instantiations and specializations get visibility based
index 528a1114b30df6845921ae684f330eef995f0e8e..55d0839c1838d1c0adb57059b99b8aca4ae3a75b 100644 (file)
@@ -1,3 +1,10 @@
+2008-07-17  Julian Brown  <julian@codesourcery.com>
+           Mark Mitchell  <mark@codesourcery.com>
+
+       * g++.dg/ext/visibility/arm3.C: Add explanatory text. Skip on
+       non-DLL targets.
+       * g++.dg/ext/visibility/arm1.C: Skip on non-DLL targets.
+
 2008-07-17  Paolo Carlini  <paolo.carlini@oracle.com>
 
        PR c++/36855
index 8b4949492a1deeae2871e574c4053f200b92bf40..2c2e3d0664a0e722dbefe8837161a043d2ecdc67 100644 (file)
@@ -1,4 +1,5 @@
 // { dg-do compile { target arm*-*-eabi* arm*-*-symbianelf* } }
+// { dg-require-dll "" }
 // { dg-options "-fvisibility=hidden" }
 // Most class data should be exported.
 // { dg-final { scan-not-hidden "_ZTV1S" } }
index f97813d7f213abec7b113ccfb9c93dd6e8b50038..9be7082ce1ddba0080de0cd0d1aeb1adbeec89da 100644 (file)
@@ -1,6 +1,30 @@
 // { dg-do compile { target arm*-*-*eabi* } }
+// { dg-require-dll "" }
 // { dg-options "-fvisibility=hidden" }
-// Class data should be exported.
+
+/* From ARM C++ ABI \S 3.2.5.5:
+
+     A class should be exported unless explicitly tagged otherwise.
+
+   This admonition applies even on DLL-based systems where hidden
+   visibility is the default.  We want -fvisibility=hidden to behave
+   identically to the situation where hidden visibility is the
+   hard-wired default.  So, both A and B are exported classes.
+
+   Furthermore:
+
+     If CAG symbol Y names one of the impedimenta associated with an
+     exported class X:
+
+     ... 
+
+     * Otherwise, if X has no key function:
+     
+       - Y is exported from ... each DLL that refers to X and uses Y.
+
+   So, the type-info and virtual-table symbols associated with A and B
+   must be exported.  */
+
 // { dg-final { scan-not-hidden "_ZTI1A" } }
 // { dg-final { scan-not-hidden "_ZTS1A" } }
 // { dg-final { scan-not-hidden "_ZTV1B" } }