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>
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
+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.
$(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) \
#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
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;
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}
#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
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 \
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);
+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.
--- /dev/null
+/* { 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 ()
+{}
+
+}