diff options
author | Geoffrey Keating <geoffk@apple.com> | 2007-01-09 07:48:38 +0000 |
---|---|---|
committer | Geoffrey Keating <geoffk@gcc.gnu.org> | 2007-01-09 07:48:38 +0000 |
commit | 157600d084f021125d99def7874bd7e6a01f2cd3 (patch) | |
tree | d0caf2e0b46a9b90f225815564ffe0a37d2140fc | |
parent | 95af8923f19ed9bddc89caa02103d48b44641c7e (diff) | |
download | gcc-157600d084f021125d99def7874bd7e6a01f2cd3.zip gcc-157600d084f021125d99def7874bd7e6a01f2cd3.tar.gz gcc-157600d084f021125d99def7874bd7e6a01f2cd3.tar.bz2 |
Index: ChangeLog
2007-01-08 Geoffrey Keating <geoffk@apple.com>
* target.h (struct gcc_target): New field library_rtti_comdat.
* target-def.h (TARGET_CXX_LIBRARY_RTTI_COMDAT): New.
(TARGET_CXX): Add TARGET_CXX_LIBRARY_RTTI_COMDAT.
* doc/tm.texi (C++ ABI): Document TARGET_CXX_LIBRARY_RTTI_COMDAT.
* config/darwin.h (TARGET_CXX_LIBRARY_RTTI_COMDAT): Define.
Index: testsuite/ChangeLog
2007-01-08 Geoffrey Keating <geoffk@apple.com>
* g++.dg/rtti/darwin-builtin-linkage.C: New.
Index: cp/ChangeLog
2007-01-08 Geoffrey Keating <geoffk@apple.com>
* rtti.c: Include target.h.
(emit_support_tinfos): If ! targetm.cxx.library_rtti_comdat (),
don't emit typeinfo for fundamental types as weak.
* Make-lang.in (cp/rtti.o): Update and correct dependencies.
From-SVN: r120611
-rw-r--r-- | gcc/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/config/darwin.h | 4 | ||||
-rw-r--r-- | gcc/cp/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/cp/Make-lang.in | 2 | ||||
-rw-r--r-- | gcc/cp/rtti.c | 8 | ||||
-rw-r--r-- | gcc/doc/tm.texi | 6 | ||||
-rw-r--r-- | gcc/target-def.h | 5 | ||||
-rw-r--r-- | gcc/target.h | 4 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/rtti/darwin-builtin-linkage.C | 20 |
10 files changed, 65 insertions, 3 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 7e8fc99..caeff6b 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,13 @@ 2007-01-08 Geoffrey Keating <geoffk@apple.com> + * target.h (struct gcc_target): New field library_rtti_comdat. + * target-def.h (TARGET_CXX_LIBRARY_RTTI_COMDAT): New. + (TARGET_CXX): Add TARGET_CXX_LIBRARY_RTTI_COMDAT. + * doc/tm.texi (C++ ABI): Document TARGET_CXX_LIBRARY_RTTI_COMDAT. + * config/darwin.h (TARGET_CXX_LIBRARY_RTTI_COMDAT): Define. + +2007-01-08 Geoffrey Keating <geoffk@apple.com> + * doc/invoke.texi (Optimize Options): Correct description of -O0. 2007-01-08 Richard Guenther <rguenther@suse.de> diff --git a/gcc/config/darwin.h b/gcc/config/darwin.h index fb885ad..926197c 100644 --- a/gcc/config/darwin.h +++ b/gcc/config/darwin.h @@ -482,6 +482,10 @@ extern GTY(()) int darwin_ms_struct; with names, so it's safe to make the class data not comdat. */ #define TARGET_CXX_CLASS_DATA_ALWAYS_COMDAT hook_bool_void_false +/* For efficiency, on Darwin the RTTI information that is always + emitted in the standard C++ library should not be COMDAT. */ +#define TARGET_CXX_LIBRARY_RTTI_COMDAT hook_bool_void_false + /* We make exception information linkonce. */ #undef TARGET_USES_WEAK_UNWIND_INFO #define TARGET_USES_WEAK_UNWIND_INFO 1 diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index d41988f..f97f7d9 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,10 @@ +2007-01-08 Geoffrey Keating <geoffk@apple.com> + + * rtti.c: Include target.h. + (emit_support_tinfos): If ! targetm.cxx.library_rtti_comdat (), + don't emit typeinfo for fundamental types as weak. + * Make-lang.in (cp/rtti.o): Update and correct dependencies. + 2007-01-08 Richard Guenther <rguenther@suse.de> * cvt.c (cp_convert_to_pointer): Use build_int_cst_type. diff --git a/gcc/cp/Make-lang.in b/gcc/cp/Make-lang.in index db095ce..b16bcc1 100644 --- a/gcc/cp/Make-lang.in +++ b/gcc/cp/Make-lang.in @@ -265,7 +265,7 @@ cp/tree.o: cp/tree.c $(CXX_TREE_H) $(TM_H) $(FLAGS_H) toplev.h $(RTL_H) \ $(TARGET_H) debug.h cp/ptree.o: cp/ptree.c $(CXX_TREE_H) $(TM_H) cp/rtti.o: cp/rtti.c $(CXX_TREE_H) $(TM_H) $(FLAGS_H) toplev.h convert.h \ - gt-cp-rtti.h + $(TARGET_H) gt-cp-rtti.h cp/except.o: cp/except.c $(CXX_TREE_H) $(TM_H) $(FLAGS_H) $(RTL_H) except.h \ toplev.h cp/cfns.h $(EXPR_H) libfuncs.h $(TREE_INLINE_H) $(TARGET_H) cp/expr.o: cp/expr.c $(CXX_TREE_H) $(TM_H) $(RTL_H) $(FLAGS_H) $(EXPR_H) \ diff --git a/gcc/cp/rtti.c b/gcc/cp/rtti.c index f185cc5..8549ec0 100644 --- a/gcc/cp/rtti.c +++ b/gcc/cp/rtti.c @@ -32,6 +32,7 @@ Boston, MA 02110-1301, USA. */ #include "assert.h" #include "toplev.h" #include "convert.h" +#include "target.h" /* C++ returns type information to the user in struct type_info objects. We also use type information to implement dynamic_cast and @@ -1429,8 +1430,11 @@ emit_support_tinfos (void) comdat_linkage for details.) Since we want these objects to have external linkage so that copies do not have to be emitted in code outside the runtime library, we make them - non-COMDAT here. */ - if (!flag_weak) + non-COMDAT here. + + It might also not be necessary to follow this detail of the + ABI. */ + if (!flag_weak || ! targetm.cxx.library_rtti_comdat ()) { gcc_assert (TREE_PUBLIC (tinfo) && !DECL_COMDAT (tinfo)); DECL_INTERFACE_KNOWN (tinfo) = 1; diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi index 0896ab8..9e8ad0e 100644 --- a/gcc/doc/tm.texi +++ b/gcc/doc/tm.texi @@ -9080,6 +9080,12 @@ classes whose virtual table will be emitted in only one translation unit will not be COMDAT. @end deftypefn +@deftypefn {Target Hook} bool TARGET_CXX_LIBRARY_RTTI_COMDAT (void) +This hook returns true (the default) if the RTTI information for +the basic types which is defined in the C++ runtime should always +be COMDAT, false if it should not be COMDAT. +@end deftypefn + @deftypefn {Target Hook} bool TARGET_CXX_USE_AEABI_ATEXIT (void) This hook returns true if @code{__aeabi_atexit} (as defined by the ARM EABI) should be used to register static destructors when @option{-fuse-cxa-atexit} diff --git a/gcc/target-def.h b/gcc/target-def.h index 8cb5d26..8f7abd8 100644 --- a/gcc/target-def.h +++ b/gcc/target-def.h @@ -596,6 +596,10 @@ Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #define TARGET_CXX_CLASS_DATA_ALWAYS_COMDAT hook_bool_void_true #endif +#ifndef TARGET_CXX_LIBRARY_RTTI_COMDAT +#define TARGET_CXX_LIBRARY_RTTI_COMDAT hook_bool_void_true +#endif + #ifndef TARGET_CXX_USE_AEABI_ATEXIT #define TARGET_CXX_USE_AEABI_ATEXIT hook_bool_void_false #endif @@ -619,6 +623,7 @@ Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. TARGET_CXX_KEY_METHOD_MAY_BE_INLINE, \ TARGET_CXX_DETERMINE_CLASS_DATA_VISIBILITY, \ TARGET_CXX_CLASS_DATA_ALWAYS_COMDAT, \ + TARGET_CXX_LIBRARY_RTTI_COMDAT, \ TARGET_CXX_USE_AEABI_ATEXIT, \ TARGET_CXX_USE_ATEXIT_FOR_CXA_ATEXIT, \ TARGET_CXX_ADJUST_CLASS_AT_DEFINITION \ diff --git a/gcc/target.h b/gcc/target.h index b59f561..e86ba21 100644 --- a/gcc/target.h +++ b/gcc/target.h @@ -808,6 +808,10 @@ struct gcc_target 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); + /* Returns true (the default) if the RTTI for the basic types, + which is always defined in the C++ runtime, should be COMDAT; + false if it should not be COMDAT. */ + bool (*library_rtti_comdat) (void); /* Returns true if __aeabi_atexit should be used to register static destructors. */ bool (*use_aeabi_atexit) (void); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 538c84d..4d097ea 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2007-01-08 Geoffrey Keating <geoffk@apple.com> + + * g++.dg/rtti/darwin-builtin-linkage.C: New. + 2007-01-08 Andrew Pinski <andrew_pinski@playstation.sony.com> * gcc.target/spu/intrinsics-1.c: Remove xfail. diff --git a/gcc/testsuite/g++.dg/rtti/darwin-builtin-linkage.C b/gcc/testsuite/g++.dg/rtti/darwin-builtin-linkage.C new file mode 100644 index 0000000..6db1611 --- /dev/null +++ b/gcc/testsuite/g++.dg/rtti/darwin-builtin-linkage.C @@ -0,0 +1,20 @@ +/* { dg-do compile { target *-*-darwin* } } */ +/* { dg-final { scan-assembler-not "\\.weak_definition __ZTI" } } */ + +/* Verify that none of the type_info structures for the fundamental + types are emitted as weak on Darwin. */ + +#include <cxxabi.h> + +namespace __cxxabiv1 { + +using namespace std; + +// This has special meaning to the compiler, and will cause it +// to emit the type_info structures for the fundamental types which are +// mandated to exist in the runtime. +__fundamental_type_info:: +~__fundamental_type_info () +{} + +} |