aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.4.3/gcc
diff options
context:
space:
mode:
authorAndrew Hsieh <andrewhsieh@google.com>2012-09-18 23:21:28 -0700
committerAndrew Hsieh <andrewhsieh@google.com>2012-09-19 00:39:24 -0700
commite7dea20321d2eb2ab24293953a9914031b8c532a (patch)
tree992322cee9f1b0b6cc5bdd09e5e7d27f41ab5132 /gcc-4.4.3/gcc
parentb6f4708104b7ccb10e2b7e4f58d82f409418ad36 (diff)
downloadtoolchain_gcc-e7dea20321d2eb2ab24293953a9914031b8c532a.tar.gz
toolchain_gcc-e7dea20321d2eb2ab24293953a9914031b8c532a.tar.bz2
toolchain_gcc-e7dea20321d2eb2ab24293953a9914031b8c532a.zip
Fix GCC 4.4.3 GNU libstdc++ to NOT merge typeinfo names by default
Back port r149964, r153734, r153742 and r153768, with later revision reverts previous one (some "partially", or nothing would have left :) This issue is fixed in GCC 4.6 (NDK r8b+). See the new gcc-4.4.3/libstdc++-v3/libsupc++/typeinfo for details. Related issue/discussion: http://code.google.com/p/android/issues/detail?id=22165 https://groups.google.com/forum/#!msg/android-ndk/FlnuAOIKHOo/kLEwaBso7KYJ%5B1-25%5D Change-Id: I0ef9d5001c82f2eb5472a1c4fd60b07d33e0ab1f
Diffstat (limited to 'gcc-4.4.3/gcc')
-rw-r--r--gcc-4.4.3/gcc/cp/rtti.c28
1 files changed, 21 insertions, 7 deletions
diff --git a/gcc-4.4.3/gcc/cp/rtti.c b/gcc-4.4.3/gcc/cp/rtti.c
index 8861934df..7ae227c2a 100644
--- a/gcc-4.4.3/gcc/cp/rtti.c
+++ b/gcc-4.4.3/gcc/cp/rtti.c
@@ -103,7 +103,7 @@ VEC(tree,gc) *unemitted_tinfo_decls;
static GTY (()) VEC(tinfo_s,gc) *tinfo_descs;
static tree ifnonnull (tree, tree);
-static tree tinfo_name (tree);
+static tree tinfo_name (tree, bool);
static tree build_dynamic_cast_1 (tree, tree, tsubst_flags_t);
static tree throw_bad_cast (void);
static tree throw_bad_typeid (void);
@@ -350,16 +350,30 @@ build_typeid (tree exp)
return exp;
}
-/* Generate the NTBS name of a type. */
+/* Generate the NTBS name of a type. If MARK_PRIVATE, put a '*' in front so that
+ comparisons will be done by pointer rather than string comparison. */
static tree
-tinfo_name (tree type)
+tinfo_name (tree type, bool mark_private)
{
const char *name;
+ int length;
tree name_string;
name = mangle_type_string (type);
- name_string = fix_string_type (build_string (strlen (name) + 1, name));
- return name_string;
+ length = strlen (name);
+
+ if (mark_private)
+ {
+ /* Inject '*' at beginning of name to force pointer comparison. */
+ char* buf = (char*) XALLOCAVEC (char, length + 1);
+ buf[0] = '*';
+ memcpy (buf + 1, name, length);
+ name_string = build_string (length + 1, buf);
+ }
+ else
+ name_string = build_string (length + 1, name);
+
+ return fix_string_type (name_string);
}
/* Return a VAR_DECL for the internal ABI defined type_info object for
@@ -841,13 +855,12 @@ tinfo_base_init (tinfo_s *ti, tree target)
tree vtable_ptr;
{
- tree name_name;
+ tree name_name, name_string;
/* Generate the NTBS array variable. */
tree name_type = build_cplus_array_type
(build_qualified_type (char_type_node, TYPE_QUAL_CONST),
NULL_TREE);
- tree name_string = tinfo_name (target);
/* Determine the name of the variable -- and remember with which
type it is associated. */
@@ -864,6 +877,7 @@ tinfo_base_init (tinfo_s *ti, tree target)
DECL_TINFO_P (name_decl) = 1;
set_linkage_according_to_type (target, name_decl);
import_export_decl (name_decl);
+ name_string = tinfo_name (target, !TREE_PUBLIC (name_decl));
DECL_INITIAL (name_decl) = name_string;
mark_used (name_decl);
pushdecl_top_level_and_finish (name_decl, name_string);