diff options
author | Mark Mitchell <mark@codesourcery.com> | 2005-04-12 06:33:48 +0000 |
---|---|---|
committer | Mark Mitchell <mmitchel@gcc.gnu.org> | 2005-04-12 06:33:48 +0000 |
commit | 1e731102619f21fe93135546801e0333752baf15 (patch) | |
tree | 094ff9b55bb63ac087619633c1c3d109473587ff /gcc/config | |
parent | fc7c5aed6197e36ff67791b09b26993140a296b7 (diff) | |
download | gcc-1e731102619f21fe93135546801e0333752baf15.zip gcc-1e731102619f21fe93135546801e0333752baf15.tar.gz gcc-1e731102619f21fe93135546801e0333752baf15.tar.bz2 |
target-def.h (TARGET_CXX_EXPORT_CLASS_DATA): Remove.
* 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
Diffstat (limited to 'gcc/config')
-rw-r--r-- | gcc/config/arm/arm.c | 36 | ||||
-rw-r--r-- | gcc/config/arm/arm.h | 6 | ||||
-rw-r--r-- | gcc/config/arm/symbian.h | 4 |
3 files changed, 37 insertions, 9 deletions
diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c index 5091f8e..b713bff 100644 --- a/gcc/config/arm/arm.c +++ b/gcc/config/arm/arm.c @@ -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); @@ -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; @@ -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 diff --git a/gcc/config/arm/arm.h b/gcc/config/arm/arm.h index 59ad92a..5955a52 100644 --- a/gcc/config/arm/arm.h +++ b/gcc/config/arm/arm.h @@ -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 diff --git a/gcc/config/arm/symbian.h b/gcc/config/arm/symbian.h index 2a588ed..5ea3fa7 100644 --- a/gcc/config/arm/symbian.h +++ b/gcc/config/arm/symbian.h @@ -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 |