From 40a1c5cb5e9ac61a3152e84815b60069d80e31b1 Mon Sep 17 00:00:00 2001 From: Mark Mitchell Date: Fri, 3 Sep 2004 00:43:59 +0000 Subject: [PATCH] bpabi.h (TARGET_BPABI_CPP_BUILTINS): Define. * config/arm/bpabi.h (TARGET_BPABI_CPP_BUILTINS): Define. (TARGET_OS_CPP_BUILTINS): Likewise. * config/arm/symbian.h (TARGET_OS_CPP_BUILTINS): Include TARGET_BPABI_CPP_BUILTINS. * g++.dg/abi/arm_rtti1.C: New test. * libsupc++/typeinfo: Honor __GXX_MERGED_TYPEINFO_NAMES if already defined. [[Split portion of a mixed commit.]] From-SVN: r87018.2 --- gcc/ChangeLog | 7 +++++++ gcc/config/arm/bpabi.h | 16 ++++++++++++++++ gcc/config/arm/symbian.h | 7 +++++-- gcc/testsuite/ChangeLog | 4 ++++ gcc/testsuite/g++.dg/abi/arm_rtti1.C | 14 ++++++++++++++ libstdc++-v3/ChangeLog | 5 +++++ libstdc++-v3/libsupc++/typeinfo | 14 ++++++++------ 7 files changed, 59 insertions(+), 8 deletions(-) create mode 100644 gcc/testsuite/g++.dg/abi/arm_rtti1.C diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 758a33ac9b9..96eb1b86835 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2004-09-02 Mark Mitchell + + * config/arm/bpabi.h (TARGET_BPABI_CPP_BUILTINS): Define. + (TARGET_OS_CPP_BUILTINS): Likewise. + * config/arm/symbian.h (TARGET_OS_CPP_BUILTINS): Include + TARGET_BPABI_CPP_BUILTINS. + 2004-09-02 Roman Zippel * combine.c (distribute_notes): Don't add REG_LABEL to jump insn. diff --git a/gcc/config/arm/bpabi.h b/gcc/config/arm/bpabi.h index 60d6e75b73a..e2be11446f8 100644 --- a/gcc/config/arm/bpabi.h +++ b/gcc/config/arm/bpabi.h @@ -84,3 +84,19 @@ #define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY (floatdisf, l2f) #endif +/* The BPABI requires that we always use an out-of-line implementation + of RTTI comparison, even if the target supports weak symbols, + because the same object file might be used on a target that does + not support merging symbols across DLL boundaries. This macro is + broken out separately so that it can be used within + TARGET_OS_CPP_BUILTINS in configuration files for systems based on + the BPABI. */ +#define TARGET_BPABI_CPP_BUILTINS() \ + do \ + { \ + builtin_define ("__GXX_MERGED_TYPEINFO_NAMES=0"); \ + } \ + while (false) + +#define TARGET_OS_CPP_BUILTINS() \ + TARGET_BPABI_CPP_BUILTINS() diff --git a/gcc/config/arm/symbian.h b/gcc/config/arm/symbian.h index 5a59e79af17..a900d76f76b 100644 --- a/gcc/config/arm/symbian.h +++ b/gcc/config/arm/symbian.h @@ -75,9 +75,12 @@ #define RENAME_LIBRARY(GCC_NAME, AEABI_NAME) /* empty */ /* Define the __symbian__ macro. */ +#undef TARGET_OS_CPP_BUILTINS #define TARGET_OS_CPP_BUILTINS() \ - do \ + do \ { \ + /* Include the default BPABI stuff. */ \ + TARGET_BPABI_CPP_BUILTINS (); \ builtin_define ("__symbian__"); \ - } \ + } \ while (false) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index df9b8065f75..428480c3b3c 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2004-09-02 Mark Mitchell + + * g++.dg/abi/arm_rtti1.C: New test. + 2004-09-02 Geoffrey Keating * gcc.dg/ppc-vector-memcpy.c: New. diff --git a/gcc/testsuite/g++.dg/abi/arm_rtti1.C b/gcc/testsuite/g++.dg/abi/arm_rtti1.C new file mode 100644 index 00000000000..a481bdd1f13 --- /dev/null +++ b/gcc/testsuite/g++.dg/abi/arm_rtti1.C @@ -0,0 +1,14 @@ +// { dg-do compile { target arm*-*-eabi* arm*-*-symbianelf* } } +// { dg-options "-O2" } +// Check that, even when optimizing, we emit an out-of-line call to +// the type-info comparison function. +// { dg-final { scan-assembler _ZNKSt9type_infoeqERKS_ } } + +#include + +extern const std::type_info& t1; +extern const std::type_info& t2; + +bool f() { + return t1 == t2; +} diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 0f4816b6dea..1cdfef625ec 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,8 @@ +2004-09-02 Mark Mitchell + + * libsupc++/typeinfo: Honor __GXX_MERGED_TYPEINFO_NAMES if already + defined. + 2004-09-02 Benjamin Kosnik Simon Richter diff --git a/libstdc++-v3/libsupc++/typeinfo b/libstdc++-v3/libsupc++/typeinfo index 46803ad4d14..81824223eb6 100644 --- a/libstdc++-v3/libsupc++/typeinfo +++ b/libstdc++-v3/libsupc++/typeinfo @@ -46,12 +46,14 @@ namespace __cxxabiv1 class __class_type_info; } // namespace __cxxabiv1 -#if !__GXX_WEAK__ - // If weak symbols are not supported, typeinfo names are not merged. - #define __GXX_MERGED_TYPEINFO_NAMES 0 -#else - // On platforms that support weak symbols, typeinfo names are merged. - #define __GXX_MERGED_TYPEINFO_NAMES 1 +#ifndef __GXX_MERGED_TYPEINFO_NAMES + #if !__GXX_WEAK__ + // If weak symbols are not supported, typeinfo names are not merged. + #define __GXX_MERGED_TYPEINFO_NAMES 0 + #else + // On platforms that support weak symbols, typeinfo names are merged. + #define __GXX_MERGED_TYPEINFO_NAMES 1 + #endif #endif namespace std -- 2.30.2